diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-06-13 16:54:25 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2018-06-13 16:54:25 +0200 |
commit | 81a154ca5defa4af0da827d12467d68581817364 (patch) | |
tree | 2045a2eb6a16d6736e3363e7626584d12ecfaf5d /ice40/pack.cc | |
parent | aa4fedfd54c111383608857e4c5ba30330bdfbbe (diff) | |
parent | 5af707a0b6eb5455b40fac572a7bfeb5c3940eb4 (diff) | |
download | nextpnr-81a154ca5defa4af0da827d12467d68581817364.tar.gz nextpnr-81a154ca5defa4af0da827d12467d68581817364.tar.bz2 nextpnr-81a154ca5defa4af0da827d12467d68581817364.zip |
Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
Diffstat (limited to 'ice40/pack.cc')
-rw-r--r-- | ice40/pack.cc | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc index 853ef8ca..f3b62c52 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -114,6 +114,23 @@ static void pack_nonlut_ffs(Design *design) } } +// "Pack" RAMs +static void pack_ram(Design *design) +{ + for (auto cell : design->cells) { + CellInfo *ci = cell.second; + if (is_ram(ci)) { + ci->params["NEG_CLK_W"] = + std::to_string(ci->type == "SB_RAM40_4KNW" || + ci->type == "SB_RAM40_4KNRNW"); + ci->params["NEG_CLK_R"] = + std::to_string(ci->type == "SB_RAM40_4KNR" || + ci->type == "SB_RAM40_4KNRNW"); + ci->type = "ICESTORM_RAM"; + } + } +} + // Merge a net into a constant net static void set_net_constant(NetInfo *orig, NetInfo *constnet, bool constval) { @@ -230,6 +247,17 @@ static void pack_io(Design *design) } } +static bool is_clock_port(const PortRef &port) +{ + if (port.cell == nullptr) + return false; + if (is_ff(port.cell)) + return port.port == "C"; + if (is_ram(port.cell)) + return port.port == "RCLK" || port.port == "WCLK"; + return false; +} + // Simple global promoter (clock only) static void promote_globals(Design *design) { @@ -241,8 +269,7 @@ static void promote_globals(Design *design) if (ni->driver.cell != nullptr && !is_global_net(ni)) { clock_count[net.first] = 0; for (auto user : ni->users) { - if (user.cell != nullptr && is_ff(user.cell) && - user.port == "C") + if (is_clock_port(user)) clock_count[net.first]++; } } @@ -269,7 +296,7 @@ static void promote_globals(Design *design) design->nets[glbnet->name] = glbnet; std::vector<PortRef> keep_users; for (auto user : clknet->users) { - if (user.cell != nullptr && is_ff(user.cell) && user.port == "C") { + if (is_clock_port(user)) { user.cell->ports[user.port].net = glbnet; glbnet->users.push_back(user); } else { @@ -289,6 +316,7 @@ void pack_design(Design *design) pack_io(design); pack_lut_lutffs(design); pack_nonlut_ffs(design); + pack_ram(design); } NEXTPNR_NAMESPACE_END |