aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/command.cc2
-rw-r--r--common/design_utils.cc4
-rw-r--r--common/nextpnr.h15
3 files changed, 16 insertions, 5 deletions
diff --git a/common/command.cc b/common/command.cc
index 23572e02..d3e8af8d 100644
--- a/common/command.cc
+++ b/common/command.cc
@@ -331,7 +331,7 @@ int CommandHandler::executeMain(std::unique_ptr<Context> ctx)
execute_python_file(filename.c_str());
} else
#endif
- if (vm.count("json")) {
+ if (ctx->design_loaded) {
bool do_pack = vm.count("pack-only") != 0 || vm.count("no-pack") == 0;
bool do_place = vm.count("pack-only") == 0 && vm.count("no-place") == 0;
bool do_route = vm.count("pack-only") == 0 && vm.count("no-route") == 0;
diff --git a/common/design_utils.cc b/common/design_utils.cc
index 16cc2710..b81449b7 100644
--- a/common/design_utils.cc
+++ b/common/design_utils.cc
@@ -71,7 +71,9 @@ void print_utilisation(const Context *ctx)
}
std::map<IdString, int> available_types;
for (auto bel : ctx->getBels()) {
- available_types[ctx->getBelType(bel)]++;
+ if (!ctx->getBelHidden(bel)) {
+ available_types[ctx->getBelType(bel)]++;
+ }
}
log_break();
log_info("Device utilisation:\n");
diff --git a/common/nextpnr.h b/common/nextpnr.h
index cb4dbc28..b6ee33fe 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -833,6 +833,7 @@ struct BaseCtx
// Top-level ports
std::unordered_map<IdString, PortInfo> ports;
+ std::unordered_map<IdString, CellInfo *> port_cells;
// Floorplanning regions
std::unordered_map<IdString, std::unique_ptr<Region>> region;
@@ -842,6 +843,9 @@ struct BaseCtx
Context *as_ctx = nullptr;
+ // Has the frontend loaded a design?
+ bool design_loaded;
+
BaseCtx()
{
idstring_str_to_idx = new std::unordered_map<std::string, int>;
@@ -853,6 +857,8 @@ struct BaseCtx
wildcard.id.index = 0;
wildcard.type = TimingConstraintObject::ANYTHING;
constraintObjects.push_back(wildcard);
+
+ design_loaded = false;
}
virtual ~BaseCtx()
@@ -1089,6 +1095,7 @@ template <typename R> struct ArchAPI : BaseCtx
virtual CellInfo *getBoundBelCell(BelId bel) const = 0;
virtual CellInfo *getConflictingBelCell(BelId bel) const = 0;
virtual IdString getBelType(BelId bel) const = 0;
+ virtual bool getBelHidden(BelId bel) const = 0;
virtual typename R::BelAttrsRangeT getBelAttrs(BelId bel) const = 0;
virtual WireId getBelPinWire(BelId bel, IdString pin) const = 0;
virtual PortType getBelPinType(BelId bel, IdString pin) const = 0;
@@ -1204,7 +1211,7 @@ template <typename R> struct BaseArch : ArchAPI<R>
// Basic config
virtual IdString archId() const override { return this->id(STRINGIFY(ARCHNAME)); }
- virtual IdString archArgsToId(typename R::ArchArgsT args) const { return IdString(); }
+ virtual IdString archArgsToId(typename R::ArchArgsT args) const override { return IdString(); }
virtual int getTilePipDimZ(int x, int y) const override { return 1; }
virtual char getNameDelimiter() const override { return ' '; }
@@ -1231,6 +1238,8 @@ template <typename R> struct BaseArch : ArchAPI<R>
this->refreshUiBel(bel);
}
+ virtual bool getBelHidden(BelId bel) const override { return false; }
+
virtual bool getBelGlobalBuf(BelId bel) const override { return false; }
virtual bool checkBelAvail(BelId bel) const override { return getBoundBelCell(bel) == nullptr; };
virtual CellInfo *getBoundBelCell(BelId bel) const override
@@ -1298,7 +1307,7 @@ template <typename R> struct BaseArch : ArchAPI<R>
virtual NetInfo *getConflictingWireNet(WireId wire) const override { return getBoundWireNet(wire); }
// Pip methods
- virtual IdString getPipType(PipId pip) const { return IdString(); }
+ virtual IdString getPipType(PipId pip) const override { return IdString(); }
virtual typename R::PipAttrsRangeT getPipAttrs(PipId) const override
{
return empty_if_possible<typename R::PipAttrsRangeT>();
@@ -1375,7 +1384,7 @@ template <typename R> struct BaseArch : ArchAPI<R>
// Decal methods
virtual typename R::DecalGfxRangeT getDecalGraphics(DecalId decal) const override
{
- NPNR_ASSERT_FALSE("unreachable");
+ return empty_if_possible<typename R::DecalGfxRangeT>();
};
virtual DecalXY getBelDecal(BelId bel) const override { return DecalXY(); }
virtual DecalXY getWireDecal(WireId wire) const override { return DecalXY(); }