summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/consteval.h18
-rw-r--r--kernel/modwalker.h4
-rw-r--r--kernel/rtlil.cc160
-rw-r--r--kernel/satgen.h170
-rw-r--r--kernel/sigtools.h2
5 files changed, 177 insertions, 177 deletions
diff --git a/kernel/consteval.h b/kernel/consteval.h
index 5469fa80..4050d2dc 100644
--- a/kernel/consteval.h
+++ b/kernel/consteval.h
@@ -43,7 +43,7 @@ struct ConstEval
for (auto &it : module->cells) {
if (!ct.cell_known(it.second->type))
continue;
- for (auto &it2 : it.second->connections_)
+ for (auto &it2 : it.second->connections())
if (ct.cell_output(it.second->type, it2.first))
sig2driver.insert(assign_map(it2.second), it.second);
}
@@ -87,22 +87,22 @@ struct ConstEval
{
RTLIL::SigSpec sig_a, sig_b, sig_s, sig_y;
- assert(cell->connections_.count("\\Y") > 0);
- sig_y = values_map(assign_map(cell->connections_["\\Y"]));
+ assert(cell->connections().count("\\Y") > 0);
+ sig_y = values_map(assign_map(cell->get("\\Y")));
if (sig_y.is_fully_const())
return true;
- if (cell->connections_.count("\\S") > 0) {
- sig_s = cell->connections_["\\S"];
+ if (cell->connections().count("\\S") > 0) {
+ sig_s = cell->get("\\S");
if (!eval(sig_s, undef, cell))
return false;
}
- if (cell->connections_.count("\\A") > 0)
- sig_a = cell->connections_["\\A"];
+ if (cell->connections().count("\\A") > 0)
+ sig_a = cell->get("\\A");
- if (cell->connections_.count("\\B") > 0)
- sig_b = cell->connections_["\\B"];
+ if (cell->connections().count("\\B") > 0)
+ sig_b = cell->get("\\B");
if (cell->type == "$mux" || cell->type == "$pmux" || cell->type == "$safe_pmux" || cell->type == "$_MUX_")
{
diff --git a/kernel/modwalker.h b/kernel/modwalker.h
index efd97379..a3983a2c 100644
--- a/kernel/modwalker.h
+++ b/kernel/modwalker.h
@@ -88,12 +88,12 @@ struct ModWalker
void add_cell(RTLIL::Cell *cell)
{
if (ct.cell_known(cell->type)) {
- for (auto &conn : cell->connections_)
+ for (auto &conn : cell->connections())
add_cell_port(cell, conn.first, sigmap(conn.second),
ct.cell_output(cell->type, conn.first),
ct.cell_input(cell->type, conn.first));
} else {
- for (auto &conn : cell->connections_)
+ for (auto &conn : cell->connections())
add_cell_port(cell, conn.first, sigmap(conn.second), true, true);
}
}
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index 73f5d71f..ceb2b0f5 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->connections().count(name) == 0)
error(__LINE__);
- if (cell->connections_.at(name).size() != width)
+ if (cell->connections().at(name).size() != width)
error(__LINE__);
expected_ports.insert(name);
}
@@ -360,7 +360,7 @@ namespace {
for (auto &para : cell->parameters)
if (expected_params.count(para.first) == 0)
error(__LINE__);
- for (auto &conn : cell->connections_)
+ for (auto &conn : cell->connections())
if (expected_ports.count(conn.first) == 0)
error(__LINE__);
@@ -379,13 +379,13 @@ namespace {
for (const char *p = ports; *p; p++) {
char portname[3] = { '\\', *p, 0 };
- if (cell->connections_.count(portname) == 0)
+ if (cell->connections().count(portname) == 0)
error(__LINE__);
- if (cell->connections_.at(portname).size() != 1)
+ if (cell->connections().at(portname).size() != 1)
error(__LINE__);
}
- for (auto &conn : cell->connections_) {
+ for (auto &conn : cell->connections()) {
if (conn.first.size() != 2 || conn.first.at(0) != '\\')
error(__LINE__);
if (strchr(ports, conn.first.at(1)) == NULL)
@@ -734,7 +734,7 @@ void RTLIL::Module::check()
assert(it.first == it.second->name);
assert(it.first.size() > 0 && (it.first[0] == '\\' || it.first[0] == '$'));
assert(it.second->type.size() > 0 && (it.second->type[0] == '\\' || it.second->type[0] == '$'));
- for (auto &it2 : it.second->connections_) {
+ for (auto &it2 : it.second->connections()) {
assert(it2.first.size() > 0 && (it2.first[0] == '\\' || it2.first[0] == '$'));
it2.second.check();
}
@@ -938,8 +938,8 @@ RTLIL::Cell *RTLIL::Module::addCell(RTLIL::IdString name, const RTLIL::Cell *oth
cell->parameters["\\A_SIGNED"] = is_signed; \
cell->parameters["\\A_WIDTH"] = sig_a.size(); \
cell->parameters["\\Y_WIDTH"] = sig_y.size(); \
- cell->connections_["\\A"] = sig_a; \
- cell->connections_["\\Y"] = sig_y; \
+ cell->set("\\A", sig_a); \
+ cell->set("\\Y", sig_y); \
add(cell); \
return cell; \
} \
@@ -970,9 +970,9 @@ DEF_METHOD(LogicNot, 1, "$logic_not")
cell->parameters["\\A_WIDTH"] = sig_a.size(); \
cell->parameters["\\B_WIDTH"] = sig_b.size(); \
cell->parameters["\\Y_WIDTH"] = sig_y.size(); \
- cell->connections_["\\A"] = sig_a; \
- cell->connections_["\\B"] = sig_b; \
- cell->connections_["\\Y"] = sig_y; \
+ cell->set("\\A", sig_a); \
+ cell->set("\\B", sig_b); \
+ cell->set("\\Y", sig_y); \
add(cell); \
return cell; \
} \
@@ -1014,10 +1014,10 @@ DEF_METHOD(LogicOr, 1, "$logic_or")
cell->parameters["\\WIDTH"] = sig_a.size(); \
cell->parameters["\\WIDTH"] = sig_b.size(); \
if (_pmux) cell->parameters["\\S_WIDTH"] = sig_s.size(); \
- cell->connections_["\\A"] = sig_a; \
- cell->connections_["\\B"] = sig_b; \
- cell->connections_["\\S"] = sig_s; \
- cell->connections_["\\Y"] = sig_y; \
+ cell->set("\\A", sig_a); \
+ cell->set("\\B", sig_b); \
+ cell->set("\\S", sig_s); \
+ cell->set("\\Y", sig_y); \
add(cell); \
return cell; \
} \
@@ -1036,8 +1036,8 @@ DEF_METHOD(SafePmux, "$safe_pmux", 1)
RTLIL::Cell *cell = new RTLIL::Cell; \
cell->name = name; \
cell->type = _type; \
- cell->connections_["\\" #_P1] = sig1; \
- cell->connections_["\\" #_P2] = sig2; \
+ cell->set("\\" #_P1, sig1); \
+ cell->set("\\" #_P2, sig2); \
add(cell); \
return cell; \
} \
@@ -1051,9 +1051,9 @@ DEF_METHOD(SafePmux, "$safe_pmux", 1)
RTLIL::Cell *cell = new RTLIL::Cell; \
cell->name = name; \
cell->type = _type; \
- cell->connections_["\\" #_P1] = sig1; \
- cell->connections_["\\" #_P2] = sig2; \
- cell->connections_["\\" #_P3] = sig3; \
+ cell->set("\\" #_P1, sig1); \
+ cell->set("\\" #_P2, sig2); \
+ cell->set("\\" #_P3, sig3); \
add(cell); \
return cell; \
} \
@@ -1067,10 +1067,10 @@ DEF_METHOD(SafePmux, "$safe_pmux", 1)
RTLIL::Cell *cell = new RTLIL::Cell; \
cell->name = name; \
cell->type = _type; \
- cell->connections_["\\" #_P1] = sig1; \
- cell->connections_["\\" #_P2] = sig2; \
- cell->connections_["\\" #_P3] = sig3; \
- cell->connections_["\\" #_P4] = sig4; \
+ cell->set("\\" #_P1, sig1); \
+ cell->set("\\" #_P2, sig2); \
+ cell->set("\\" #_P3, sig3); \
+ cell->set("\\" #_P4, sig4); \
add(cell); \
return cell; \
} \
@@ -1098,9 +1098,9 @@ RTLIL::Cell* RTLIL::Module::addPow(RTLIL::IdString name, RTLIL::SigSpec sig_a, R
cell->parameters["\\A_WIDTH"] = sig_a.size();
cell->parameters["\\B_WIDTH"] = sig_b.size();
cell->parameters["\\Y_WIDTH"] = sig_y.size();
- cell->connections_["\\A"] = sig_a;
- cell->connections_["\\B"] = sig_b;
- cell->connections_["\\Y"] = sig_y;
+ cell->set("\\A", sig_a);
+ cell->set("\\B", sig_b);
+ cell->set("\\Y", sig_y);
add(cell);
return cell;
}
@@ -1113,8 +1113,8 @@ RTLIL::Cell* RTLIL::Module::addSlice(RTLIL::IdString name, RTLIL::SigSpec sig_a,
cell->parameters["\\A_WIDTH"] = sig_a.size();
cell->parameters["\\Y_WIDTH"] = sig_y.size();
cell->parameters["\\OFFSET"] = offset;
- cell->connections_["\\A"] = sig_a;
- cell->connections_["\\Y"] = sig_y;
+ cell->set("\\A", sig_a);
+ cell->set("\\Y", sig_y);
add(cell);
return cell;
}
@@ -1126,9 +1126,9 @@ RTLIL::Cell* RTLIL::Module::addConcat(RTLIL::IdString name, RTLIL::SigSpec sig_a
cell->type = "$concat";
cell->parameters["\\A_WIDTH"] = sig_a.size();
cell->parameters["\\B_WIDTH"] = sig_b.size();
- cell->connections_["\\A"] = sig_a;
- cell->connections_["\\B"] = sig_b;
- cell->connections_["\\Y"] = sig_y;
+ cell->set("\\A", sig_a);
+ cell->set("\\B", sig_b);
+ cell->set("\\Y", sig_y);
add(cell);
return cell;
}
@@ -1140,8 +1140,8 @@ RTLIL::Cell* RTLIL::Module::addLut(RTLIL::IdString name, RTLIL::SigSpec sig_i, R
cell->type = "$lut";
cell->parameters["\\LUT"] = lut;
cell->parameters["\\WIDTH"] = sig_i.size();
- cell->connections_["\\I"] = sig_i;
- cell->connections_["\\O"] = sig_o;
+ cell->set("\\I", sig_i);
+ cell->set("\\O", sig_o);
add(cell);
return cell;
}
@@ -1151,8 +1151,8 @@ RTLIL::Cell* RTLIL::Module::addAssert(RTLIL::IdString name, RTLIL::SigSpec sig_a
RTLIL::Cell *cell = new RTLIL::Cell;
cell->name = name;
cell->type = "$assert";
- cell->connections_["\\A"] = sig_a;
- cell->connections_["\\EN"] = sig_en;
+ cell->set("\\A", sig_a);
+ cell->set("\\EN", sig_en);
add(cell);
return cell;
}
@@ -1165,9 +1165,9 @@ RTLIL::Cell* RTLIL::Module::addSr(RTLIL::IdString name, RTLIL::SigSpec sig_set,
cell->parameters["\\SET_POLARITY"] = set_polarity;
cell->parameters["\\CLR_POLARITY"] = clr_polarity;
cell->parameters["\\WIDTH"] = sig_q.size();
- cell->connections_["\\SET"] = sig_set;
- cell->connections_["\\CLR"] = sig_clr;
- cell->connections_["\\Q"] = sig_q;
+ cell->set("\\SET", sig_set);
+ cell->set("\\CLR", sig_clr);
+ cell->set("\\Q", sig_q);
add(cell);
return cell;
}
@@ -1179,9 +1179,9 @@ RTLIL::Cell* RTLIL::Module::addDff(RTLIL::IdString name, RTLIL::SigSpec sig_clk,
cell->type = "$dff";
cell->parameters["\\CLK_POLARITY"] = clk_polarity;
cell->parameters["\\WIDTH"] = sig_q.size();
- cell->connections_["\\CLK"] = sig_clk;
- cell->connections_["\\D"] = sig_d;
- cell->connections_["\\Q"] = sig_q;
+ cell->set("\\CLK", sig_clk);
+ cell->set("\\D", sig_d);
+ cell->set("\\Q", sig_q);
add(cell);
return cell;
}
@@ -1196,11 +1196,11 @@ RTLIL::Cell* RTLIL::Module::addDffsr(RTLIL::IdString name, RTLIL::SigSpec sig_cl
cell->parameters["\\SET_POLARITY"] = set_polarity;
cell->parameters["\\CLR_POLARITY"] = clr_polarity;
cell->parameters["\\WIDTH"] = sig_q.size();
- cell->connections_["\\CLK"] = sig_clk;
- cell->connections_["\\SET"] = sig_set;
- cell->connections_["\\CLR"] = sig_clr;
- cell->connections_["\\D"] = sig_d;
- cell->connections_["\\Q"] = sig_q;
+ cell->set("\\CLK", sig_clk);
+ cell->set("\\SET", sig_set);
+ cell->set("\\CLR", sig_clr);
+ cell->set("\\D", sig_d);
+ cell->set("\\Q", sig_q);
add(cell);
return cell;
}
@@ -1215,10 +1215,10 @@ RTLIL::Cell* RTLIL::Module::addAdff(RTLIL::IdString name, RTLIL::SigSpec sig_clk
cell->parameters["\\ARST_POLARITY"] = arst_polarity;
cell->parameters["\\ARST_VALUE"] = arst_value;
cell->parameters["\\WIDTH"] = sig_q.size();
- cell->connections_["\\CLK"] = sig_clk;
- cell->connections_["\\ARST"] = sig_arst;
- cell->connections_["\\D"] = sig_d;
- cell->connections_["\\Q"] = sig_q;
+ cell->set("\\CLK", sig_clk);
+ cell->set("\\ARST", sig_arst);
+ cell->set("\\D", sig_d);
+ cell->set("\\Q", sig_q);
add(cell);
return cell;
}
@@ -1230,9 +1230,9 @@ RTLIL::Cell* RTLIL::Module::addDlatch(RTLIL::IdString name, RTLIL::SigSpec sig_e
cell->type = "$dlatch";
cell->parameters["\\EN_POLARITY"] = en_polarity;
cell->parameters["\\WIDTH"] = sig_q.size();
- cell->connections_["\\EN"] = sig_en;
- cell->connections_["\\D"] = sig_d;
- cell->connections_["\\Q"] = sig_q;
+ cell->set("\\EN", sig_en);
+ cell->set("\\D", sig_d);
+ cell->set("\\Q", sig_q);
add(cell);
return cell;
}
@@ -1247,11 +1247,11 @@ RTLIL::Cell* RTLIL::Module::addDlatchsr(RTLIL::IdString name, RTLIL::SigSpec sig
cell->parameters["\\SET_POLARITY"] = set_polarity;
cell->parameters["\\CLR_POLARITY"] = clr_polarity;
cell->parameters["\\WIDTH"] = sig_q.size();
- cell->connections_["\\EN"] = sig_en;
- cell->connections_["\\SET"] = sig_set;
- cell->connections_["\\CLR"] = sig_clr;
- cell->connections_["\\D"] = sig_d;
- cell->connections_["\\Q"] = sig_q;
+ cell->set("\\EN", sig_en);
+ cell->set("\\SET", sig_set);
+ cell->set("\\CLR", sig_clr);
+ cell->set("\\D", sig_d);
+ cell->set("\\Q", sig_q);
add(cell);
return cell;
}
@@ -1261,9 +1261,9 @@ RTLIL::Cell* RTLIL::Module::addDffGate(RTLIL::IdString name, RTLIL::SigSpec sig_
RTLIL::Cell *cell = new RTLIL::Cell;
cell->name = name;
cell->type = stringf("$_DFF_%c_", clk_polarity ? 'P' : 'N');
- cell->connections_["\\C"] = sig_clk;
- cell->connections_["\\D"] = sig_d;
- cell->connections_["\\Q"] = sig_q;
+ cell->set("\\C", sig_clk);
+ cell->set("\\D", sig_d);
+ cell->set("\\Q", sig_q);
add(cell);
return cell;
}
@@ -1274,11 +1274,11 @@ RTLIL::Cell* RTLIL::Module::addDffsrGate(RTLIL::IdString name, RTLIL::SigSpec si
RTLIL::Cell *cell = new RTLIL::Cell;
cell->name = name;
cell->type = stringf("$_DFFSR_%c%c%c_", clk_polarity ? 'P' : 'N', set_polarity ? 'P' : 'N', clr_polarity ? 'P' : 'N');
- cell->connections_["\\C"] = sig_clk;
- cell->connections_["\\S"] = sig_set;
- cell->connections_["\\R"] = sig_clr;
- cell->connections_["\\D"] = sig_d;
- cell->connections_["\\Q"] = sig_q;
+ cell->set("\\C", sig_clk);
+ cell->set("\\S", sig_set);
+ cell->set("\\R", sig_clr);
+ cell->set("\\D", sig_d);
+ cell->set("\\Q", sig_q);
add(cell);
return cell;
}
@@ -1289,10 +1289,10 @@ RTLIL::Cell* RTLIL::Module::addAdffGate(RTLIL::IdString name, RTLIL::SigSpec sig
RTLIL::Cell *cell = new RTLIL::Cell;
cell->name = name;
cell->type = stringf("$_DFF_%c%c%c_", clk_polarity ? 'P' : 'N', arst_polarity ? 'P' : 'N', arst_value ? '1' : '0');
- cell->connections_["\\C"] = sig_clk;
- cell->connections_["\\R"] = sig_arst;
- cell->connections_["\\D"] = sig_d;
- cell->connections_["\\Q"] = sig_q;
+ cell->set("\\C", sig_clk);
+ cell->set("\\R", sig_arst);
+ cell->set("\\D", sig_d);
+ cell->set("\\Q", sig_q);
add(cell);
return cell;
}
@@ -1302,9 +1302,9 @@ RTLIL::Cell* RTLIL::Module::addDlatchGate(RTLIL::IdString name, RTLIL::SigSpec s
RTLIL::Cell *cell = new RTLIL::Cell;
cell->name = name;
cell->type = stringf("$_DLATCH_%c_", en_polarity ? 'P' : 'N');
- cell->connections_["\\E"] = sig_en;
- cell->connections_["\\D"] = sig_d;
- cell->connections_["\\Q"] = sig_q;
+ cell->set("\\E", sig_en);
+ cell->set("\\D", sig_d);
+ cell->set("\\Q", sig_q);
add(cell);
return cell;
}
@@ -1315,11 +1315,11 @@ RTLIL::Cell* RTLIL::Module::addDlatchsrGate(RTLIL::IdString name, RTLIL::SigSpec
RTLIL::Cell *cell = new RTLIL::Cell;
cell->name = name;
cell->type = stringf("$_DLATCHSR_%c%c%c_", en_polarity ? 'P' : 'N', set_polarity ? 'P' : 'N', clr_polarity ? 'P' : 'N');
- cell->connections_["\\E"] = sig_en;
- cell->connections_["\\S"] = sig_set;
- cell->connections_["\\R"] = sig_clr;
- cell->connections_["\\D"] = sig_d;
- cell->connections_["\\Q"] = sig_q;
+ cell->set("\\E", sig_en);
+ cell->set("\\S", sig_set);
+ cell->set("\\R", sig_clr);
+ cell->set("\\D", sig_d);
+ cell->set("\\Q", sig_q);
add(cell);
return cell;
}
diff --git a/kernel/satgen.h b/kernel/satgen.h
index ec4480c3..6a288a8d 100644
--- a/kernel/satgen.h
+++ b/kernel/satgen.h
@@ -182,9 +182,9 @@ struct SatGen
if (model_undef && (cell->type == "$add" || cell->type == "$sub" || cell->type == "$mul" || cell->type == "$div" || cell->type == "$mod" || is_arith_compare))
{
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_b = importUndefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_b = importUndefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
if (is_arith_compare)
extendSignalWidth(undef_a, undef_b, cell, true);
else
@@ -195,7 +195,7 @@ struct SatGen
int undef_y_bit = ez->OR(undef_any_a, undef_any_b);
if (cell->type == "$div" || cell->type == "$mod") {
- std::vector<int> b = importSigSpec(cell->connections_.at("\\B"), timestep);
+ std::vector<int> b = importSigSpec(cell->get("\\B"), timestep);
undef_y_bit = ez->OR(undef_y_bit, ez->NOT(ez->expression(ezSAT::OpOr, b)));
}
@@ -215,9 +215,9 @@ struct SatGen
cell->type == "$and" || cell->type == "$or" || cell->type == "$xor" || cell->type == "$xnor" ||
cell->type == "$add" || cell->type == "$sub")
{
- std::vector<int> a = importDefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> b = importDefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> y = importDefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> a = importDefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> b = importDefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> y = importDefSigSpec(cell->get("\\Y"), timestep);
extendSignalWidth(a, b, y, cell);
std::vector<int> yy = model_undef ? ez->vec_var(y.size()) : y;
@@ -237,9 +237,9 @@ struct SatGen
if (model_undef && !arith_undef_handled)
{
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_b = importUndefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_b = importUndefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
extendSignalWidth(undef_a, undef_b, undef_y, cell, false);
if (cell->type == "$and" || cell->type == "$_AND_") {
@@ -265,7 +265,7 @@ struct SatGen
}
else if (model_undef)
{
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
undefGating(y, yy, undef_y);
}
return true;
@@ -273,16 +273,16 @@ struct SatGen
if (cell->type == "$_INV_" || cell->type == "$not")
{
- std::vector<int> a = importDefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> y = importDefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> a = importDefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> y = importDefSigSpec(cell->get("\\Y"), timestep);
extendSignalWidthUnary(a, y, cell);
std::vector<int> yy = model_undef ? ez->vec_var(y.size()) : y;
ez->assume(ez->vec_eq(ez->vec_not(a), yy));
if (model_undef) {
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
extendSignalWidthUnary(undef_a, undef_y, cell, true);
ez->assume(ez->vec_eq(undef_a, undef_y));
undefGating(y, yy, undef_y);
@@ -292,20 +292,20 @@ struct SatGen
if (cell->type == "$_MUX_" || cell->type == "$mux")
{
- std::vector<int> a = importDefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> b = importDefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> s = importDefSigSpec(cell->connections_.at("\\S"), timestep);
- std::vector<int> y = importDefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> a = importDefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> b = importDefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> s = importDefSigSpec(cell->get("\\S"), timestep);
+ std::vector<int> y = importDefSigSpec(cell->get("\\Y"), timestep);
std::vector<int> yy = model_undef ? ez->vec_var(y.size()) : y;
ez->assume(ez->vec_eq(ez->vec_ite(s.at(0), b, a), yy));
if (model_undef)
{
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_b = importUndefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> undef_s = importUndefSigSpec(cell->connections_.at("\\S"), timestep);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_b = importUndefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> undef_s = importUndefSigSpec(cell->get("\\S"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
std::vector<int> unequal_ab = ez->vec_not(ez->vec_iff(a, b));
std::vector<int> undef_ab = ez->vec_or(unequal_ab, ez->vec_or(undef_a, undef_b));
@@ -318,10 +318,10 @@ struct SatGen
if (cell->type == "$pmux" || cell->type == "$safe_pmux")
{
- std::vector<int> a = importDefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> b = importDefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> s = importDefSigSpec(cell->connections_.at("\\S"), timestep);
- std::vector<int> y = importDefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> a = importDefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> b = importDefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> s = importDefSigSpec(cell->get("\\S"), timestep);
+ std::vector<int> y = importDefSigSpec(cell->get("\\Y"), timestep);
std::vector<int> yy = model_undef ? ez->vec_var(y.size()) : y;
@@ -336,10 +336,10 @@ struct SatGen
if (model_undef)
{
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_b = importUndefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> undef_s = importUndefSigSpec(cell->connections_.at("\\S"), timestep);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_b = importUndefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> undef_s = importUndefSigSpec(cell->get("\\S"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
int maybe_one_hot = ez->FALSE;
int maybe_many_hot = ez->FALSE;
@@ -387,8 +387,8 @@ struct SatGen
if (cell->type == "$pos" || cell->type == "$bu0" || cell->type == "$neg")
{
- std::vector<int> a = importDefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> y = importDefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> a = importDefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> y = importDefSigSpec(cell->get("\\Y"), timestep);
extendSignalWidthUnary(a, y, cell);
std::vector<int> yy = model_undef ? ez->vec_var(y.size()) : y;
@@ -402,8 +402,8 @@ struct SatGen
if (model_undef)
{
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
extendSignalWidthUnary(undef_a, undef_y, cell, cell->type != "$bu0");
if (cell->type == "$pos" || cell->type == "$bu0") {
@@ -422,8 +422,8 @@ struct SatGen
if (cell->type == "$reduce_and" || cell->type == "$reduce_or" || cell->type == "$reduce_xor" ||
cell->type == "$reduce_xnor" || cell->type == "$reduce_bool" || cell->type == "$logic_not")
{
- std::vector<int> a = importDefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> y = importDefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> a = importDefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> y = importDefSigSpec(cell->get("\\Y"), timestep);
std::vector<int> yy = model_undef ? ez->vec_var(y.size()) : y;
@@ -442,8 +442,8 @@ struct SatGen
if (model_undef)
{
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
int aX = ez->expression(ezSAT::OpOr, undef_a);
if (cell->type == "$reduce_and") {
@@ -469,12 +469,12 @@ struct SatGen
if (cell->type == "$logic_and" || cell->type == "$logic_or")
{
- std::vector<int> vec_a = importDefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> vec_b = importDefSigSpec(cell->connections_.at("\\B"), timestep);
+ std::vector<int> vec_a = importDefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> vec_b = importDefSigSpec(cell->get("\\B"), timestep);
int a = ez->expression(ez->OpOr, vec_a);
int b = ez->expression(ez->OpOr, vec_b);
- std::vector<int> y = importDefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> y = importDefSigSpec(cell->get("\\Y"), timestep);
std::vector<int> yy = model_undef ? ez->vec_var(y.size()) : y;
@@ -487,9 +487,9 @@ struct SatGen
if (model_undef)
{
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_b = importUndefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_b = importUndefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
int a0 = ez->NOT(ez->OR(ez->expression(ezSAT::OpOr, vec_a), ez->expression(ezSAT::OpOr, undef_a)));
int b0 = ez->NOT(ez->OR(ez->expression(ezSAT::OpOr, vec_b), ez->expression(ezSAT::OpOr, undef_b)));
@@ -516,16 +516,16 @@ struct SatGen
if (cell->type == "$lt" || cell->type == "$le" || cell->type == "$eq" || cell->type == "$ne" || cell->type == "$eqx" || cell->type == "$nex" || cell->type == "$ge" || cell->type == "$gt")
{
bool is_signed = cell->parameters["\\A_SIGNED"].as_bool() && cell->parameters["\\B_SIGNED"].as_bool();
- std::vector<int> a = importDefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> b = importDefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> y = importDefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> a = importDefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> b = importDefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> y = importDefSigSpec(cell->get("\\Y"), timestep);
extendSignalWidth(a, b, cell);
std::vector<int> yy = model_undef ? ez->vec_var(y.size()) : y;
if (model_undef && (cell->type == "$eqx" || cell->type == "$nex")) {
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_b = importUndefSigSpec(cell->connections_.at("\\B"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_b = importUndefSigSpec(cell->get("\\B"), timestep);
extendSignalWidth(undef_a, undef_b, cell, true);
a = ez->vec_or(a, undef_a);
b = ez->vec_or(b, undef_b);
@@ -548,9 +548,9 @@ struct SatGen
if (model_undef && (cell->type == "$eqx" || cell->type == "$nex"))
{
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_b = importUndefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_b = importUndefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
extendSignalWidth(undef_a, undef_b, cell, true);
if (cell->type == "$eqx")
@@ -565,9 +565,9 @@ struct SatGen
}
else if (model_undef && (cell->type == "$eq" || cell->type == "$ne"))
{
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_b = importUndefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_b = importUndefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
extendSignalWidth(undef_a, undef_b, cell, true);
int undef_any_a = ez->expression(ezSAT::OpOr, undef_a);
@@ -589,7 +589,7 @@ struct SatGen
else
{
if (model_undef) {
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
undefGating(y, yy, undef_y);
}
log_assert(!model_undef || arith_undef_handled);
@@ -599,9 +599,9 @@ struct SatGen
if (cell->type == "$shl" || cell->type == "$shr" || cell->type == "$sshl" || cell->type == "$sshr")
{
- std::vector<int> a = importDefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> b = importDefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> y = importDefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> a = importDefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> b = importDefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> y = importDefSigSpec(cell->get("\\Y"), timestep);
char shift_left = cell->type == "$shl" || cell->type == "$sshl";
bool sign_extend = cell->type == "$sshr" && cell->parameters["\\A_SIGNED"].as_bool();
@@ -627,9 +627,9 @@ struct SatGen
if (model_undef)
{
- std::vector<int> undef_a = importUndefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> undef_b = importUndefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_a = importUndefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> undef_b = importUndefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
while (undef_y.size() < undef_a.size())
undef_y.push_back(ez->literal());
@@ -657,9 +657,9 @@ struct SatGen
if (cell->type == "$mul")
{
- std::vector<int> a = importDefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> b = importDefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> y = importDefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> a = importDefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> b = importDefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> y = importDefSigSpec(cell->get("\\Y"), timestep);
extendSignalWidth(a, b, y, cell);
std::vector<int> yy = model_undef ? ez->vec_var(y.size()) : y;
@@ -676,7 +676,7 @@ struct SatGen
if (model_undef) {
log_assert(arith_undef_handled);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
undefGating(y, yy, undef_y);
}
return true;
@@ -684,9 +684,9 @@ struct SatGen
if (cell->type == "$div" || cell->type == "$mod")
{
- std::vector<int> a = importDefSigSpec(cell->connections_.at("\\A"), timestep);
- std::vector<int> b = importDefSigSpec(cell->connections_.at("\\B"), timestep);
- std::vector<int> y = importDefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> a = importDefSigSpec(cell->get("\\A"), timestep);
+ std::vector<int> b = importDefSigSpec(cell->get("\\B"), timestep);
+ std::vector<int> y = importDefSigSpec(cell->get("\\Y"), timestep);
extendSignalWidth(a, b, y, cell);
std::vector<int> yy = model_undef ? ez->vec_var(y.size()) : y;
@@ -740,11 +740,11 @@ struct SatGen
only_first_one.at(0) = ez->TRUE;
div_zero_result = ez->vec_ite(a.back(), only_first_one, all_ones);
} else {
- div_zero_result.insert(div_zero_result.end(), cell->connections_.at("\\A").size(), ez->TRUE);
+ div_zero_result.insert(div_zero_result.end(), cell->get("\\A").size(), ez->TRUE);
div_zero_result.insert(div_zero_result.end(), y.size() - div_zero_result.size(), ez->FALSE);
}
} else {
- int copy_a_bits = std::min(cell->connections_.at("\\A").size(), cell->connections_.at("\\B").size());
+ int copy_a_bits = std::min(cell->get("\\A").size(), cell->get("\\B").size());
div_zero_result.insert(div_zero_result.end(), a.begin(), a.begin() + copy_a_bits);
if (cell->parameters["\\A_SIGNED"].as_bool() && cell->parameters["\\B_SIGNED"].as_bool())
div_zero_result.insert(div_zero_result.end(), y.size() - div_zero_result.size(), div_zero_result.back());
@@ -756,7 +756,7 @@ struct SatGen
if (model_undef) {
log_assert(arith_undef_handled);
- std::vector<int> undef_y = importUndefSigSpec(cell->connections_.at("\\Y"), timestep);
+ std::vector<int> undef_y = importUndefSigSpec(cell->get("\\Y"), timestep);
undefGating(y, yy, undef_y);
}
return true;
@@ -764,17 +764,17 @@ struct SatGen
if (cell->type == "$slice")
{
- RTLIL::SigSpec a = cell->connections_.at("\\A");
- RTLIL::SigSpec y = cell->connections_.at("\\Y");
+ RTLIL::SigSpec a = cell->get("\\A");
+ RTLIL::SigSpec y = cell->get("\\Y");
ez->assume(signals_eq(a.extract(cell->parameters.at("\\OFFSET").as_int(), y.size()), y, timestep));
return true;
}
if (cell->type == "$concat")
{
- RTLIL::SigSpec a = cell->connections_.at("\\A");
- RTLIL::SigSpec b = cell->connections_.at("\\B");
- RTLIL::SigSpec y = cell->connections_.at("\\Y");
+ RTLIL::SigSpec a = cell->get("\\A");
+ RTLIL::SigSpec b = cell->get("\\B");
+ RTLIL::SigSpec y = cell->get("\\Y");
RTLIL::SigSpec ab = a;
ab.append(b);
@@ -787,20 +787,20 @@ struct SatGen
{
if (timestep == 1)
{
- initial_state.add((*sigmap)(cell->connections_.at("\\Q")));
+ initial_state.add((*sigmap)(cell->get("\\Q")));
}
else
{
- std::vector<int> d = importDefSigSpec(cell->connections_.at("\\D"), timestep-1);
- std::vector<int> q = importDefSigSpec(cell->connections_.at("\\Q"), timestep);
+ std::vector<int> d = importDefSigSpec(cell->get("\\D"), timestep-1);
+ std::vector<int> q = importDefSigSpec(cell->get("\\Q"), timestep);
std::vector<int> qq = model_undef ? ez->vec_var(q.size()) : q;
ez->assume(ez->vec_eq(d, qq));
if (model_undef)
{
- std::vector<int> undef_d = importUndefSigSpec(cell->connections_.at("\\D"), timestep-1);
- std::vector<int> undef_q = importUndefSigSpec(cell->connections_.at("\\Q"), timestep);
+ std::vector<int> undef_d = importUndefSigSpec(cell->get("\\D"), timestep-1);
+ std::vector<int> undef_q = importUndefSigSpec(cell->get("\\Q"), timestep);
ez->assume(ez->vec_eq(undef_d, undef_q));
undefGating(q, qq, undef_q);
@@ -812,8 +812,8 @@ struct SatGen
if (cell->type == "$assert")
{
std::string pf = prefix + (timestep == -1 ? "" : stringf("@%d:", timestep));
- asserts_a[pf].append((*sigmap)(cell->connections_.at("\\A")));
- asserts_en[pf].append((*sigmap)(cell->connections_.at("\\EN")));
+ asserts_a[pf].append((*sigmap)(cell->get("\\A")));
+ asserts_en[pf].append((*sigmap)(cell->get("\\EN")));
return true;
}
diff --git a/kernel/sigtools.h b/kernel/sigtools.h
index ea95e06e..7035db73 100644
--- a/kernel/sigtools.h
+++ b/kernel/sigtools.h
@@ -269,7 +269,7 @@ struct SigMap
void set(RTLIL::Module *module)
{
clear();
- for (auto &it : module->connections_)
+ for (auto &it : module->connections())
add(it.first, it.second);
}