mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-06 11:20:27 +00:00
Add support for source line tracking through synthesis phase
This commit is contained in:
parent
393b18e8e1
commit
32c0f1193e
5 changed files with 45 additions and 25 deletions
|
@ -55,19 +55,19 @@ struct AlumaccWorker
|
|||
|
||||
RTLIL::SigSpec get_gt() {
|
||||
if (GetSize(cached_gt) == 0)
|
||||
cached_gt = alu_cell->module->Not(NEW_ID, alu_cell->module->Or(NEW_ID, get_lt(), get_eq()));
|
||||
cached_gt = alu_cell->module->Not(NEW_ID, alu_cell->module->Or(NEW_ID, get_lt(), get_eq()), false, alu_cell->attributes["\\src"].decode_string());
|
||||
return cached_gt;
|
||||
}
|
||||
|
||||
RTLIL::SigSpec get_eq() {
|
||||
if (GetSize(cached_eq) == 0)
|
||||
cached_eq = alu_cell->module->ReduceAnd(NEW_ID, alu_cell->getPort("\\X"));
|
||||
cached_eq = alu_cell->module->ReduceAnd(NEW_ID, alu_cell->getPort("\\X"), false, alu_cell->attributes["\\src"].decode_string());
|
||||
return cached_eq;
|
||||
}
|
||||
|
||||
RTLIL::SigSpec get_ne() {
|
||||
if (GetSize(cached_ne) == 0)
|
||||
cached_ne = alu_cell->module->Not(NEW_ID, get_eq());
|
||||
cached_ne = alu_cell->module->Not(NEW_ID, get_eq(), false, alu_cell->attributes["\\src"].decode_string());
|
||||
return cached_ne;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ struct AlumaccWorker
|
|||
if (GetSize(cached_cf) == 0) {
|
||||
cached_cf = alu_cell->getPort("\\CO");
|
||||
log_assert(GetSize(cached_cf) >= 1);
|
||||
cached_cf = alu_cell->module->Not(NEW_ID, cached_cf[GetSize(cached_cf)-1]);
|
||||
cached_cf = alu_cell->module->Not(NEW_ID, cached_cf[GetSize(cached_cf)-1], false, alu_cell->attributes["\\src"].decode_string());
|
||||
}
|
||||
return cached_cf;
|
||||
}
|
||||
|
@ -352,10 +352,14 @@ struct AlumaccWorker
|
|||
{
|
||||
auto n = it.second;
|
||||
auto cell = module->addCell(NEW_ID, "$macc");
|
||||
auto src = n->cell->attributes["\\src"].decode_string();
|
||||
|
||||
macc_counter++;
|
||||
|
||||
log(" creating $macc cell for %s: %s\n", log_id(n->cell), log_id(cell));
|
||||
|
||||
if (!src.empty()) cell->attributes["\\src"] = src;
|
||||
|
||||
n->macc.optimize(GetSize(n->y));
|
||||
n->macc.to_cell(cell);
|
||||
cell->setPort("\\Y", n->y);
|
||||
|
@ -452,6 +456,7 @@ struct AlumaccWorker
|
|||
|
||||
void replace_alu()
|
||||
{
|
||||
std::string src("");
|
||||
for (auto &it1 : sig_alu)
|
||||
for (auto n : it1.second)
|
||||
{
|
||||
|
@ -475,6 +480,9 @@ struct AlumaccWorker
|
|||
log("%s%s", i ? ", ": "", log_id(n->cells[i]));
|
||||
log(": %s\n", log_id(n->alu_cell));
|
||||
|
||||
src = n->cells.size() > 0 ? n->cells[0]->attributes["\\src"].decode_string() : "";
|
||||
if (!src.empty()) n->alu_cell->attributes["\\src"] = src;
|
||||
|
||||
n->alu_cell->setPort("\\A", n->a);
|
||||
n->alu_cell->setPort("\\B", n->b);
|
||||
n->alu_cell->setPort("\\CI", GetSize(n->c) ? n->c : RTLIL::S0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue