mirror of https://github.com/YosysHQ/yosys.git
Revert "write_xaiger to pad, not abc9_ops -prep_holes"
This reverts commit b5f60e055d
.
This commit is contained in:
parent
2bf442ca01
commit
aa58472a29
|
@ -318,14 +318,13 @@ struct XAigerWriter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fully pad all unused input connections of this box cell with S0
|
||||||
|
// Fully pad all undriven output connections of this box cell with anonymous wires
|
||||||
for (auto port_name : r.first->second) {
|
for (auto port_name : r.first->second) {
|
||||||
auto w = box_module->wire(port_name);
|
auto w = box_module->wire(port_name);
|
||||||
log_assert(w);
|
log_assert(w);
|
||||||
|
auto rhs = cell->getPort(port_name);
|
||||||
SigSpec rhs = cell->connections_.at(port_name, SigSpec());
|
if (w->port_input)
|
||||||
if (w->port_input) {
|
|
||||||
// Add padding to fill entire port
|
|
||||||
rhs.append(SigSpec(State::Sx, GetSize(w)-GetSize(rhs)));
|
|
||||||
for (auto b : rhs) {
|
for (auto b : rhs) {
|
||||||
SigBit I = sigmap(b);
|
SigBit I = sigmap(b);
|
||||||
if (b == RTLIL::Sx)
|
if (b == RTLIL::Sx)
|
||||||
|
@ -339,11 +338,8 @@ struct XAigerWriter
|
||||||
co_bits.emplace_back(b);
|
co_bits.emplace_back(b);
|
||||||
unused_bits.erase(I);
|
unused_bits.erase(I);
|
||||||
}
|
}
|
||||||
}
|
if (w->port_output)
|
||||||
if (w->port_output) {
|
for (const auto &b : rhs.bits()) {
|
||||||
// Add padding to fill entire port
|
|
||||||
rhs.append(SigSpec(State::Sx, GetSize(w)-GetSize(rhs)));
|
|
||||||
for (const auto &b : rhs) {
|
|
||||||
SigBit O = sigmap(b);
|
SigBit O = sigmap(b);
|
||||||
if (O != b)
|
if (O != b)
|
||||||
alias_map[O] = b;
|
alias_map[O] = b;
|
||||||
|
@ -351,7 +347,6 @@ struct XAigerWriter
|
||||||
undriven_bits.erase(O);
|
undriven_bits.erase(O);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Connect <cell>.abc9_ff.Q (inserted by abc9_map.v) as the last input to the flop box
|
// Connect <cell>.abc9_ff.Q (inserted by abc9_map.v) as the last input to the flop box
|
||||||
if (box_module->get_bool_attribute("\\abc9_flop")) {
|
if (box_module->get_bool_attribute("\\abc9_flop")) {
|
||||||
|
@ -417,12 +412,9 @@ struct XAigerWriter
|
||||||
|
|
||||||
for (auto &bit : ci_bits) {
|
for (auto &bit : ci_bits) {
|
||||||
aig_m++, aig_i++;
|
aig_m++, aig_i++;
|
||||||
// State::Sx if padding
|
|
||||||
if (bit != State::Sx) {
|
|
||||||
log_assert(!aig_map.count(bit));
|
log_assert(!aig_map.count(bit));
|
||||||
aig_map[bit] = 2*aig_m;
|
aig_map[bit] = 2*aig_m;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (auto bit : co_bits) {
|
for (auto bit : co_bits) {
|
||||||
ordered_outputs[bit] = aig_o++;
|
ordered_outputs[bit] = aig_o++;
|
||||||
|
@ -609,6 +601,8 @@ struct XAigerWriter
|
||||||
f.write(buffer_str.data(), buffer_str.size());
|
f.write(buffer_str.data(), buffer_str.size());
|
||||||
|
|
||||||
if (holes_module) {
|
if (holes_module) {
|
||||||
|
log_module(holes_module);
|
||||||
|
|
||||||
std::stringstream a_buffer;
|
std::stringstream a_buffer;
|
||||||
XAigerWriter writer(holes_module, true /* holes_mode */);
|
XAigerWriter writer(holes_module, true /* holes_mode */);
|
||||||
writer.write_aiger(a_buffer, false /*ascii_mode*/);
|
writer.write_aiger(a_buffer, false /*ascii_mode*/);
|
||||||
|
|
|
@ -438,19 +438,24 @@ void abc9_module(RTLIL::Design *design, RTLIL::Module *module, std::string scrip
|
||||||
if (existing_cell) {
|
if (existing_cell) {
|
||||||
cell->parameters = existing_cell->parameters;
|
cell->parameters = existing_cell->parameters;
|
||||||
cell->attributes = existing_cell->attributes;
|
cell->attributes = existing_cell->attributes;
|
||||||
if (cell->attributes.erase("\\abc9_box_seq")) {
|
|
||||||
module->swap_names(cell, existing_cell);
|
|
||||||
module->remove(existing_cell);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cell->parameters = mapped_cell->parameters;
|
cell->parameters = mapped_cell->parameters;
|
||||||
cell->attributes = mapped_cell->attributes;
|
cell->attributes = mapped_cell->attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto abc9_box = cell->attributes.erase("\\abc9_box_seq");
|
||||||
|
if (abc9_box) {
|
||||||
|
module->swap_names(cell, existing_cell);
|
||||||
|
module->remove(existing_cell);
|
||||||
|
}
|
||||||
RTLIL::Module* box_module = design->module(mapped_cell->type);
|
RTLIL::Module* box_module = design->module(mapped_cell->type);
|
||||||
auto abc9_flop = box_module && box_module->attributes.count("\\abc9_flop");
|
auto abc9_flop = box_module && box_module->attributes.count("\\abc9_flop");
|
||||||
for (auto &conn : mapped_cell->connections()) {
|
for (auto &conn : mapped_cell->connections()) {
|
||||||
|
// Skip entire box ports composed entirely of padding only
|
||||||
|
if (abc9_box && conn.second.is_wire() && conn.second.as_wire()->get_bool_attribute(ID(abc9_padding)))
|
||||||
|
continue;
|
||||||
|
|
||||||
RTLIL::SigSpec newsig;
|
RTLIL::SigSpec newsig;
|
||||||
for (auto c : conn.second.chunks()) {
|
for (auto c : conn.second.chunks()) {
|
||||||
if (c.width == 0)
|
if (c.width == 0)
|
||||||
|
|
|
@ -254,6 +254,45 @@ void prep_holes(RTLIL::Module *module, bool dff)
|
||||||
RTLIL::Module* box_module = design->module(cell->type);
|
RTLIL::Module* box_module = design->module(cell->type);
|
||||||
if (!box_module || !box_module->attributes.count("\\abc9_box_id"))
|
if (!box_module || !box_module->attributes.count("\\abc9_box_id"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
bool blackbox = box_module->get_blackbox_attribute(true /* ignore_wb */);
|
||||||
|
|
||||||
|
// Fully pad all unused input connections of this box cell with S0
|
||||||
|
// Fully pad all undriven output connections of this box cell with anonymous wires
|
||||||
|
for (const auto &port_name : box_module->ports) {
|
||||||
|
RTLIL::Wire* w = box_module->wire(port_name);
|
||||||
|
log_assert(w);
|
||||||
|
auto it = cell->connections_.find(port_name);
|
||||||
|
if (w->port_input) {
|
||||||
|
RTLIL::SigSpec rhs;
|
||||||
|
if (it != cell->connections_.end()) {
|
||||||
|
if (GetSize(it->second) < GetSize(w))
|
||||||
|
it->second.append(RTLIL::SigSpec(State::S0, GetSize(w)-GetSize(it->second)));
|
||||||
|
rhs = it->second;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rhs = RTLIL::SigSpec(State::S0, GetSize(w));
|
||||||
|
cell->setPort(port_name, rhs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (w->port_output) {
|
||||||
|
RTLIL::SigSpec rhs;
|
||||||
|
auto it = cell->connections_.find(w->name);
|
||||||
|
if (it != cell->connections_.end()) {
|
||||||
|
if (GetSize(it->second) < GetSize(w))
|
||||||
|
it->second.append(module->addWire(NEW_ID, GetSize(w)-GetSize(it->second)));
|
||||||
|
rhs = it->second;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Wire *wire = module->addWire(NEW_ID, GetSize(w));
|
||||||
|
if (blackbox)
|
||||||
|
wire->set_bool_attribute(ID(abc9_padding));
|
||||||
|
rhs = wire;
|
||||||
|
cell->setPort(port_name, rhs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cell->attributes["\\abc9_box_seq"] = box_list.size();
|
cell->attributes["\\abc9_box_seq"] = box_list.size();
|
||||||
box_list.emplace_back(cell);
|
box_list.emplace_back(cell);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue