aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-02-23 13:14:47 +0100
committerClifford Wolf <clifford@clifford.at>2018-02-23 13:14:47 +0100
commiteb67a7532bf1d8195216257a2d6d301c03980591 (patch)
treef9246e5ace86c1cc365b4f5111061d99fbcc9aeb /kernel
parent2521ed305e9d48929c9ede93b8cb0069739408f5 (diff)
downloadyosys-eb67a7532bf1d8195216257a2d6d301c03980591.tar.gz
yosys-eb67a7532bf1d8195216257a2d6d301c03980591.tar.bz2
yosys-eb67a7532bf1d8195216257a2d6d301c03980591.zip
Add $allconst and $allseq cell types
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/celltypes.h2
-rw-r--r--kernel/rtlil.cc22
-rw-r--r--kernel/rtlil.h2
3 files changed, 25 insertions, 1 deletions
diff --git a/kernel/celltypes.h b/kernel/celltypes.h
index 5218b5363..fcc4fcc4b 100644
--- a/kernel/celltypes.h
+++ b/kernel/celltypes.h
@@ -122,6 +122,8 @@ struct CellTypes
setup_type("$initstate", pool<RTLIL::IdString>(), {Y}, true);
setup_type("$anyconst", pool<RTLIL::IdString>(), {Y}, true);
setup_type("$anyseq", pool<RTLIL::IdString>(), {Y}, true);
+ setup_type("$allconst", pool<RTLIL::IdString>(), {Y}, true);
+ setup_type("$allseq", pool<RTLIL::IdString>(), {Y}, true);
setup_type("$equiv", {A, B}, {Y}, true);
}
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index fb3d9dbe9..a4fa2cf04 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -1101,7 +1101,7 @@ namespace {
return;
}
- if (cell->type.in("$anyconst", "$anyseq")) {
+ if (cell->type.in("$anyconst", "$anyseq", "$allconst", "$allseq")) {
port("\\Y", param("\\WIDTH"));
check_expected();
return;
@@ -2145,6 +2145,26 @@ RTLIL::SigSpec RTLIL::Module::Anyseq(RTLIL::IdString name, int width, const std:
return sig;
}
+RTLIL::SigSpec RTLIL::Module::Allconst(RTLIL::IdString name, int width, const std::string &src)
+{
+ RTLIL::SigSpec sig = addWire(NEW_ID, width);
+ Cell *cell = addCell(name, "$allconst");
+ cell->setParam("\\WIDTH", width);
+ cell->setPort("\\Y", sig);
+ cell->set_src_attribute(src);
+ return sig;
+}
+
+RTLIL::SigSpec RTLIL::Module::Allseq(RTLIL::IdString name, int width, const std::string &src)
+{
+ RTLIL::SigSpec sig = addWire(NEW_ID, width);
+ Cell *cell = addCell(name, "$allseq");
+ cell->setParam("\\WIDTH", width);
+ cell->setPort("\\Y", sig);
+ cell->set_src_attribute(src);
+ return sig;
+}
+
RTLIL::SigSpec RTLIL::Module::Initstate(RTLIL::IdString name, const std::string &src)
{
RTLIL::SigSpec sig = addWire(NEW_ID);
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index a251b4252..54d0b8c22 100644
--- a/kernel/rtlil.h
+++ b/kernel/rtlil.h
@@ -1127,6 +1127,8 @@ public:
RTLIL::SigSpec Anyconst (RTLIL::IdString name, int width = 1, const std::string &src = "");
RTLIL::SigSpec Anyseq (RTLIL::IdString name, int width = 1, const std::string &src = "");
+ RTLIL::SigSpec Allconst (RTLIL::IdString name, int width = 1, const std::string &src = "");
+ RTLIL::SigSpec Allseq (RTLIL::IdString name, int width = 1, const std::string &src = "");
RTLIL::SigSpec Initstate (RTLIL::IdString name, const std::string &src = "");
};