diff options
author | David Shah <davey1576@gmail.com> | 2018-06-22 19:21:39 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-22 19:21:39 +0200 |
commit | 8850f86a8ab23de1274f05b1729c106f875f693a (patch) | |
tree | 3834d0f2e6cb74d8a7558449de0b8a1f3cf4dabf /ice40/pack.cc | |
parent | 6a783ef94f31eb47cbf6c14b0e8793638d90dc88 (diff) | |
download | nextpnr-8850f86a8ab23de1274f05b1729c106f875f693a.tar.gz nextpnr-8850f86a8ab23de1274f05b1729c106f875f693a.tar.bz2 nextpnr-8850f86a8ab23de1274f05b1729c106f875f693a.zip |
ice40: SB_LFOSC support, fabric routing only
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40/pack.cc')
-rw-r--r-- | ice40/pack.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc index e9f02ddf..5022fc59 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -485,6 +485,39 @@ static void promote_globals(Context *ctx) } } +// Pack internal oscillators +static void pack_intosc(Context *ctx) +{ + log_info("Packing oscillators..\n"); + + std::unordered_set<IdString> packed_cells; + std::vector<CellInfo *> new_cells; + + for (auto cell : sorted(ctx->cells)) { + CellInfo *ci = cell.second; + if (is_sb_lfosc(ctx, ci)) { + CellInfo *packed = create_ice_cell(ctx, "ICESTORM_LFOSC", + ci->name.str(ctx) + "_OSC"); + packed_cells.insert(ci->name); + new_cells.push_back(packed); + replace_port(ci, "CLKLFEN", packed, "CLKLFEN"); + replace_port(ci, "CLKLFPU", packed, "CLKLFPU"); + if (bool_or_default(ci->attrs, "ROUTE_THROUGH_FABRIC")) { + replace_port(ci, "CLKLF", packed, "CLKLF_FABRIC"); + } else { + replace_port(ci, "CLKLF", packed, "CLKLF"); + } + } + } + + for (auto pcell : packed_cells) { + ctx->cells.erase(pcell); + } + for (auto ncell : new_cells) { + ctx->cells[ncell->name] = ncell; + } +} + // Main pack function bool pack_design(Context *ctx) { @@ -496,6 +529,7 @@ bool pack_design(Context *ctx) pack_lut_lutffs(ctx); pack_nonlut_ffs(ctx); pack_ram(ctx); + pack_intosc(ctx); log_info("Checksum: 0x%08x\n", ctx->checksum()); return true; } catch (log_execution_error_exception) { |