summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/consteval.h8
-rw-r--r--kernel/rtlil.cc13
-rw-r--r--kernel/rtlil.h1
3 files changed, 14 insertions, 8 deletions
diff --git a/kernel/consteval.h b/kernel/consteval.h
index 4050d2dc..3a5c5347 100644
--- a/kernel/consteval.h
+++ b/kernel/consteval.h
@@ -87,21 +87,21 @@ struct ConstEval
{
RTLIL::SigSpec sig_a, sig_b, sig_s, sig_y;
- assert(cell->connections().count("\\Y") > 0);
+ assert(cell->has("\\Y"));
sig_y = values_map(assign_map(cell->get("\\Y")));
if (sig_y.is_fully_const())
return true;
- if (cell->connections().count("\\S") > 0) {
+ if (cell->has("\\S")) {
sig_s = cell->get("\\S");
if (!eval(sig_s, undef, cell))
return false;
}
- if (cell->connections().count("\\A") > 0)
+ if (cell->has("\\A"))
sig_a = cell->get("\\A");
- if (cell->connections().count("\\B") > 0)
+ if (cell->has("\\B"))
sig_b = cell->get("\\B");
if (cell->type == "$mux" || cell->type == "$pmux" || cell->type == "$safe_pmux" || cell->type == "$_MUX_")
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index ceb2b0f5..059357d2 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -348,9 +348,9 @@ namespace {
void port(const char *name, int width)
{
- if (cell->connections().count(name) == 0)
+ if (!cell->has(name))
error(__LINE__);
- if (cell->connections().at(name).size() != width)
+ if (cell->get(name).size() != width)
error(__LINE__);
expected_ports.insert(name);
}
@@ -379,9 +379,9 @@ namespace {
for (const char *p = ports; *p; p++) {
char portname[3] = { '\\', *p, 0 };
- if (cell->connections().count(portname) == 0)
+ if (!cell->has(portname))
error(__LINE__);
- if (cell->connections().at(portname).size() != 1)
+ if (cell->get(portname).size() != 1)
error(__LINE__);
}
@@ -1340,6 +1340,11 @@ RTLIL::Memory::Memory()
size = 0;
}
+bool RTLIL::Cell::has(RTLIL::IdString portname)
+{
+ return connections_.count(portname) != 0;
+}
+
void RTLIL::Cell::unset(RTLIL::IdString portname)
{
connections_.erase(portname);
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index 25d0a830..73d3727c 100644
--- a/kernel/rtlil.h
+++ b/kernel/rtlil.h
@@ -488,6 +488,7 @@ public:
RTLIL_ATTRIBUTE_MEMBERS
// access cell ports
+ bool has(RTLIL::IdString portname);
void unset(RTLIL::IdString portname);
void set(RTLIL::IdString portname, RTLIL::SigSpec signal);
const RTLIL::SigSpec &get(RTLIL::IdString portname) const;