mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
More cleanup
This commit is contained in:
parent
86b538bd02
commit
11e3eb1009
|
@ -13,9 +13,9 @@ endcode
|
||||||
match first
|
match first
|
||||||
select first->type.in($_DFF_N_, $_DFF_P_, $_DFFE_NN_, $_DFFE_NP_, $_DFFE_PN_, $_DFFE_PP_, \FDRE, \FDRE_1)
|
select first->type.in($_DFF_N_, $_DFF_P_, $_DFFE_NN_, $_DFFE_NP_, $_DFFE_PN_, $_DFFE_PP_, \FDRE, \FDRE_1)
|
||||||
select !first->has_keep_attr()
|
select !first->has_keep_attr()
|
||||||
select !first->type.in(\FDRE) || !first->hasParam(\IS_R_INVERTED) || !param(first, \IS_R_INVERTED).as_bool()
|
select !first->type.in(\FDRE) || !first->parameters.at(\IS_R_INVERTED, State::S0).as_bool()
|
||||||
select !first->type.in(\FDRE) || !first->hasParam(\IS_D_INVERTED) || !param(first, \IS_D_INVERTED).as_bool()
|
select !first->type.in(\FDRE) || !first->parameters.at(\IS_D_INVERTED, State::S0).as_bool()
|
||||||
select !first->type.in(\FDRE, \FDRE_1) || port(first, \R) == State::S0
|
select !first->type.in(\FDRE, \FDRE_1) || first->connections_.at(\R, State::S0).is_fully_zero()
|
||||||
filter !non_first_cells.count(first)
|
filter !non_first_cells.count(first)
|
||||||
generate
|
generate
|
||||||
SigSpec C = module->addWire(NEW_ID);
|
SigSpec C = module->addWire(NEW_ID);
|
||||||
|
@ -34,8 +34,10 @@ generate
|
||||||
cell->setPort(\CE, module->addWire(NEW_ID));
|
cell->setPort(\CE, module->addWire(NEW_ID));
|
||||||
if (r & 1)
|
if (r & 1)
|
||||||
cell->setPort(\R, module->addWire(NEW_ID));
|
cell->setPort(\R, module->addWire(NEW_ID));
|
||||||
else
|
else {
|
||||||
cell->setPort(\R, State::S0);
|
if (rng(2) == 0)
|
||||||
|
cell->setPort(\R, State::S0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -82,9 +84,9 @@ arg en_port
|
||||||
match first
|
match first
|
||||||
select first->type.in($_DFF_N_, $_DFF_P_, $_DFFE_NN_, $_DFFE_NP_, $_DFFE_PN_, $_DFFE_PP_, \FDRE, \FDRE_1)
|
select first->type.in($_DFF_N_, $_DFF_P_, $_DFFE_NN_, $_DFFE_NP_, $_DFFE_PN_, $_DFFE_PP_, \FDRE, \FDRE_1)
|
||||||
select !first->has_keep_attr()
|
select !first->has_keep_attr()
|
||||||
select !first->type.in(\FDRE) || !first->hasParam(\IS_R_INVERTED) || !param(first, \IS_R_INVERTED).as_bool()
|
select !first->type.in(\FDRE) || !first->parameters.at(\IS_R_INVERTED, State::S0).as_bool()
|
||||||
select !first->type.in(\FDRE) || !first->hasParam(\IS_D_INVERTED) || !param(first, \IS_D_INVERTED).as_bool()
|
select !first->type.in(\FDRE) || !first->parameters.at(\IS_D_INVERTED, State::S0).as_bool()
|
||||||
select !first->type.in(\FDRE, \FDRE_1) || port(first, \R) == State::S0
|
select !first->type.in(\FDRE, \FDRE_1) || first->connections_.at(\R, State::S0).is_fully_zero()
|
||||||
endmatch
|
endmatch
|
||||||
|
|
||||||
code clk_port en_port
|
code clk_port en_port
|
||||||
|
@ -105,7 +107,6 @@ match next
|
||||||
select !next->has_keep_attr()
|
select !next->has_keep_attr()
|
||||||
select !port(next, \D)[0].wire->get_bool_attribute(\keep)
|
select !port(next, \D)[0].wire->get_bool_attribute(\keep)
|
||||||
select nusers(port(next, \Q)) == 2
|
select nusers(port(next, \Q)) == 2
|
||||||
select !next->type.in(\FDRE, \FDRE_1) || port(next, \R) == State::S0
|
|
||||||
index <IdString> next->type === first->type
|
index <IdString> next->type === first->type
|
||||||
index <SigBit> port(next, \Q) === port(first, \D)
|
index <SigBit> port(next, \Q) === port(first, \D)
|
||||||
filter port(next, clk_port) == port(first, clk_port)
|
filter port(next, clk_port) == port(first, clk_port)
|
||||||
|
@ -113,7 +114,7 @@ match next
|
||||||
filter !first->type.in(\FDRE) || next->parameters.at(\IS_C_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_C_INVERTED, State::S0).as_bool()
|
filter !first->type.in(\FDRE) || next->parameters.at(\IS_C_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_C_INVERTED, State::S0).as_bool()
|
||||||
filter !first->type.in(\FDRE) || next->parameters.at(\IS_D_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_D_INVERTED, State::S0).as_bool()
|
filter !first->type.in(\FDRE) || next->parameters.at(\IS_D_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_D_INVERTED, State::S0).as_bool()
|
||||||
filter !first->type.in(\FDRE) || next->parameters.at(\IS_R_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_R_INVERTED, State::S0).as_bool()
|
filter !first->type.in(\FDRE) || next->parameters.at(\IS_R_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_R_INVERTED, State::S0).as_bool()
|
||||||
filter !first->type.in(\FDRE, \FDRE_1) || port(next, \R) == port(first, \R)
|
filter !first->type.in(\FDRE, \FDRE_1) || next->connections_.at(\R, State::S0).is_fully_zero()
|
||||||
endmatch
|
endmatch
|
||||||
|
|
||||||
code
|
code
|
||||||
|
@ -140,14 +141,15 @@ match next
|
||||||
filter !first->type.in(\FDRE) || next->parameters.at(\IS_C_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_C_INVERTED, State::S0).as_bool()
|
filter !first->type.in(\FDRE) || next->parameters.at(\IS_C_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_C_INVERTED, State::S0).as_bool()
|
||||||
filter !first->type.in(\FDRE) || next->parameters.at(\IS_D_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_D_INVERTED, State::S0).as_bool()
|
filter !first->type.in(\FDRE) || next->parameters.at(\IS_D_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_D_INVERTED, State::S0).as_bool()
|
||||||
filter !first->type.in(\FDRE) || next->parameters.at(\IS_R_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_R_INVERTED, State::S0).as_bool()
|
filter !first->type.in(\FDRE) || next->parameters.at(\IS_R_INVERTED, State::S0).as_bool() == first->parameters.at(\IS_R_INVERTED, State::S0).as_bool()
|
||||||
filter !first->type.in(\FDRE, \FDRE_1) || port(next, \R) == port(first, \R)
|
filter !first->type.in(\FDRE, \FDRE_1) || next->connections_.at(\R, State::S0).is_fully_zero()
|
||||||
generate
|
generate
|
||||||
Cell *cell = module->addCell(NEW_ID, chain.back()->type);
|
Cell *cell = module->addCell(NEW_ID, chain.back()->type);
|
||||||
cell->setPort(\C, chain.back()->getPort(\C));
|
cell->setPort(\C, chain.back()->getPort(\C));
|
||||||
cell->setPort(\D, module->addWire(NEW_ID));
|
cell->setPort(\D, module->addWire(NEW_ID));
|
||||||
cell->setPort(\Q, chain.back()->getPort(\D));
|
cell->setPort(\Q, chain.back()->getPort(\D));
|
||||||
if (cell->type == \FDRE) {
|
if (cell->type == \FDRE) {
|
||||||
cell->setPort(\R, chain.back()->getPort(\R));
|
if (rng(2) == 0)
|
||||||
|
cell->setPort(\R, chain.back()->connections_.at(\R, State::S0));
|
||||||
cell->setPort(\CE, chain.back()->getPort(\CE));
|
cell->setPort(\CE, chain.back()->getPort(\CE));
|
||||||
}
|
}
|
||||||
else if (cell->type.begins_with("$_DFFE_"))
|
else if (cell->type.begins_with("$_DFFE_"))
|
||||||
|
|
Loading…
Reference in a new issue