aboutsummaryrefslogtreecommitdiffstats
path: root/nexus/pack.cc
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-01-20 15:57:06 +0000
committerDavid Shah <dave@ds0.me>2020-11-30 08:45:27 +0000
commit84d542624213ab8639bac31ade79ce27097f4e06 (patch)
tree5c875473a6b57743ff0f3ac587f8511511e3bc13 /nexus/pack.cc
parent887d7c717b957a16e068d082a04d5da58d3eda84 (diff)
downloadnextpnr-84d542624213ab8639bac31ade79ce27097f4e06.tar.gz
nextpnr-84d542624213ab8639bac31ade79ce27097f4e06.tar.bz2
nextpnr-84d542624213ab8639bac31ade79ce27097f4e06.zip
nexus: Working on validity checking
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'nexus/pack.cc')
-rw-r--r--nexus/pack.cc48
1 files changed, 48 insertions, 0 deletions
diff --git a/nexus/pack.cc b/nexus/pack.cc
index c1e3664f..2b88a095 100644
--- a/nexus/pack.cc
+++ b/nexus/pack.cc
@@ -25,6 +25,10 @@
NEXTPNR_NAMESPACE_BEGIN
+namespace {
+bool is_enabled(CellInfo *ci, IdString prop) { return str_or_default(ci->params, prop, "") == "ENABLED"; }
+} // namespace
+
struct NexusPacker
{
Context *ctx;
@@ -182,4 +186,48 @@ bool Arch::pack()
return true;
}
+// -----------------------------------------------------------------------
+
+void Arch::assignArchInfo()
+{
+ for (auto cell : sorted(cells)) {
+ assignCellInfo(cell.second);
+ }
+}
+
+void Arch::assignCellInfo(CellInfo *cell)
+{
+ if (cell->type == id_OXIDE_COMB) {
+ cell->lutInfo.is_memory = str_or_default(cell->params, id_MODE, "LOGIC") == "DPRAM";
+ cell->lutInfo.is_carry = str_or_default(cell->params, id_MODE, "LOGIC") == "CCU2";
+ cell->lutInfo.mux2_used = port_used(cell, id_OFX);
+ cell->lutInfo.f = get_net_or_empty(cell, id_F);
+ cell->lutInfo.ofx = get_net_or_empty(cell, id_OFX);
+ } else if (cell->type == id_OXIDE_FF) {
+ cell->ffInfo.ctrlset.async = str_or_default(cell->params, id_SRMODE, "LSR_OVER_CE") == "ASYNC";
+ cell->ffInfo.ctrlset.regddr_en = is_enabled(cell, id_REGDDR);
+ cell->ffInfo.ctrlset.gsr_en = is_enabled(cell, id_GSR);
+ cell->ffInfo.ctrlset.clkmux = id(str_or_default(cell->params, id_CLKMUX, "CLK")).index;
+ cell->ffInfo.ctrlset.cemux = id(str_or_default(cell->params, id_CEMUX, "CE")).index;
+ cell->ffInfo.ctrlset.lsrmux = id(str_or_default(cell->params, id_LSRMUX, "LSR")).index;
+ cell->ffInfo.ctrlset.clk = get_net_or_empty(cell, id_CLK);
+ cell->ffInfo.ctrlset.ce = get_net_or_empty(cell, id_CE);
+ cell->ffInfo.ctrlset.lsr = get_net_or_empty(cell, id_LSR);
+ cell->ffInfo.di = get_net_or_empty(cell, id_DI);
+ cell->ffInfo.m = get_net_or_empty(cell, id_M);
+ } else if (cell->type == ID_RAMW) {
+ cell->ffInfo.ctrlset.async = false;
+ cell->ffInfo.ctrlset.regddr_en = false;
+ cell->ffInfo.ctrlset.gsr_en = false;
+ cell->ffInfo.ctrlset.clkmux = id(str_or_default(cell->params, id_CLKMUX, "CLK")).index;
+ cell->ffInfo.ctrlset.cemux = ID_CE;
+ cell->ffInfo.ctrlset.lsrmux = id(str_or_default(cell->params, id_LSRMUX, "LSR")).index;
+ cell->ffInfo.ctrlset.clk = get_net_or_empty(cell, id_CLK);
+ cell->ffInfo.ctrlset.ce = nullptr;
+ cell->ffInfo.ctrlset.lsr = get_net_or_empty(cell, id_LSR);
+ cell->ffInfo.di = nullptr;
+ cell->ffInfo.m = nullptr;
+ }
+}
+
NEXTPNR_NAMESPACE_END \ No newline at end of file