diff options
author | David Shah <davey1576@gmail.com> | 2018-06-12 13:09:36 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-12 13:09:36 +0200 |
commit | 67a5cedbe30f681fd3c5c52ed8552abcc7583a45 (patch) | |
tree | 8086efb00377d4bce6561220a89e71be27588897 /ice40/pack.cc | |
parent | f72807f790e8d3f3f2a630f461bfe086e8d0e108 (diff) | |
download | nextpnr-67a5cedbe30f681fd3c5c52ed8552abcc7583a45.tar.gz nextpnr-67a5cedbe30f681fd3c5c52ed8552abcc7583a45.tar.bz2 nextpnr-67a5cedbe30f681fd3c5c52ed8552abcc7583a45.zip |
ice40: Pack constants to LCs
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40/pack.cc')
-rw-r--r-- | ice40/pack.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc index 47e55b68..eb783f2f 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -89,9 +89,34 @@ static void pack_nonlut_ffs(Design *design) } } +// Pack constants (simple implementation) +static void pack_constants(Design *design) { + CellInfo *gnd_cell = create_ice_cell(design, "ICESTORM_LC", + "$PACKER_GND"); + gnd_cell->attrs["LUT_INIT"] = "0"; + + CellInfo *vcc_cell = create_ice_cell(design, "ICESTORM_LC", + "$PACKER_VCC"); + vcc_cell->attrs["LUT_INIT"] = "1"; + + for (auto net : design->nets) { + NetInfo *ni = net.second; + if (ni->driver.cell != nullptr && ni->driver.cell->type == "GND") { + ni->driver.cell = gnd_cell; + ni->driver.port = "O"; + design->cells[gnd_cell->name] = gnd_cell; + } else if (ni->driver.cell != nullptr && ni->driver.cell->type == "VCC") { + ni->driver.cell = vcc_cell; + ni->driver.port = "O"; + design->cells[vcc_cell->name] = vcc_cell; + } + } +} + // Main pack function void pack_design(Design *design) { + pack_constants(design); pack_lut_lutffs(design); pack_nonlut_ffs(design); } |