aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/cells.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ice40/cells.cc')
-rw-r--r--ice40/cells.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/ice40/cells.cc b/ice40/cells.cc
index 61b24ce3..b11a2a77 100644
--- a/ice40/cells.cc
+++ b/ice40/cells.cc
@@ -2,6 +2,7 @@
* nextpnr -- Next Generation Place and Route
*
* Copyright (C) 2018 Clifford Wolf <clifford@clifford.at>
+ * Copyright (C) 2018 David Shah <david@symbioticeda.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -190,6 +191,41 @@ void nxio_to_sb(CellInfo *nxio, CellInfo *sbio)
}
}
+bool is_clock_port(const PortRef &port)
+{
+ if (port.cell == nullptr)
+ return false;
+ if (is_ff(port.cell))
+ return port.port == "C";
+ if (port.cell->type == "ICESTORM_LC")
+ return port.port == "CLK";
+ if (is_ram(port.cell) || port.cell->type == "ICESTORM_RAM")
+ return port.port == "RCLK" || port.port == "WCLK";
+ return false;
+}
+
+bool is_reset_port(const PortRef &port)
+{
+ if (port.cell == nullptr)
+ return false;
+ if (is_ff(port.cell))
+ return port.port == "R" || port.port == "S";
+ if (port.cell->type == "ICESTORM_LC")
+ return port.port == "SR";
+ return false;
+}
+
+bool is_enable_port(const PortRef &port)
+{
+ if (port.cell == nullptr)
+ return false;
+ if (is_ff(port.cell))
+ return port.port == "E";
+ if (port.cell->type == "ICESTORM_LC")
+ return port.port == "CEN";
+ return false;
+}
+
bool is_global_net(const NetInfo *net)
{
return bool(net_driven_by(net, is_gbuf, "GLOBAL_BUFFER_OUTPUT"));