mirror of
https://github.com/YosysHQ/yosys
synced 2026-05-25 11:26:22 +00:00
patch: WIP multicell patch test
This commit is contained in:
parent
6b16a0cac8
commit
8c26ecd2a6
3 changed files with 21 additions and 9 deletions
|
|
@ -17,17 +17,24 @@ struct TestPatchPass : public Pass {
|
|||
for (auto module : design->selected_modules()) {
|
||||
for (auto cell : module->selected_cells()) {
|
||||
if (cell->type == ID($add)) {
|
||||
Cell* add = cell;
|
||||
log_assert(add->getPort(ID::B).is_wire());
|
||||
log_assert(add->getPort(ID::B).known_driver());
|
||||
auto neg = add->getPort(ID::B).as_wire()->driverCell();
|
||||
log_assert(neg->type == ID($not));
|
||||
|
||||
|
||||
RTLIL::Patch patcher;
|
||||
patcher.mod = module;
|
||||
patcher.map = SigMap(module);
|
||||
RTLIL::Cell* sub = patcher.addCell(NEW_ID, ID($sub));
|
||||
// sub->connections_ = cell->connections();
|
||||
sub->parameters = cell->parameters;
|
||||
sub->connections_[ID::A] = cell->getPort(ID::A);
|
||||
sub->connections_[ID::B] = cell->getPort(ID::B);
|
||||
sub->connections_[ID::Y] = cell->getPort(ID::Y);
|
||||
log_cell(sub);
|
||||
patcher.patch(cell, sub);
|
||||
auto new_cell = patcher.addNeg(NEW_ID, patcher.Sub(NEW_ID, neg->getPort(ID::A), cell->getPort(ID::A)), SigSpec());
|
||||
// // sub->connections_ = cell->connections();
|
||||
// sub->parameters = add->parameters;
|
||||
// sub->connections_[ID::A] = add->getPort(ID::A);
|
||||
// sub->connections_[ID::B] = add->getPort(ID::B);
|
||||
// sub->connections_[ID::Y] = add->getPort(ID::Y);
|
||||
log_cell(new_cell);
|
||||
patcher.patch(add, new_cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue