aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/site_arch.impl.h
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/site_arch.impl.h
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/site_arch.impl.h')
-rw-r--r--fpga_interchange/site_arch.impl.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/fpga_interchange/site_arch.impl.h b/fpga_interchange/site_arch.impl.h
index 0be298c9..a471b690 100644
--- a/fpga_interchange/site_arch.impl.h
+++ b/fpga_interchange/site_arch.impl.h
@@ -295,6 +295,25 @@ inline bool SiteArch::canInvert(const SitePip &site_pip) const
return bel_data.non_inverting_pin == pip_data.extra_data && bel_data.inverting_pin == pip_data.extra_data;
}
+inline PhysicalNetlist::PhysNetlist::NetType SiteArch::prefered_constant_net_type(const SitePip &site_pip) const
+{
+ // FIXME: Implement site port overrides from chipdb once available.
+ IdString prefered_constant_net(ctx->chip_info->constants->best_constant_net);
+ IdString gnd_net_name(ctx->chip_info->constants->gnd_net_name);
+ IdString vcc_net_name(ctx->chip_info->constants->vcc_net_name);
+
+ if (prefered_constant_net == IdString()) {
+ return PhysicalNetlist::PhysNetlist::NetType::SIGNAL;
+ } else if (prefered_constant_net == gnd_net_name) {
+ return PhysicalNetlist::PhysNetlist::NetType::GND;
+ } else if (prefered_constant_net == vcc_net_name) {
+ return PhysicalNetlist::PhysNetlist::NetType::VCC;
+ } else {
+ log_error("prefered_constant_net %s is not the GND (%s) or VCC(%s) net?\n", prefered_constant_net.c_str(ctx),
+ gnd_net_name.c_str(ctx), vcc_net_name.c_str(ctx));
+ }
+}
+
NEXTPNR_NAMESPACE_END
#endif /* SITE_ARCH_H */