mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 06:03:23 +00:00
Use ID() in kernel/*, add simple ID:: hack (to be improved upon later)
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
8222c5735e
commit
390bf459fb
10 changed files with 1167 additions and 1145 deletions
|
@ -89,12 +89,12 @@ struct ConstEval
|
|||
|
||||
bool eval(RTLIL::Cell *cell, RTLIL::SigSpec &undef)
|
||||
{
|
||||
if (cell->type == "$lcu")
|
||||
if (cell->type == ID($lcu))
|
||||
{
|
||||
RTLIL::SigSpec sig_p = cell->getPort("\\P");
|
||||
RTLIL::SigSpec sig_g = cell->getPort("\\G");
|
||||
RTLIL::SigSpec sig_ci = cell->getPort("\\CI");
|
||||
RTLIL::SigSpec sig_co = values_map(assign_map(cell->getPort("\\CO")));
|
||||
RTLIL::SigSpec sig_p = cell->getPort(ID(P));
|
||||
RTLIL::SigSpec sig_g = cell->getPort(ID(G));
|
||||
RTLIL::SigSpec sig_ci = cell->getPort(ID(CI));
|
||||
RTLIL::SigSpec sig_co = values_map(assign_map(cell->getPort(ID(CO))));
|
||||
|
||||
if (sig_co.is_fully_const())
|
||||
return true;
|
||||
|
@ -128,24 +128,24 @@ struct ConstEval
|
|||
|
||||
RTLIL::SigSpec sig_a, sig_b, sig_s, sig_y;
|
||||
|
||||
log_assert(cell->hasPort("\\Y"));
|
||||
sig_y = values_map(assign_map(cell->getPort("\\Y")));
|
||||
log_assert(cell->hasPort(ID(Y)));
|
||||
sig_y = values_map(assign_map(cell->getPort(ID(Y))));
|
||||
if (sig_y.is_fully_const())
|
||||
return true;
|
||||
|
||||
if (cell->hasPort("\\S")) {
|
||||
sig_s = cell->getPort("\\S");
|
||||
if (cell->hasPort(ID(S))) {
|
||||
sig_s = cell->getPort(ID(S));
|
||||
if (!eval(sig_s, undef, cell))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cell->hasPort("\\A"))
|
||||
sig_a = cell->getPort("\\A");
|
||||
if (cell->hasPort(ID(A)))
|
||||
sig_a = cell->getPort(ID(A));
|
||||
|
||||
if (cell->hasPort("\\B"))
|
||||
sig_b = cell->getPort("\\B");
|
||||
if (cell->hasPort(ID(B)))
|
||||
sig_b = cell->getPort(ID(B));
|
||||
|
||||
if (cell->type.in("$mux", "$pmux", "$_MUX_", "$_NMUX_"))
|
||||
if (cell->type.in(ID($mux), ID($pmux), ID($_MUX_), ID($_NMUX_)))
|
||||
{
|
||||
std::vector<RTLIL::SigSpec> y_candidates;
|
||||
int count_maybe_set_s_bits = 0;
|
||||
|
@ -175,7 +175,7 @@ struct ConstEval
|
|||
for (auto &yc : y_candidates) {
|
||||
if (!eval(yc, undef, cell))
|
||||
return false;
|
||||
if (cell->type == "$_NMUX_")
|
||||
if (cell->type == ID($_NMUX_))
|
||||
y_values.push_back(RTLIL::const_not(yc.as_const(), Const(), false, false, GetSize(yc)));
|
||||
else
|
||||
y_values.push_back(yc.as_const());
|
||||
|
@ -198,10 +198,10 @@ struct ConstEval
|
|||
else
|
||||
set(sig_y, y_values.front());
|
||||
}
|
||||
else if (cell->type == "$fa")
|
||||
else if (cell->type == ID($fa))
|
||||
{
|
||||
RTLIL::SigSpec sig_c = cell->getPort("\\C");
|
||||
RTLIL::SigSpec sig_x = cell->getPort("\\X");
|
||||
RTLIL::SigSpec sig_c = cell->getPort(ID(C));
|
||||
RTLIL::SigSpec sig_x = cell->getPort(ID(X));
|
||||
int width = GetSize(sig_c);
|
||||
|
||||
if (!eval(sig_a, undef, cell))
|
||||
|
@ -227,13 +227,13 @@ struct ConstEval
|
|||
set(sig_y, val_y);
|
||||
set(sig_x, val_x);
|
||||
}
|
||||
else if (cell->type == "$alu")
|
||||
else if (cell->type == ID($alu))
|
||||
{
|
||||
bool signed_a = cell->parameters.count("\\A_SIGNED") > 0 && cell->parameters["\\A_SIGNED"].as_bool();
|
||||
bool signed_b = cell->parameters.count("\\B_SIGNED") > 0 && cell->parameters["\\B_SIGNED"].as_bool();
|
||||
bool signed_a = cell->parameters.count(ID(A_SIGNED)) > 0 && cell->parameters[ID(A_SIGNED)].as_bool();
|
||||
bool signed_b = cell->parameters.count(ID(B_SIGNED)) > 0 && cell->parameters[ID(B_SIGNED)].as_bool();
|
||||
|
||||
RTLIL::SigSpec sig_ci = cell->getPort("\\CI");
|
||||
RTLIL::SigSpec sig_bi = cell->getPort("\\BI");
|
||||
RTLIL::SigSpec sig_ci = cell->getPort(ID(CI));
|
||||
RTLIL::SigSpec sig_bi = cell->getPort(ID(BI));
|
||||
|
||||
if (!eval(sig_a, undef, cell))
|
||||
return false;
|
||||
|
@ -247,8 +247,8 @@ struct ConstEval
|
|||
if (!eval(sig_bi, undef, cell))
|
||||
return false;
|
||||
|
||||
RTLIL::SigSpec sig_x = cell->getPort("\\X");
|
||||
RTLIL::SigSpec sig_co = cell->getPort("\\CO");
|
||||
RTLIL::SigSpec sig_x = cell->getPort(ID(X));
|
||||
RTLIL::SigSpec sig_co = cell->getPort(ID(CO));
|
||||
|
||||
bool any_input_undef = !(sig_a.is_fully_def() && sig_b.is_fully_def() && sig_ci.is_fully_def() && sig_bi.is_fully_def());
|
||||
sig_a.extend_u0(GetSize(sig_y), signed_a);
|
||||
|
@ -283,7 +283,7 @@ struct ConstEval
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (cell->type == "$macc")
|
||||
else if (cell->type == ID($macc))
|
||||
{
|
||||
Macc macc;
|
||||
macc.from_cell(cell);
|
||||
|
@ -298,21 +298,21 @@ struct ConstEval
|
|||
return false;
|
||||
}
|
||||
|
||||
RTLIL::Const result(0, GetSize(cell->getPort("\\Y")));
|
||||
RTLIL::Const result(0, GetSize(cell->getPort(ID(Y))));
|
||||
if (!macc.eval(result))
|
||||
log_abort();
|
||||
|
||||
set(cell->getPort("\\Y"), result);
|
||||
set(cell->getPort(ID(Y)), result);
|
||||
}
|
||||
else
|
||||
{
|
||||
RTLIL::SigSpec sig_c, sig_d;
|
||||
|
||||
if (cell->type.in("$_AOI3_", "$_OAI3_", "$_AOI4_", "$_OAI4_")) {
|
||||
if (cell->hasPort("\\C"))
|
||||
sig_c = cell->getPort("\\C");
|
||||
if (cell->hasPort("\\D"))
|
||||
sig_d = cell->getPort("\\D");
|
||||
if (cell->type.in(ID($_AOI3_), ID($_OAI3_), ID($_AOI4_), ID($_OAI4_))) {
|
||||
if (cell->hasPort(ID(C)))
|
||||
sig_c = cell->getPort(ID(C));
|
||||
if (cell->hasPort(ID(D)))
|
||||
sig_d = cell->getPort(ID(D));
|
||||
}
|
||||
|
||||
if (sig_a.size() > 0 && !eval(sig_a, undef, cell))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue