aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/fpga_interchange.cpp
diff options
context:
space:
mode:
authorKeith Rothman <537074+litghost@users.noreply.github.com>2021-03-23 16:53:42 -0700
committerKeith Rothman <537074+litghost@users.noreply.github.com>2021-03-25 17:20:09 -0700
commit77bc2f9130204e40023411c3fd13b3a3a3aa8a5b (patch)
tree976e407dd05455dab6d425ed3db2cc96e7be4d87 /fpga_interchange/fpga_interchange.cpp
parent5e96740451912cbd68aecdbe58d776831d282cba (diff)
downloadnextpnr-77bc2f9130204e40023411c3fd13b3a3a3aa8a5b.tar.gz
nextpnr-77bc2f9130204e40023411c3fd13b3a3a3aa8a5b.tar.bz2
nextpnr-77bc2f9130204e40023411c3fd13b3a3a3aa8a5b.zip
Add initial handling of local site inverters and constant signals.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
Diffstat (limited to 'fpga_interchange/fpga_interchange.cpp')
-rw-r--r--fpga_interchange/fpga_interchange.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/fpga_interchange/fpga_interchange.cpp b/fpga_interchange/fpga_interchange.cpp
index 1be1dfde..52d49fa2 100644
--- a/fpga_interchange/fpga_interchange.cpp
+++ b/fpga_interchange/fpga_interchange.cpp
@@ -220,11 +220,25 @@ static void init_bel_pin(
std::string site_name = site_and_type.substr(0, pos);
- auto out_bel_pin = branch.getRouteSegment().initBelPin();
-
- out_bel_pin.setSite(strings->get_index(site_name));
- out_bel_pin.setBel(strings->get_index(bel_name[1].str(ctx)));
- out_bel_pin.setPin(strings->get_index(pin_name.str(ctx)));
+ const BelInfoPOD & bel_data = bel_info(ctx->chip_info, bel);
+ if(bel_data.category == BEL_CATEGORY_LOGIC) {
+ // This is a boring old logic BEL.
+ auto out_bel_pin = branch.getRouteSegment().initBelPin();
+
+ out_bel_pin.setSite(strings->get_index(site_name));
+ out_bel_pin.setBel(strings->get_index(bel_name[1].str(ctx)));
+ out_bel_pin.setPin(strings->get_index(pin_name.str(ctx)));
+ } else {
+ // This is a local site inverter. This is represented with a
+ // $nextpnr_inv, and this BEL pin is the input to that inverter.
+ NPNR_ASSERT(bel_data.category == BEL_CATEGORY_ROUTING);
+ auto out_pip = branch.getRouteSegment().initSitePIP();
+
+ out_pip.setSite(strings->get_index(site_name));
+ out_pip.setBel(strings->get_index(bel_name[1].str(ctx)));
+ out_pip.setPin(strings->get_index(pin_name.str(ctx)));
+ out_pip.setIsInverting(true);
+ }
}
@@ -383,10 +397,16 @@ void FpgaInterchange::write_physical_netlist(const Context * ctx, const std::str
StringEnumerator strings;
+ IdString nextpnr_inv = ctx->id("$nextpnr_inv");
+
size_t number_placements = 0;
for(auto & cell_name : placed_cells) {
const CellInfo & cell = *ctx->cells.at(cell_name);
+ if(cell.type == nextpnr_inv) {
+ continue;
+ }
+
if(cell.bel == BelId()) {
continue;
}
@@ -412,6 +432,10 @@ void FpgaInterchange::write_physical_netlist(const Context * ctx, const std::str
for(auto & cell_name : placed_cells) {
const CellInfo & cell = *ctx->cells.at(cell_name);
+ if(cell.type == nextpnr_inv) {
+ continue;
+ }
+
if(cell.bel == BelId()) {
continue;
}
@@ -513,8 +537,6 @@ void FpgaInterchange::write_physical_netlist(const Context * ctx, const std::str
net_out.setName(strings.get_index(net.name.str(ctx)));
}
- // FIXME: Also vcc/gnd nets needs to get special handling through
- // inverters.
std::unordered_map<WireId, BelPin> root_wires;
std::unordered_map<WireId, std::vector<PipId>> pip_downhill;
std::unordered_set<PipId> pips;