mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-23 15:42:32 +00:00
WIP
This commit is contained in:
parent
afdae7b87e
commit
c3ffbf6fae
229 changed files with 3902 additions and 3835 deletions
|
|
@ -250,7 +250,7 @@ struct SimInstance
|
|||
|
||||
if (module->get_blackbox_attribute(true))
|
||||
log_error("Cannot simulate blackbox module %s (instantiated at %s).\n",
|
||||
module->name.unescape(), hiername().c_str());
|
||||
design->twines.unescaped_str(module->name), hiername().c_str());
|
||||
|
||||
if (module->has_processes())
|
||||
log_error("Found processes in simulation hierarchy (in module %s at %s). Run 'proc' first.\n",
|
||||
|
|
@ -275,9 +275,9 @@ struct SimInstance
|
|||
}
|
||||
|
||||
if ((shared->fst) && !(shared->hide_internal && wire->name[0] == '$')) {
|
||||
fstHandle id = shared->fst->getHandle(scope + "." + wire->name.unescape());
|
||||
fstHandle id = shared->fst->getHandle(scope + "." + design->twines.unescaped_str(wire->name));
|
||||
if (id==0 && wire->name.isPublic())
|
||||
log_warning("Unable to find wire %s in input file.\n", (scope + "." + wire->name.unescape()));
|
||||
log_warning("Unable to find wire %s in input file.\n", (scope + "." + design->twines.unescaped_str(wire->name)));
|
||||
fst_handles[wire] = id;
|
||||
}
|
||||
|
||||
|
|
@ -329,7 +329,7 @@ struct SimInstance
|
|||
}
|
||||
}
|
||||
|
||||
if (cell->is_builtin_ff() || cell->type == ID($anyinit)) {
|
||||
if (cell->is_builtin_ff() || cell->type == TW($anyinit)) {
|
||||
FfData ff_data(nullptr, cell);
|
||||
ff_state_t ff;
|
||||
ff.past_d = Const(State::Sx, ff_data.width);
|
||||
|
|
@ -354,13 +354,13 @@ struct SimInstance
|
|||
fst_memories[name] = shared->fst->getMemoryHandles(scope + "." + RTLIL::unescape_id(name));
|
||||
}
|
||||
|
||||
if (cell->type.in(ID($assert), ID($cover), ID($assume)))
|
||||
if (cell->type.in(TW($assert), TW($cover), TW($assume)))
|
||||
formal_database.insert(cell);
|
||||
|
||||
if (cell->type == ID($initstate))
|
||||
if (cell->type == TW($initstate))
|
||||
initstate_database.insert(cell);
|
||||
|
||||
if (cell->type == ID($print)) {
|
||||
if (cell->type == TW($print)) {
|
||||
print_database.emplace_back();
|
||||
auto &print = print_database.back();
|
||||
print.cell = cell;
|
||||
|
|
@ -413,7 +413,7 @@ struct SimInstance
|
|||
std::string hiername() const
|
||||
{
|
||||
if (instance != nullptr)
|
||||
return parent->hiername() + "." + instance->name.unescape();
|
||||
return parent->hiername() + "." + design->twines.unescaped_str(instance->name);
|
||||
|
||||
return module->design->twines.str(module->meta_->name);
|
||||
}
|
||||
|
|
@ -520,7 +520,7 @@ struct SimInstance
|
|||
{
|
||||
auto &state = mem_database[memid];
|
||||
if (offset >= state.mem->size * state.mem->width)
|
||||
log_error("Addressing out of bounds bit %d/%d of memory %s\n", offset, state.mem->size * state.mem->width, memid.unescape());
|
||||
log_error("Addressing out of bounds bit %d/%d of memory %s\n", offset, state.mem->size * state.mem->width, design->twines.unescaped_str(memid));
|
||||
if (state.data[offset] != data) {
|
||||
state.data.set(offset, data);
|
||||
dirty_memories.insert(memid);
|
||||
|
|
@ -573,7 +573,7 @@ struct SimInstance
|
|||
if (has_y) sig_y = cell->getPort(TW::Y);
|
||||
|
||||
if (shared->debug)
|
||||
log("[%s] eval %s (%s)\n", hiername(), cell, cell->type.unescape());
|
||||
log("[%s] eval %s (%s)\n", hiername(), cell, cell->type.unescaped());
|
||||
|
||||
bool err = false;
|
||||
RTLIL::Const eval_state;
|
||||
|
|
@ -593,19 +593,19 @@ struct SimInstance
|
|||
err = true;
|
||||
|
||||
if (err)
|
||||
log_warning("Unsupported evaluable cell type: %s (%s.%s)\n", cell->type.unescape(), module, cell);
|
||||
log_warning("Unsupported evaluable cell type: %s (%s.%s)\n", cell->type.unescaped(), module, cell);
|
||||
else
|
||||
set_state(sig_y, eval_state);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cell->type == ID($print))
|
||||
if (cell->type == TW($print))
|
||||
return;
|
||||
|
||||
if (cell->type.in(ID($input_port), ID($output_port), ID($public), ID($connect)))
|
||||
if (cell->type.in(TW($input_port), TW($output_port), TW($public), TW($connect)))
|
||||
return;
|
||||
|
||||
log_error("Unsupported cell type: %s (%s.%s)\n", cell->type.unescape(), module, cell);
|
||||
log_error("Unsupported cell type: %s (%s.%s)\n", cell->type.unescaped(), module, cell);
|
||||
}
|
||||
|
||||
void update_memory(IdString id) {
|
||||
|
|
@ -619,7 +619,7 @@ struct SimInstance
|
|||
Const data = Const(State::Sx, mem.width << port.wide_log2);
|
||||
|
||||
if (port.clk_enable)
|
||||
log_error("Memory %s.%s has clocked read ports. Run 'memory_nordff' to transform the circuit to remove those.\n", module, mem.memid.unescape());
|
||||
log_error("Memory %s.%s has clocked read ports. Run 'memory_nordff' to transform the circuit to remove those.\n", module, design->twines.unescaped_str(mem.memid));
|
||||
|
||||
if (addr.is_fully_def()) {
|
||||
int addr_int = addr.as_int();
|
||||
|
|
@ -937,17 +937,17 @@ struct SimInstance
|
|||
State a = get_state(cell->getPort(TW::A))[0];
|
||||
State en = get_state(cell->getPort(TW::EN))[0];
|
||||
|
||||
if (en == State::S1 && (cell->type == ID($cover) ? a == State::S1 : a != State::S1)) {
|
||||
if (en == State::S1 && (cell->type == TW($cover) ? a == State::S1 : a != State::S1)) {
|
||||
shared->triggered_assertions.emplace_back(shared->step, this, cell);
|
||||
}
|
||||
|
||||
if (cell->type == ID($cover) && en == State::S1 && a == State::S1)
|
||||
if (cell->type == TW($cover) && en == State::S1 && a == State::S1)
|
||||
log("Cover %s.%s (%s) reached.\n", hiername(), cell, label);
|
||||
|
||||
if (cell->type == ID($assume) && en == State::S1 && a != State::S1)
|
||||
if (cell->type == TW($assume) && en == State::S1 && a != State::S1)
|
||||
log("Assumption %s.%s (%s) failed.\n", hiername(), cell, label);
|
||||
|
||||
if (cell->type == ID($assert) && en == State::S1 && a != State::S1) {
|
||||
if (cell->type == TW($assert) && en == State::S1 && a != State::S1) {
|
||||
log_cell_w_hierarchy("Failed assertion", cell);
|
||||
if (shared->serious_asserts)
|
||||
log_error("Assertion %s.%s (%s) failed.\n", hiername(), cell, label);
|
||||
|
|
@ -1085,7 +1085,7 @@ struct SimInstance
|
|||
for (auto name : hdlname)
|
||||
enter_scope("\\" + name);
|
||||
} else {
|
||||
signal_name = memid.unescape();
|
||||
signal_name = design->twines.unescaped_str(memid);
|
||||
}
|
||||
|
||||
for (auto &trace_index : trace_mem.second) {
|
||||
|
|
@ -1199,7 +1199,7 @@ struct SimInstance
|
|||
{
|
||||
for (auto cell : module->cells())
|
||||
{
|
||||
if (cell->type.in(ID($anyseq))) {
|
||||
if (cell->type.in(TW($anyseq))) {
|
||||
SigSpec sig_y = sigmap(cell->getPort(TW::Y));
|
||||
if (sig_y.is_wire()) {
|
||||
bool found = false;
|
||||
|
|
@ -1212,7 +1212,7 @@ struct SimInstance
|
|||
}
|
||||
}
|
||||
if (!found)
|
||||
log_error("Unable to find required '%s' signal in file\n",(scope + "." + sig_y.as_wire()->name.unescape()));
|
||||
log_error("Unable to find required '%s' signal in file\n",(scope + "." + design->twines.unescaped_str(sig_y.as_wire()->name)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1412,7 +1412,7 @@ struct SimWorker : SimShared
|
|||
Wire *w = top->module->wire(portname);
|
||||
|
||||
if (w == nullptr)
|
||||
log_error("Can't find port %s on module %s.\n", portname.unescape(), top->module);
|
||||
log_error("Can't find port %s on module %s.\n", design->twines.unescaped_str(portname), top->module);
|
||||
|
||||
top->set_state(w, value);
|
||||
}
|
||||
|
|
@ -1495,24 +1495,24 @@ struct SimWorker : SimShared
|
|||
{
|
||||
Wire *w = topmod->wire(portname);
|
||||
if (!w)
|
||||
log_error("Can't find port %s on module %s.\n", portname.unescape(), top->module);
|
||||
log_error("Can't find port %s on module %s.\n", design->twines.unescaped_str(portname), top->module);
|
||||
if (!w->port_input)
|
||||
log_error("Clock port %s on module %s is not input.\n", portname.unescape(), top->module);
|
||||
fstHandle id = fst->getHandle(scope + "." + portname.unescape());
|
||||
log_error("Clock port %s on module %s is not input.\n", design->twines.unescaped_str(portname), top->module);
|
||||
fstHandle id = fst->getHandle(scope + "." + design->twines.unescaped_str(portname));
|
||||
if (id==0)
|
||||
log_error("Can't find port %s.%s in FST.\n", scope, portname.unescape());
|
||||
log_error("Can't find port %s.%s in FST.\n", scope, design->twines.unescaped_str(portname));
|
||||
fst_clock.push_back(id);
|
||||
}
|
||||
for (auto portname : clockn)
|
||||
{
|
||||
Wire *w = topmod->wire(portname);
|
||||
if (!w)
|
||||
log_error("Can't find port %s on module %s.\n", portname.unescape(), top->module);
|
||||
log_error("Can't find port %s on module %s.\n", design->twines.unescaped_str(portname), top->module);
|
||||
if (!w->port_input)
|
||||
log_error("Clock port %s on module %s is not input.\n", portname.unescape(), top->module);
|
||||
fstHandle id = fst->getHandle(scope + "." + portname.unescape());
|
||||
log_error("Clock port %s on module %s is not input.\n", design->twines.unescaped_str(portname), top->module);
|
||||
fstHandle id = fst->getHandle(scope + "." + design->twines.unescaped_str(portname));
|
||||
if (id==0)
|
||||
log_error("Can't find port %s.%s in FST.\n", scope, portname.unescape());
|
||||
log_error("Can't find port %s.%s in FST.\n", scope, design->twines.unescaped_str(portname));
|
||||
fst_clock.push_back(id);
|
||||
}
|
||||
|
||||
|
|
@ -1520,9 +1520,9 @@ struct SimWorker : SimShared
|
|||
|
||||
for (auto wire : topmod->wires()) {
|
||||
if (wire->port_input) {
|
||||
fstHandle id = fst->getHandle(scope + "." + wire->name.unescape());
|
||||
fstHandle id = fst->getHandle(scope + "." + design->twines.unescaped_str(wire->name));
|
||||
if (id==0)
|
||||
log_error("Unable to find required '%s' signal in file\n",(scope + "." + wire->name.unescape()));
|
||||
log_error("Unable to find required '%s' signal in file\n",(scope + "." + design->twines.unescaped_str(wire->name)));
|
||||
top->fst_inputs[wire] = id;
|
||||
}
|
||||
}
|
||||
|
|
@ -1837,7 +1837,7 @@ struct SimWorker : SimShared
|
|||
Cell *c = topmod->cell(found);
|
||||
if (!c)
|
||||
log_warning("Wire/cell %s not present in module %s\n", unescaped_s, topmod);
|
||||
else if (c->type.in(ID($anyconst), ID($anyseq))) {
|
||||
else if (c->type.in(TW($anyconst), TW($anyseq))) {
|
||||
SigSpec sig_y= c->getPort(TW::Y);
|
||||
if ((int)parts[1].size() != GetSize(sig_y))
|
||||
log_error("Size of wire %s is different than provided data.\n", log_signal(sig_y));
|
||||
|
|
@ -2084,13 +2084,13 @@ struct SimWorker : SimShared
|
|||
json.entry("version", "Yosys sim summary");
|
||||
json.entry("generator", yosys_maybe_version());
|
||||
json.entry("steps", step);
|
||||
json.entry("top", top->module->name.unescape());
|
||||
json.entry("top", design->twines.unescaped_str(top->module->name));
|
||||
json.name("assertions");
|
||||
json.begin_array();
|
||||
for (auto &assertion : triggered_assertions) {
|
||||
json.begin_object();
|
||||
json.entry("step", assertion.step);
|
||||
json.entry("type", assertion.cell->type.unescape());
|
||||
json.entry("type", design->twines.unescaped_str(assertion.cell->type));
|
||||
json.entry("path", assertion.instance->witness_full_path(assertion.cell));
|
||||
auto src = assertion.cell->get_src_attribute();
|
||||
if (!src.empty()) {
|
||||
|
|
@ -2155,12 +2155,12 @@ struct SimWorker : SimShared
|
|||
{
|
||||
Wire *w = topmod->wire(portname);
|
||||
if (!w)
|
||||
log_error("Can't find port %s on module %s.\n", portname.unescape(), top->module);
|
||||
log_error("Can't find port %s on module %s.\n", design->twines.unescaped_str(portname), top->module);
|
||||
if (!w->port_input)
|
||||
log_error("Clock port %s on module %s is not input.\n", portname.unescape(), top->module);
|
||||
fstHandle id = fst->getHandle(scope + "." + portname.unescape());
|
||||
log_error("Clock port %s on module %s is not input.\n", design->twines.unescaped_str(portname), top->module);
|
||||
fstHandle id = fst->getHandle(scope + "." + design->twines.unescaped_str(portname));
|
||||
if (id==0)
|
||||
log_error("Can't find port %s.%s in FST.\n", scope, portname.unescape());
|
||||
log_error("Can't find port %s.%s in FST.\n", scope, design->twines.unescaped_str(portname));
|
||||
fst_clock.push_back(id);
|
||||
clocks[w] = id;
|
||||
}
|
||||
|
|
@ -2168,12 +2168,12 @@ struct SimWorker : SimShared
|
|||
{
|
||||
Wire *w = topmod->wire(portname);
|
||||
if (!w)
|
||||
log_error("Can't find port %s on module %s.\n", portname.unescape(), top->module);
|
||||
log_error("Can't find port %s on module %s.\n", design->twines.unescaped_str(portname), top->module);
|
||||
if (!w->port_input)
|
||||
log_error("Clock port %s on module %s is not input.\n", portname.unescape(), top->module);
|
||||
fstHandle id = fst->getHandle(scope + "." + portname.unescape());
|
||||
log_error("Clock port %s on module %s is not input.\n", design->twines.unescaped_str(portname), top->module);
|
||||
fstHandle id = fst->getHandle(scope + "." + design->twines.unescaped_str(portname));
|
||||
if (id==0)
|
||||
log_error("Can't find port %s.%s in FST.\n", scope, portname.unescape());
|
||||
log_error("Can't find port %s.%s in FST.\n", scope, design->twines.unescaped_str(portname));
|
||||
fst_clock.push_back(id);
|
||||
clocks[w] = id;
|
||||
}
|
||||
|
|
@ -2183,9 +2183,9 @@ struct SimWorker : SimShared
|
|||
std::map<Wire*,fstHandle> outputs;
|
||||
|
||||
for (auto wire : topmod->wires()) {
|
||||
fstHandle id = fst->getHandle(scope + "." + wire->name.unescape());
|
||||
fstHandle id = fst->getHandle(scope + "." + design->twines.unescaped_str(wire->name));
|
||||
if (id==0 && (wire->port_input || wire->port_output))
|
||||
log_error("Unable to find required '%s' signal in file\n",(scope + "." + wire->name.unescape()));
|
||||
log_error("Unable to find required '%s' signal in file\n",(scope + "." + design->twines.unescaped_str(wire->name)));
|
||||
if (wire->port_input)
|
||||
if (clocks.find(wire)==clocks.end())
|
||||
inputs[wire] = id;
|
||||
|
|
@ -2366,7 +2366,7 @@ struct VCDWriter : public OutputWriter
|
|||
vcdfile << stringf("$timescale %s $end\n", worker->timescale);
|
||||
|
||||
worker->top->write_output_header(
|
||||
[this](IdString name) { vcdfile << stringf("$scope module %s $end\n", name.unescape()); },
|
||||
[this](IdString name) { vcdfile << stringf("$scope module %s $end\n", design->twines.unescaped_str(name)); },
|
||||
[this]() { vcdfile << stringf("$upscope $end\n");},
|
||||
[this,use_signal](const char *name, int size, Wire *w, int id, bool is_reg) {
|
||||
if (!use_signal.at(id)) return;
|
||||
|
|
@ -2432,7 +2432,7 @@ struct FSTWriter : public OutputWriter
|
|||
fstWriterSetRepackOnClose(fstfile, 1);
|
||||
|
||||
worker->top->write_output_header(
|
||||
[this](IdString name) { fstWriterSetScope(fstfile, FST_ST_VCD_MODULE, stringf("%s",name.unescape()).c_str(), nullptr); },
|
||||
[this](IdString name) { fstWriterSetScope(fstfile, FST_ST_VCD_MODULE, design->twines.unescaped_str(stringf("%s",name)).c_str(), nullptr); },
|
||||
[this]() { fstWriterSetUpscope(fstfile); },
|
||||
[this,use_signal](const char *name, int size, Wire *w, int id, bool is_reg) {
|
||||
if (!use_signal.at(id)) return;
|
||||
|
|
@ -2495,7 +2495,7 @@ struct AIWWriter : public OutputWriter
|
|||
RTLIL::IdString escaped_s = RTLIL::escape_id(symbol);
|
||||
Wire *w = worker->top->module->wire(escaped_s);
|
||||
if (!w)
|
||||
log_error("Wire %s not present in module %s\n",escaped_s.unescape(),worker->top->module);
|
||||
log_error("Wire %s not present in module design->twines.unescaped_str(%s\n",escaped_s),worker->top->module);
|
||||
if (index < w->start_offset || index > w->start_offset + w->width)
|
||||
log_error("Index %d for wire %s is out of range\n", index, log_signal(w));
|
||||
if (type == "input") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue