mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 06:03:23 +00:00
Use more ID::{A,B,Y,blackbox,whitebox}
This commit is contained in:
parent
6cd8cace0c
commit
52355f5185
40 changed files with 889 additions and 887 deletions
|
@ -38,19 +38,19 @@ struct ExclusiveDatabase
|
|||
pool<Cell*> reduce_or;
|
||||
for (auto cell : module->cells()) {
|
||||
if (cell->type == ID($eq)) {
|
||||
nonconst_sig = sigmap(cell->getPort(ID(A)));
|
||||
const_sig = sigmap(cell->getPort(ID(B)));
|
||||
nonconst_sig = sigmap(cell->getPort(ID::A));
|
||||
const_sig = sigmap(cell->getPort(ID::B));
|
||||
if (!const_sig.is_fully_const()) {
|
||||
if (!nonconst_sig.is_fully_const())
|
||||
continue;
|
||||
std::swap(nonconst_sig, const_sig);
|
||||
}
|
||||
y_port = sigmap(cell->getPort(ID(Y)));
|
||||
y_port = sigmap(cell->getPort(ID::Y));
|
||||
}
|
||||
else if (cell->type == ID($logic_not)) {
|
||||
nonconst_sig = sigmap(cell->getPort(ID(A)));
|
||||
nonconst_sig = sigmap(cell->getPort(ID::A));
|
||||
const_sig = Const(State::S0, GetSize(nonconst_sig));
|
||||
y_port = sigmap(cell->getPort(ID(Y)));
|
||||
y_port = sigmap(cell->getPort(ID::Y));
|
||||
}
|
||||
else if (cell->type == ID($reduce_or)) {
|
||||
reduce_or.insert(cell);
|
||||
|
@ -66,7 +66,7 @@ struct ExclusiveDatabase
|
|||
for (auto cell : reduce_or) {
|
||||
nonconst_sig = SigSpec();
|
||||
std::vector<Const> values;
|
||||
SigSpec a_port = sigmap(cell->getPort(ID(A)));
|
||||
SigSpec a_port = sigmap(cell->getPort(ID::A));
|
||||
for (auto bit : a_port) {
|
||||
auto it = sig_cmp_prev.find(bit);
|
||||
if (it == sig_cmp_prev.end()) {
|
||||
|
@ -84,7 +84,7 @@ struct ExclusiveDatabase
|
|||
}
|
||||
if (nonconst_sig.empty())
|
||||
continue;
|
||||
y_port = sigmap(cell->getPort(ID(Y)));
|
||||
y_port = sigmap(cell->getPort(ID::Y));
|
||||
sig_cmp_prev[y_port] = std::make_pair(nonconst_sig,std::move(values));
|
||||
}
|
||||
}
|
||||
|
@ -145,11 +145,11 @@ struct MuxpackWorker
|
|||
{
|
||||
if (cell->type.in(ID($mux), ID($pmux)) && !cell->get_bool_attribute(ID(keep)))
|
||||
{
|
||||
SigSpec a_sig = sigmap(cell->getPort(ID(A)));
|
||||
SigSpec a_sig = sigmap(cell->getPort(ID::A));
|
||||
SigSpec b_sig;
|
||||
if (cell->type == ID($mux))
|
||||
b_sig = sigmap(cell->getPort(ID(B)));
|
||||
SigSpec y_sig = sigmap(cell->getPort(ID(Y)));
|
||||
b_sig = sigmap(cell->getPort(ID::B));
|
||||
SigSpec y_sig = sigmap(cell->getPort(ID::Y));
|
||||
|
||||
if (sig_chain_next.count(a_sig))
|
||||
for (auto a_bit : a_sig.bits())
|
||||
|
@ -186,9 +186,9 @@ struct MuxpackWorker
|
|||
{
|
||||
log_debug("Considering %s (%s)\n", log_id(cell), log_id(cell->type));
|
||||
|
||||
SigSpec a_sig = sigmap(cell->getPort(ID(A)));
|
||||
SigSpec a_sig = sigmap(cell->getPort(ID::A));
|
||||
if (cell->type == ID($mux)) {
|
||||
SigSpec b_sig = sigmap(cell->getPort(ID(B)));
|
||||
SigSpec b_sig = sigmap(cell->getPort(ID::B));
|
||||
if (sig_chain_prev.count(a_sig) + sig_chain_prev.count(b_sig) != 1)
|
||||
goto start_cell;
|
||||
|
||||
|
@ -230,7 +230,7 @@ struct MuxpackWorker
|
|||
{
|
||||
chain.push_back(c);
|
||||
|
||||
SigSpec y_sig = sigmap(c->getPort(ID(Y)));
|
||||
SigSpec y_sig = sigmap(c->getPort(ID::Y));
|
||||
|
||||
if (sig_chain_next.count(y_sig) == 0)
|
||||
break;
|
||||
|
@ -270,28 +270,28 @@ struct MuxpackWorker
|
|||
pmux_count += 1;
|
||||
|
||||
first_cell->type = ID($pmux);
|
||||
SigSpec b_sig = first_cell->getPort(ID(B));
|
||||
SigSpec b_sig = first_cell->getPort(ID::B);
|
||||
SigSpec s_sig = first_cell->getPort(ID(S));
|
||||
|
||||
for (int i = 1; i < cases; i++) {
|
||||
Cell* prev_cell = chain[cursor+i-1];
|
||||
Cell* cursor_cell = chain[cursor+i];
|
||||
if (sigmap(prev_cell->getPort(ID(Y))) == sigmap(cursor_cell->getPort(ID(A)))) {
|
||||
b_sig.append(cursor_cell->getPort(ID(B)));
|
||||
if (sigmap(prev_cell->getPort(ID::Y)) == sigmap(cursor_cell->getPort(ID::A))) {
|
||||
b_sig.append(cursor_cell->getPort(ID::B));
|
||||
s_sig.append(cursor_cell->getPort(ID(S)));
|
||||
}
|
||||
else {
|
||||
log_assert(cursor_cell->type == ID($mux));
|
||||
b_sig.append(cursor_cell->getPort(ID(A)));
|
||||
b_sig.append(cursor_cell->getPort(ID::A));
|
||||
s_sig.append(module->LogicNot(NEW_ID, cursor_cell->getPort(ID(S))));
|
||||
}
|
||||
remove_cells.insert(cursor_cell);
|
||||
}
|
||||
|
||||
first_cell->setPort(ID(B), b_sig);
|
||||
first_cell->setPort(ID::B, b_sig);
|
||||
first_cell->setPort(ID(S), s_sig);
|
||||
first_cell->setParam(ID(S_WIDTH), GetSize(s_sig));
|
||||
first_cell->setPort(ID(Y), last_cell->getPort(ID(Y)));
|
||||
first_cell->setPort(ID::Y, last_cell->getPort(ID::Y));
|
||||
|
||||
cursor += cases;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue