From f1b3a14bc23ccee6acaf6bbe27827523dc13c111 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 31 May 2019 13:38:18 +0200 Subject: Do not add VCC if not used, loading json works --- ice40/pack.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ice40') diff --git a/ice40/pack.cc b/ice40/pack.cc index 390cbf57..d8796ede 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -352,6 +352,7 @@ static void pack_constants(Context *ctx) std::vector dead_nets; bool gnd_used = false; + bool vcc_used = false; for (auto net : sorted(ctx->nets)) { NetInfo *ni = net.second; @@ -364,6 +365,7 @@ static void pack_constants(Context *ctx) } else if (ni->driver.cell != nullptr && ni->driver.cell->type == ctx->id("VCC")) { IdString drv_cell = ni->driver.cell->name; set_net_constant(ctx, ni, vcc_net.get(), true); + vcc_used = true; dead_nets.push_back(net.first); ctx->cells.erase(drv_cell); } @@ -373,11 +375,10 @@ static void pack_constants(Context *ctx) ctx->cells[gnd_cell->name] = std::move(gnd_cell); ctx->nets[gnd_net->name] = std::move(gnd_net); } - // Vcc cell always inserted for now, as it may be needed during carry legalisation (TODO: trim later if actually - // never used?) - ctx->cells[vcc_cell->name] = std::move(vcc_cell); - ctx->nets[vcc_net->name] = std::move(vcc_net); - + if (vcc_used) { + ctx->cells[vcc_cell->name] = std::move(vcc_cell); + ctx->nets[vcc_net->name] = std::move(vcc_net); + } for (auto dn : dead_nets) { ctx->nets.erase(dn); } -- cgit v1.2.3 From d5d8213871d8cb68b2e4ef9b3557879c80ff5b51 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 1 Jun 2019 15:52:32 +0200 Subject: Added support for attributes/properties types --- ice40/pack.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ice40') diff --git a/ice40/pack.cc b/ice40/pack.cc index d8796ede..6c5dad39 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -1202,7 +1202,7 @@ static void pack_special(Context *ctx) ? "1" : feedback_path == "PHASE_AND_DELAY" ? "2" - : feedback_path == "EXTERNAL" ? "6" : feedback_path; + : feedback_path == "EXTERNAL" ? "6" : std::string(feedback_path); if (!std::all_of(fbp_value.begin(), fbp_value.end(), isdigit)) log_error("PLL '%s' has unsupported FEEDBACK_PATH value '%s'\n", ci->name.c_str(ctx), feedback_path.c_str()); -- cgit v1.2.3 From eff1a1341a14c105ecf3bd8c559bf425915c3e01 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 2 Jun 2019 08:51:32 +0200 Subject: Revert "Do not add VCC if not used, loading json works" This reverts commit f1b3a14bc23ccee6acaf6bbe27827523dc13c111. --- ice40/pack.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'ice40') diff --git a/ice40/pack.cc b/ice40/pack.cc index 6c5dad39..4cb76add 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -352,7 +352,6 @@ static void pack_constants(Context *ctx) std::vector dead_nets; bool gnd_used = false; - bool vcc_used = false; for (auto net : sorted(ctx->nets)) { NetInfo *ni = net.second; @@ -365,7 +364,6 @@ static void pack_constants(Context *ctx) } else if (ni->driver.cell != nullptr && ni->driver.cell->type == ctx->id("VCC")) { IdString drv_cell = ni->driver.cell->name; set_net_constant(ctx, ni, vcc_net.get(), true); - vcc_used = true; dead_nets.push_back(net.first); ctx->cells.erase(drv_cell); } @@ -375,10 +373,11 @@ static void pack_constants(Context *ctx) ctx->cells[gnd_cell->name] = std::move(gnd_cell); ctx->nets[gnd_net->name] = std::move(gnd_net); } - if (vcc_used) { - ctx->cells[vcc_cell->name] = std::move(vcc_cell); - ctx->nets[vcc_net->name] = std::move(vcc_net); - } + // Vcc cell always inserted for now, as it may be needed during carry legalisation (TODO: trim later if actually + // never used?) + ctx->cells[vcc_cell->name] = std::move(vcc_cell); + ctx->nets[vcc_net->name] = std::move(vcc_net); + for (auto dn : dead_nets) { ctx->nets.erase(dn); } -- cgit v1.2.3 From 1093d7e1228272ca73114bbc4415c48d6cba76ed Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 7 Jun 2019 11:48:15 +0200 Subject: WIP saving/loading attributes --- ice40/arch.cc | 24 ++++++++++++++++++++---- ice40/arch.h | 2 ++ ice40/pack.cc | 1 + 3 files changed, 23 insertions(+), 4 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index d536ad35..659717f8 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -683,16 +683,21 @@ bool Arch::place() } else { log_error("iCE40 architecture does not support placer '%s'\n", placer.c_str()); } + bool retVal = true; if (bool_or_default(settings, id("opt_timing"), false)) { TimingOptCfg tocfg(getCtx()); tocfg.cellTypes.insert(id_ICESTORM_LC); - return timing_opt(getCtx(), tocfg); - } else { - return true; + retVal = timing_opt(getCtx(), tocfg); } + archInfoToAttributes(); + return retVal; } -bool Arch::route() { return router1(getCtx(), Router1Cfg(getCtx())); } +bool Arch::route() { + bool retVal = router1(getCtx(), Router1Cfg(getCtx())); + archInfoToAttributes(); + return retVal; +} // ----------------------------------------------------------------------- @@ -1229,6 +1234,17 @@ void Arch::assignCellInfo(CellInfo *cell) } } +void Arch::archInfoToAttributes() +{ + commonInfoToAttributes(); +} + +void Arch::attributesToArchInfo() +{ + attributesToCommonInfo(); + assignArchInfo(); +} + const std::string Arch::defaultPlacer = "sa"; const std::vector Arch::availablePlacers = {"sa", diff --git a/ice40/arch.h b/ice40/arch.h index ea29f4f1..8b6942cb 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -878,6 +878,8 @@ struct Arch : BaseCtx // netlist modifications, and validity checks void assignArchInfo(); void assignCellInfo(CellInfo *cell); + void archInfoToAttributes(); + void attributesToArchInfo(); // ------------------------------------------------- BelPin getIOBSharingPLLPin(BelId pll, IdString pll_pin) const diff --git a/ice40/pack.cc b/ice40/pack.cc index 4cb76add..bc57e7d0 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -1406,6 +1406,7 @@ bool Arch::pack() ctx->assignArchInfo(); constrain_chains(ctx); ctx->assignArchInfo(); + archInfoToAttributes(); log_info("Checksum: 0x%08x\n", ctx->checksum()); return true; } catch (log_execution_error_exception) { -- cgit v1.2.3 From 78e6631f766194c078b6cd32d520146e6ab257a4 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 7 Jun 2019 13:49:19 +0200 Subject: Cleanup --- ice40/arch.cc | 11 ----------- ice40/arch.h | 2 -- 2 files changed, 13 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index 659717f8..b7207ca9 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -1234,17 +1234,6 @@ void Arch::assignCellInfo(CellInfo *cell) } } -void Arch::archInfoToAttributes() -{ - commonInfoToAttributes(); -} - -void Arch::attributesToArchInfo() -{ - attributesToCommonInfo(); - assignArchInfo(); -} - const std::string Arch::defaultPlacer = "sa"; const std::vector Arch::availablePlacers = {"sa", diff --git a/ice40/arch.h b/ice40/arch.h index 8b6942cb..ea29f4f1 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -878,8 +878,6 @@ struct Arch : BaseCtx // netlist modifications, and validity checks void assignArchInfo(); void assignCellInfo(CellInfo *cell); - void archInfoToAttributes(); - void attributesToArchInfo(); // ------------------------------------------------- BelPin getIOBSharingPLLPin(BelId pll, IdString pll_pin) const -- cgit v1.2.3 From 07b21c51299d7ec38aca2a7994542e3c50f93aa3 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 7 Jun 2019 13:58:21 +0200 Subject: Add vcc and gnd nets and cells only if needed --- ice40/pack.cc | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'ice40') diff --git a/ice40/pack.cc b/ice40/pack.cc index bc57e7d0..0a62a5ca 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -340,6 +340,12 @@ static void pack_constants(Context *ctx) gnd_net->driver.cell = gnd_cell.get(); gnd_net->driver.port = ctx->id("O"); gnd_cell->ports.at(ctx->id("O")).net = gnd_net.get(); + + NetInfo* gnd_net_info = gnd_net.get(); + if (ctx->nets.find(ctx->id("$PACKER_GND_NET"))!=ctx->nets.end()) + { + gnd_net_info = ctx->nets.find(ctx->id("$PACKER_GND_NET"))->second.get(); + } std::unique_ptr vcc_cell = create_ice_cell(ctx, ctx->id("ICESTORM_LC"), "$PACKER_VCC"); vcc_cell->params[ctx->id("LUT_INIT")] = "1"; @@ -348,6 +354,12 @@ static void pack_constants(Context *ctx) vcc_net->driver.cell = vcc_cell.get(); vcc_net->driver.port = ctx->id("O"); vcc_cell->ports.at(ctx->id("O")).net = vcc_net.get(); + + NetInfo* vcc_net_info = vcc_net.get(); + if (ctx->nets.find(ctx->id("$PACKER_VCC_NET"))!=ctx->nets.end()) + { + vcc_net_info = ctx->nets.find(ctx->id("$PACKER_VCC_NET"))->second.get(); + } std::vector dead_nets; @@ -357,26 +369,29 @@ static void pack_constants(Context *ctx) NetInfo *ni = net.second; if (ni->driver.cell != nullptr && ni->driver.cell->type == ctx->id("GND")) { IdString drv_cell = ni->driver.cell->name; - set_net_constant(ctx, ni, gnd_net.get(), false); + set_net_constant(ctx, ni, gnd_net_info, false); gnd_used = true; dead_nets.push_back(net.first); ctx->cells.erase(drv_cell); } else if (ni->driver.cell != nullptr && ni->driver.cell->type == ctx->id("VCC")) { IdString drv_cell = ni->driver.cell->name; - set_net_constant(ctx, ni, vcc_net.get(), true); + set_net_constant(ctx, ni, vcc_net_info, true); dead_nets.push_back(net.first); ctx->cells.erase(drv_cell); } } - if (gnd_used) { + if (gnd_used && (gnd_net_info == gnd_net.get())) { ctx->cells[gnd_cell->name] = std::move(gnd_cell); ctx->nets[gnd_net->name] = std::move(gnd_net); } // Vcc cell always inserted for now, as it may be needed during carry legalisation (TODO: trim later if actually // never used?) - ctx->cells[vcc_cell->name] = std::move(vcc_cell); - ctx->nets[vcc_net->name] = std::move(vcc_net); + if (vcc_net_info == vcc_net.get()) + { + ctx->cells[vcc_cell->name] = std::move(vcc_cell); + ctx->nets[vcc_net->name] = std::move(vcc_net); + } for (auto dn : dead_nets) { ctx->nets.erase(dn); -- cgit v1.2.3 From d9b0bac248a12466cd2b62d02ec11b2e60d25019 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 7 Jun 2019 16:11:11 +0200 Subject: Save top level attrs and store current step --- ice40/arch.cc | 2 ++ ice40/pack.cc | 1 + 2 files changed, 3 insertions(+) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index b7207ca9..4945f5b3 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -689,12 +689,14 @@ bool Arch::place() tocfg.cellTypes.insert(id_ICESTORM_LC); retVal = timing_opt(getCtx(), tocfg); } + getCtx()->attrs[getCtx()->id("step")] = "place"; archInfoToAttributes(); return retVal; } bool Arch::route() { bool retVal = router1(getCtx(), Router1Cfg(getCtx())); + getCtx()->attrs[getCtx()->id("step")] = "route"; archInfoToAttributes(); return retVal; } diff --git a/ice40/pack.cc b/ice40/pack.cc index 0a62a5ca..ce39c903 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -1421,6 +1421,7 @@ bool Arch::pack() ctx->assignArchInfo(); constrain_chains(ctx); ctx->assignArchInfo(); + ctx->attrs[ctx->id("step")] = "pack"; archInfoToAttributes(); log_info("Checksum: 0x%08x\n", ctx->checksum()); return true; -- cgit v1.2.3 From 856760599e51bd4c6da34112c993dc8bfb995f36 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 12 Jun 2019 18:34:34 +0200 Subject: Use properties for settings and save in json --- ice40/pcf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ice40') diff --git a/ice40/pcf.cc b/ice40/pcf.cc index a8273dd6..91935bee 100644 --- a/ice40/pcf.cc +++ b/ice40/pcf.cc @@ -116,7 +116,7 @@ bool apply_pcf(Context *ctx, std::string filename, std::istream &in) } } } - ctx->settings.emplace(ctx->id("input/pcf"), filename); + ctx->settings[ctx->id("input/pcf")] = filename; return true; } catch (log_execution_error_exception) { return false; -- cgit v1.2.3 From 1cd4a4d17aeaab26664add714c8a02f76f6a6a90 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 13 Jun 2019 17:42:41 +0200 Subject: Remove concept of project and code connected --- ice40/project.cc | 76 -------------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 ice40/project.cc (limited to 'ice40') diff --git a/ice40/project.cc b/ice40/project.cc deleted file mode 100644 index bbd82fd7..00000000 --- a/ice40/project.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* - * nextpnr -- Next Generation Place and Route - * - * Copyright (C) 2018 Miodrag Milanovic - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#include "project.h" -#include -#include -#include "log.h" -#include "pcf.h" - -NEXTPNR_NAMESPACE_BEGIN - -void ProjectHandler::saveArch(Context *ctx, pt::ptree &root, std::string path) -{ - root.put("project.arch.package", ctx->archArgs().package); - if (ctx->settings.find(ctx->id("input/pcf")) != ctx->settings.end()) { - std::string fn = ctx->settings[ctx->id("input/pcf")]; - root.put("project.input.pcf", make_relative(fn, path).string()); - } -} - -std::unique_ptr ProjectHandler::createContext(pt::ptree &root) -{ - ArchArgs chipArgs; - std::string arch_type = root.get("project.arch.type"); - if (arch_type == "lp384") { - chipArgs.type = ArchArgs::LP384; - } - if (arch_type == "lp1k") { - chipArgs.type = ArchArgs::LP1K; - } - if (arch_type == "lp8k") { - chipArgs.type = ArchArgs::LP8K; - } - if (arch_type == "hx1k") { - chipArgs.type = ArchArgs::HX1K; - } - if (arch_type == "hx8k") { - chipArgs.type = ArchArgs::HX8K; - } - if (arch_type == "up5k") { - chipArgs.type = ArchArgs::UP5K; - } - if (arch_type == "u4k") { - chipArgs.type = ArchArgs::U4K; - } - chipArgs.package = root.get("project.arch.package"); - - return std::unique_ptr(new Context(chipArgs)); -} - -void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path) -{ - auto input = root.get_child("project").get_child("input"); - boost::filesystem::path pcf = boost::filesystem::path(path) / input.get("pcf"); - std::ifstream f(pcf.string()); - if (!apply_pcf(ctx, input.get("pcf"), f)) - log_error("Loading PCF failed.\n"); -} - -NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From 4de147d9e42d7c932773544011a36e4550530a9e Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 13 Jun 2019 18:39:16 +0200 Subject: Save settings that we saved in project --- ice40/main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ice40') diff --git a/ice40/main.cc b/ice40/main.cc index 9b79a08c..4cbca2d4 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -167,7 +167,7 @@ std::unique_ptr Ice40CommandHandler::createContext() chipArgs.package = vm["package"].as(); auto ctx = std::unique_ptr(new Context(chipArgs)); - + ctx->settings[ctx->id("arch.package")] = ctx->archArgs().package; if (vm.count("promote-logic")) ctx->settings[ctx->id("promote_logic")] = "1"; if (vm.count("no-promote-globals")) -- cgit v1.2.3 From 03dff10cbde4c55e4ac9b53a01ba84f4bdac169b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 13 Jun 2019 20:42:11 +0200 Subject: Load properties from json and propagate to context create --- ice40/main.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ice40') diff --git a/ice40/main.cc b/ice40/main.cc index 4cbca2d4..00d7fe3e 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -36,7 +36,7 @@ class Ice40CommandHandler : public CommandHandler public: Ice40CommandHandler(int argc, char **argv); virtual ~Ice40CommandHandler(){}; - std::unique_ptr createContext() override; + std::unique_ptr createContext(std::unordered_map &values) override; void setupArchContext(Context *ctx) override; void validate() override; void customAfterLoad(Context *ctx) override; @@ -116,7 +116,7 @@ void Ice40CommandHandler::setupArchContext(Context *ctx) } } -std::unique_ptr Ice40CommandHandler::createContext() +std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map &values) { if (vm.count("lp384")) { chipArgs.type = ArchArgs::LP384; -- cgit v1.2.3 From c6057abd00fc4d1538f066324188bd04d6b4cfc7 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 14 Jun 2019 08:13:59 +0200 Subject: restore context from json --- ice40/main.cc | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) (limited to 'ice40') diff --git a/ice40/main.cc b/ice40/main.cc index 00d7fe3e..ce4b5532 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -153,6 +153,49 @@ std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map(); + + if (values.find("arch.name")!=values.end()) { + std::string arch_name = values["arch.name"].str; + if (arch_name != "ice40") + log_error("Unsuported architecture '%s'.\n", arch_name.c_str()); + } + if (values.find("arch.type")!=values.end()) { + std::string arch_type = values["arch.type"].str; + if (chipArgs.type != ArchArgs::NONE) + log_error("Overriding architecture is unsuported.\n"); + + if (arch_type == "lp384") { + chipArgs.type = ArchArgs::LP384; + } + if (arch_type == "lp1k") { + chipArgs.type = ArchArgs::LP1K; + } + if (arch_type == "lp8k") { + chipArgs.type = ArchArgs::LP8K; + } + if (arch_type == "hx1k") { + chipArgs.type = ArchArgs::HX1K; + } + if (arch_type == "hx8k") { + chipArgs.type = ArchArgs::HX8K; + } + if (arch_type == "up5k") { + chipArgs.type = ArchArgs::UP5K; + } + if (arch_type == "u4k") { + chipArgs.type = ArchArgs::U4K; + } + if (chipArgs.type == ArchArgs::NONE) + log_error("Unsuported FPGA type '%s'.\n",arch_type.c_str()); + } + if (values.find("arch.package")!=values.end()) { + if (vm.count("package")) + log_error("Overriding architecture is unsuported.\n"); + chipArgs.package = values["arch.package"].str; + } + if (chipArgs.type == ArchArgs::NONE) { chipArgs.type = ArchArgs::HX1K; chipArgs.package = "tq144"; @@ -163,9 +206,6 @@ std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map(); - auto ctx = std::unique_ptr(new Context(chipArgs)); ctx->settings[ctx->id("arch.package")] = ctx->archArgs().package; if (vm.count("promote-logic")) -- cgit v1.2.3 From ca7e944d7a58bc305f0efce4da757520a6a86041 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 14 Jun 2019 08:55:11 +0200 Subject: restore arch info for ecp5 --- ice40/main.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ice40') diff --git a/ice40/main.cc b/ice40/main.cc index ce4b5532..f3885f29 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -207,6 +207,9 @@ std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map(new Context(chipArgs)); + for(auto &val : values) + ctx->settings[ctx->id(val.first)] = val.second; + ctx->settings[ctx->id("arch.package")] = ctx->archArgs().package; if (vm.count("promote-logic")) ctx->settings[ctx->id("promote_logic")] = "1"; -- cgit v1.2.3 From 36ccc22fc93eddd9b6ed867782668b0057ec67e2 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 14 Jun 2019 09:59:04 +0200 Subject: Use flags for each step --- ice40/arch.cc | 4 ++-- ice40/pack.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index 4945f5b3..a0c64bb8 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -689,14 +689,14 @@ bool Arch::place() tocfg.cellTypes.insert(id_ICESTORM_LC); retVal = timing_opt(getCtx(), tocfg); } - getCtx()->attrs[getCtx()->id("step")] = "place"; + getCtx()->settings[getCtx()->id("place")] = "1"; archInfoToAttributes(); return retVal; } bool Arch::route() { bool retVal = router1(getCtx(), Router1Cfg(getCtx())); - getCtx()->attrs[getCtx()->id("step")] = "route"; + getCtx()->settings[getCtx()->id("route")] = "1"; archInfoToAttributes(); return retVal; } diff --git a/ice40/pack.cc b/ice40/pack.cc index ce39c903..a8f8c76e 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -1421,7 +1421,7 @@ bool Arch::pack() ctx->assignArchInfo(); constrain_chains(ctx); ctx->assignArchInfo(); - ctx->attrs[ctx->id("step")] = "pack"; + ctx->settings[ctx->id("pack")] = "1"; archInfoToAttributes(); log_info("Checksum: 0x%08x\n", ctx->checksum()); return true; -- cgit v1.2.3 From 66ea9f39f7f5d6e1152105328f9a48a367bd8ce0 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 14 Jun 2019 15:18:35 +0200 Subject: enable lading of jsons and setting up context --- ice40/main.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ice40') diff --git a/ice40/main.cc b/ice40/main.cc index f3885f29..de618cbf 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -118,6 +118,8 @@ void Ice40CommandHandler::setupArchContext(Context *ctx) std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map &values) { + ArchArgs chipArgs; + chipArgs.type = ArchArgs::NONE; if (vm.count("lp384")) { chipArgs.type = ArchArgs::LP384; chipArgs.package = "qn32"; -- cgit v1.2.3 From be47fc3e9a81a4890b05223ae18803cb07674dc9 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 25 Jun 2019 18:19:25 +0200 Subject: clangformat run --- ice40/arch.cc | 5 +++-- ice40/main.cc | 16 ++++++++-------- ice40/pack.cc | 32 +++++++++++++++----------------- 3 files changed, 26 insertions(+), 27 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index d58951dd..0b1d280c 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -694,8 +694,9 @@ bool Arch::place() return retVal; } -bool Arch::route() { - bool retVal = router1(getCtx(), Router1Cfg(getCtx())); +bool Arch::route() +{ + bool retVal = router1(getCtx(), Router1Cfg(getCtx())); getCtx()->settings[getCtx()->id("route")] = "1"; archInfoToAttributes(); return retVal; diff --git a/ice40/main.cc b/ice40/main.cc index de618cbf..83cb04b0 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -36,7 +36,7 @@ class Ice40CommandHandler : public CommandHandler public: Ice40CommandHandler(int argc, char **argv); virtual ~Ice40CommandHandler(){}; - std::unique_ptr createContext(std::unordered_map &values) override; + std::unique_ptr createContext(std::unordered_map &values) override; void setupArchContext(Context *ctx) override; void validate() override; void customAfterLoad(Context *ctx) override; @@ -116,7 +116,7 @@ void Ice40CommandHandler::setupArchContext(Context *ctx) } } -std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map &values) +std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map &values) { ArchArgs chipArgs; chipArgs.type = ArchArgs::NONE; @@ -158,12 +158,12 @@ std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map(); - if (values.find("arch.name")!=values.end()) { + if (values.find("arch.name") != values.end()) { std::string arch_name = values["arch.name"].str; if (arch_name != "ice40") log_error("Unsuported architecture '%s'.\n", arch_name.c_str()); } - if (values.find("arch.type")!=values.end()) { + if (values.find("arch.type") != values.end()) { std::string arch_type = values["arch.type"].str; if (chipArgs.type != ArchArgs::NONE) log_error("Overriding architecture is unsuported.\n"); @@ -190,14 +190,14 @@ std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map Ice40CommandHandler::createContext(std::unordered_map(new Context(chipArgs)); - for(auto &val : values) + for (auto &val : values) ctx->settings[ctx->id(val.first)] = val.second; ctx->settings[ctx->id("arch.package")] = ctx->archArgs().package; diff --git a/ice40/pack.cc b/ice40/pack.cc index 66c5c0e8..d1366c9c 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -340,10 +340,9 @@ static void pack_constants(Context *ctx) gnd_net->driver.cell = gnd_cell.get(); gnd_net->driver.port = ctx->id("O"); gnd_cell->ports.at(ctx->id("O")).net = gnd_net.get(); - - NetInfo* gnd_net_info = gnd_net.get(); - if (ctx->nets.find(ctx->id("$PACKER_GND_NET"))!=ctx->nets.end()) - { + + NetInfo *gnd_net_info = gnd_net.get(); + if (ctx->nets.find(ctx->id("$PACKER_GND_NET")) != ctx->nets.end()) { gnd_net_info = ctx->nets.find(ctx->id("$PACKER_GND_NET"))->second.get(); } @@ -354,10 +353,9 @@ static void pack_constants(Context *ctx) vcc_net->driver.cell = vcc_cell.get(); vcc_net->driver.port = ctx->id("O"); vcc_cell->ports.at(ctx->id("O")).net = vcc_net.get(); - - NetInfo* vcc_net_info = vcc_net.get(); - if (ctx->nets.find(ctx->id("$PACKER_VCC_NET"))!=ctx->nets.end()) - { + + NetInfo *vcc_net_info = vcc_net.get(); + if (ctx->nets.find(ctx->id("$PACKER_VCC_NET")) != ctx->nets.end()) { vcc_net_info = ctx->nets.find(ctx->id("$PACKER_VCC_NET"))->second.get(); } @@ -387,8 +385,7 @@ static void pack_constants(Context *ctx) } // Vcc cell always inserted for now, as it may be needed during carry legalisation (TODO: trim later if actually // never used?) - if (vcc_net_info == vcc_net.get()) - { + if (vcc_net_info == vcc_net.get()) { ctx->cells[vcc_cell->name] = std::move(vcc_cell); ctx->nets[vcc_net->name] = std::move(vcc_net); } @@ -1239,13 +1236,14 @@ static void pack_special(Context *ctx) } auto feedback_path = packed->params[ctx->id("FEEDBACK_PATH")]; - std::string fbp_value = feedback_path == "DELAY" - ? "0" - : feedback_path == "SIMPLE" - ? "1" - : feedback_path == "PHASE_AND_DELAY" - ? "2" - : feedback_path == "EXTERNAL" ? "6" : std::string(feedback_path); + std::string fbp_value = + feedback_path == "DELAY" + ? "0" + : feedback_path == "SIMPLE" + ? "1" + : feedback_path == "PHASE_AND_DELAY" + ? "2" + : feedback_path == "EXTERNAL" ? "6" : std::string(feedback_path); if (!std::all_of(fbp_value.begin(), fbp_value.end(), isdigit)) log_error("PLL '%s' has unsupported FEEDBACK_PATH value '%s'\n", ci->name.c_str(ctx), feedback_path.c_str()); -- cgit v1.2.3