3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-27 10:55:51 +00:00

Naming improvements

This commit is contained in:
Akash Levy 2024-11-21 03:29:35 -08:00
parent f855b39dbb
commit 52a1493548
3 changed files with 63 additions and 65 deletions

View file

@ -263,7 +263,7 @@ FfData::FfData(FfInitVals *initvals, Cell *cell_) : FfData(cell_->module, initva
}
FfData FfData::slice(const std::vector<int> &bits) {
FfData res(module, initvals, NEW_ID2); // SILIMATE: Improve the naming
FfData res(module, initvals, NEW_ID4); // SILIMATE: Improve the naming
res.sig_clk = sig_clk;
res.sig_ce = sig_ce;
res.sig_aload = sig_aload;
@ -400,21 +400,21 @@ void FfData::aload_to_sr() {
pol_clr = false;
pol_set = true;
if (pol_aload) {
sig_clr = module->Mux(NEW_ID2_SUFFIX("clr"), Const(State::S1, width), sig_ad, sig_aload, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_set = module->Mux(NEW_ID2_SUFFIX("set"), Const(State::S0, width), sig_ad, sig_aload, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_clr = module->Mux(NEW_ID4_SUFFIX("clr"), Const(State::S1, width), sig_ad, sig_aload, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
sig_set = module->Mux(NEW_ID4_SUFFIX("set"), Const(State::S0, width), sig_ad, sig_aload, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
sig_clr = module->Mux(NEW_ID2_SUFFIX("clr"), sig_ad, Const(State::S1, width), sig_aload, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_set = module->Mux(NEW_ID2_SUFFIX("set"), sig_ad, Const(State::S0, width), sig_aload, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_clr = module->Mux(NEW_ID4_SUFFIX("clr"), sig_ad, Const(State::S1, width), sig_aload, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
sig_set = module->Mux(NEW_ID4_SUFFIX("set"), sig_ad, Const(State::S0, width), sig_aload, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
} else {
pol_clr = pol_aload;
pol_set = pol_aload;
if (pol_aload) {
sig_clr = module->AndnotGate(NEW_ID2_SUFFIX("clr"), sig_aload, sig_ad, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_set = module->AndGate(NEW_ID2_SUFFIX("set"), sig_aload, sig_ad, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_clr = module->AndnotGate(NEW_ID4_SUFFIX("clr"), sig_aload, sig_ad, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
sig_set = module->AndGate(NEW_ID4_SUFFIX("set"), sig_aload, sig_ad, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
sig_clr = module->OrGate(NEW_ID2_SUFFIX("clr"), sig_aload, sig_ad, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_set = module->OrnotGate(NEW_ID2_SUFFIX("set"), sig_aload, sig_ad, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_clr = module->OrGate(NEW_ID4_SUFFIX("clr"), sig_aload, sig_ad, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
sig_set = module->OrnotGate(NEW_ID4_SUFFIX("set"), sig_aload, sig_ad, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
}
}
@ -427,31 +427,31 @@ void FfData::convert_ce_over_srst(bool val) {
if (!is_fine) {
if (pol_ce) {
if (pol_srst) {
sig_ce = module->Or(NEW_ID2_SUFFIX("ce"), sig_ce, sig_srst, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_ce = module->Or(NEW_ID4_SUFFIX("ce"), sig_ce, sig_srst, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
SigSpec tmp = module->Not(NEW_ID2_SUFFIX("tmp"), sig_srst, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_ce = module->Or(NEW_ID2_SUFFIX("ce"), sig_ce, tmp, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
SigSpec tmp = module->Not(NEW_ID4_SUFFIX("tmp"), sig_srst, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
sig_ce = module->Or(NEW_ID4_SUFFIX("ce"), sig_ce, tmp, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
} else {
if (pol_srst) {
SigSpec tmp = module->Not(NEW_ID2_SUFFIX("tmp"), sig_srst, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_ce = module->And(NEW_ID2_SUFFIX("ce"), sig_ce, tmp, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
SigSpec tmp = module->Not(NEW_ID4_SUFFIX("tmp"), sig_srst, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
sig_ce = module->And(NEW_ID4_SUFFIX("ce"), sig_ce, tmp, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
sig_ce = module->And(NEW_ID2_SUFFIX("ce"), sig_ce, sig_srst, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_ce = module->And(NEW_ID4_SUFFIX("ce"), sig_ce, sig_srst, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
}
} else {
if (pol_ce) {
if (pol_srst) {
sig_ce = module->OrGate(NEW_ID2_SUFFIX("ce"), sig_ce, sig_srst, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_ce = module->OrGate(NEW_ID4_SUFFIX("ce"), sig_ce, sig_srst, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
sig_ce = module->OrnotGate(NEW_ID2_SUFFIX("ce"), sig_ce, sig_srst, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_ce = module->OrnotGate(NEW_ID4_SUFFIX("ce"), sig_ce, sig_srst, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
} else {
if (pol_srst) {
sig_ce = module->AndnotGate(NEW_ID2_SUFFIX("ce"), sig_ce, sig_srst, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_ce = module->AndnotGate(NEW_ID4_SUFFIX("ce"), sig_ce, sig_srst, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
sig_ce = module->AndGate(NEW_ID2_SUFFIX("ce"), sig_ce, sig_srst, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_ce = module->AndGate(NEW_ID4_SUFFIX("ce"), sig_ce, sig_srst, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
}
}
@ -460,31 +460,31 @@ void FfData::convert_ce_over_srst(bool val) {
if (!is_fine) {
if (pol_srst) {
if (pol_ce) {
sig_srst = cell->module->And(NEW_ID2_SUFFIX("srst"), sig_srst, sig_ce, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_srst = cell->module->And(NEW_ID4_SUFFIX("srst"), sig_srst, sig_ce, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
SigSpec tmp = module->Not(NEW_ID2_SUFFIX("tmp"), sig_ce, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_srst = cell->module->And(NEW_ID2_SUFFIX("srst"), sig_srst, tmp, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
SigSpec tmp = module->Not(NEW_ID4_SUFFIX("tmp"), sig_ce, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
sig_srst = cell->module->And(NEW_ID4_SUFFIX("srst"), sig_srst, tmp, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
} else {
if (pol_ce) {
SigSpec tmp = module->Not(NEW_ID2_SUFFIX("tmp"), sig_ce, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_srst = cell->module->Or(NEW_ID2_SUFFIX("srst"), sig_srst, tmp, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
SigSpec tmp = module->Not(NEW_ID4_SUFFIX("tmp"), sig_ce, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
sig_srst = cell->module->Or(NEW_ID4_SUFFIX("srst"), sig_srst, tmp, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
sig_srst = cell->module->Or(NEW_ID2_SUFFIX("srst"), sig_srst, sig_ce, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_srst = cell->module->Or(NEW_ID4_SUFFIX("srst"), sig_srst, sig_ce, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
}
} else {
if (pol_srst) {
if (pol_ce) {
sig_srst = cell->module->AndGate(NEW_ID2_SUFFIX("srst"), sig_srst, sig_ce, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_srst = cell->module->AndGate(NEW_ID4_SUFFIX("srst"), sig_srst, sig_ce, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
sig_srst = cell->module->AndnotGate(NEW_ID2_SUFFIX("srst"), sig_srst, sig_ce, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_srst = cell->module->AndnotGate(NEW_ID4_SUFFIX("srst"), sig_srst, sig_ce, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
} else {
if (pol_ce) {
sig_srst = cell->module->OrnotGate(NEW_ID2_SUFFIX("srst"), sig_srst, sig_ce, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_srst = cell->module->OrnotGate(NEW_ID4_SUFFIX("srst"), sig_srst, sig_ce, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
sig_srst = cell->module->OrGate(NEW_ID2_SUFFIX("srst"), sig_srst, sig_ce, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_srst = cell->module->OrGate(NEW_ID4_SUFFIX("srst"), sig_srst, sig_ce, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
}
}
@ -501,14 +501,14 @@ void FfData::unmap_ce() {
if (!is_fine) {
if (pol_ce)
sig_d = module->Mux(NEW_ID2_SUFFIX("d"), sig_q, sig_d, sig_ce, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_d = module->Mux(NEW_ID4_SUFFIX("d"), sig_q, sig_d, sig_ce, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
else
sig_d = module->Mux(NEW_ID2_SUFFIX("d"), sig_d, sig_q, sig_ce, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_d = module->Mux(NEW_ID4_SUFFIX("d"), sig_d, sig_q, sig_ce, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
if (pol_ce)
sig_d = module->MuxGate(NEW_ID2_SUFFIX("d"), sig_q, sig_d, sig_ce, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_d = module->MuxGate(NEW_ID4_SUFFIX("d"), sig_q, sig_d, sig_ce, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
else
sig_d = module->MuxGate(NEW_ID2_SUFFIX("d"), sig_d, sig_q, sig_ce, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_d = module->MuxGate(NEW_ID4_SUFFIX("d"), sig_d, sig_q, sig_ce, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
has_ce = false;
}
@ -521,14 +521,14 @@ void FfData::unmap_srst() {
if (!is_fine) {
if (pol_srst)
sig_d = module->Mux(NEW_ID2_SUFFIX("d"), sig_d, val_srst, sig_srst, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_d = module->Mux(NEW_ID4_SUFFIX("d"), sig_d, val_srst, sig_srst, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
else
sig_d = module->Mux(NEW_ID2_SUFFIX("d"), val_srst, sig_d, sig_srst, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_d = module->Mux(NEW_ID4_SUFFIX("d"), val_srst, sig_d, sig_srst, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
if (pol_srst)
sig_d = module->MuxGate(NEW_ID2_SUFFIX("d"), sig_d, val_srst[0], sig_srst, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_d = module->MuxGate(NEW_ID4_SUFFIX("d"), sig_d, val_srst[0], sig_srst, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
else
sig_d = module->MuxGate(NEW_ID2_SUFFIX("d"), val_srst[0], sig_d, sig_srst, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_d = module->MuxGate(NEW_ID4_SUFFIX("d"), val_srst[0], sig_d, sig_srst, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
has_srst = false;
}
@ -701,7 +701,7 @@ void FfData::flip_bits(const pool<int> &bits) {
flip_rst_bits(bits);
Wire *new_q = module->addWire(NEW_ID2_SUFFIX("new_q"), width); // SILIMATE: Improve the naming
Wire *new_q = module->addWire(NEW_ID4_SUFFIX("new_q"), width); // SILIMATE: Improve the naming
if (has_sr && cell) {
log_warning("Flipping D/Q/init and inserting priority fixup to legalize %s.%s [%s].\n", log_id(module->name), log_id(cell->name), log_id(cell->type));
@ -713,15 +713,15 @@ void FfData::flip_bits(const pool<int> &bits) {
SigSpec new_sig_clr;
if (pol_set) {
if (pol_clr) {
new_sig_clr = module->AndnotGate(NEW_ID2_SUFFIX("new_clr"), sig_set, sig_clr, cell->get_src_attribute()); // SILIMATE: Improve the naming
new_sig_clr = module->AndnotGate(NEW_ID4_SUFFIX("new_clr"), sig_set, sig_clr, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
new_sig_clr = module->AndGate(NEW_ID2_SUFFIX("new_clr"), sig_set, sig_clr, cell->get_src_attribute()); // SILIMATE: Improve the naming
new_sig_clr = module->AndGate(NEW_ID4_SUFFIX("new_clr"), sig_set, sig_clr, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
} else {
if (pol_clr) {
new_sig_clr = module->OrGate(NEW_ID2_SUFFIX("new_clr"), sig_set, sig_clr, cell->get_src_attribute()); // SILIMATE: Improve the naming
new_sig_clr = module->OrGate(NEW_ID4_SUFFIX("new_clr"), sig_set, sig_clr, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
} else {
new_sig_clr = module->OrnotGate(NEW_ID2_SUFFIX("new_clr"), sig_set, sig_clr, cell->get_src_attribute()); // SILIMATE: Improve the naming
new_sig_clr = module->OrnotGate(NEW_ID4_SUFFIX("new_clr"), sig_set, sig_clr, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
}
pol_set = pol_clr;
@ -730,10 +730,10 @@ void FfData::flip_bits(const pool<int> &bits) {
sig_clr = new_sig_clr;
}
if (has_clk || has_gclk)
sig_d = module->NotGate(NEW_ID2_SUFFIX("d"), sig_d, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_d = module->NotGate(NEW_ID4_SUFFIX("d"), sig_d, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
if (has_aload)
sig_ad = module->NotGate(NEW_ID2_SUFFIX("ad"), sig_ad, cell->get_src_attribute()); // SILIMATE: Improve the naming
module->addNotGate(NEW_ID2_SUFFIX("not"), new_q, sig_q, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_ad = module->NotGate(NEW_ID4_SUFFIX("ad"), sig_ad, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
module->addNotGate(NEW_ID4_SUFFIX("not"), new_q, sig_q, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
else
{
@ -741,17 +741,17 @@ void FfData::flip_bits(const pool<int> &bits) {
SigSpec not_clr;
if (!pol_clr) {
not_clr = sig_clr;
sig_clr = module->Not(NEW_ID2_SUFFIX("clr"), sig_clr, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_clr = module->Not(NEW_ID4_SUFFIX("clr"), sig_clr, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
pol_clr = true;
} else {
not_clr = module->Not(NEW_ID2_SUFFIX("not_clr"), sig_clr, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
not_clr = module->Not(NEW_ID4_SUFFIX("not_clr"), sig_clr, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
if (!pol_set) {
sig_set = module->Not(NEW_ID2_SUFFIX("set"), sig_set, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_set = module->Not(NEW_ID4_SUFFIX("set"), sig_set, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
pol_set = true;
}
SigSpec masked_set = module->And(NEW_ID2_SUFFIX("masked_set"), sig_set, not_clr, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
SigSpec masked_set = module->And(NEW_ID4_SUFFIX("masked_set"), sig_set, not_clr, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
for (auto bit: bits) {
sig_set[bit] = sig_clr[bit];
sig_clr[bit] = masked_set[bit];
@ -763,10 +763,10 @@ void FfData::flip_bits(const pool<int> &bits) {
mask.bits()[bit] = State::S1;
if (has_clk || has_gclk)
sig_d = module->Xor(NEW_ID2_SUFFIX("d"), sig_d, mask, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_d = module->Xor(NEW_ID4_SUFFIX("d"), sig_d, mask, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
if (has_aload)
sig_ad = module->Xor(NEW_ID2_SUFFIX("ad"), sig_ad, mask, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
module->addXor(NEW_ID2_SUFFIX("xor"), new_q, mask, sig_q, false, cell->get_src_attribute()); // SILIMATE: Improve the naming
sig_ad = module->Xor(NEW_ID4_SUFFIX("ad"), sig_ad, mask, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
module->addXor(NEW_ID4_SUFFIX("xor"), new_q, mask, sig_q, false, attributes[ID::src].decode_string()); // SILIMATE: Improve the naming
}
sig_q = new_q;