mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-26 18:45:34 +00:00
Merge 0275f979c8
into f03b44959b
This commit is contained in:
commit
356067682b
3 changed files with 21 additions and 1 deletions
|
@ -189,6 +189,11 @@ bool is_reg_wire(RTLIL::SigSpec sig, std::string ®_name)
|
|||
|
||||
void dump_const(std::ostream &f, const RTLIL::Const &data, int width = -1, int offset = 0, bool no_decimal = false, bool escape_comment = false)
|
||||
{
|
||||
if (data.flags & RTLIL::CONST_FLAG_ID) {
|
||||
f << stringf("%s", data.decode_string().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
bool set_signed = (data.flags & RTLIL::CONST_FLAG_SIGNED) != 0;
|
||||
if (width < 0)
|
||||
width = data.size() - offset;
|
||||
|
@ -396,6 +401,14 @@ void dump_attributes(std::ostream &f, std::string indent, dict<RTLIL::IdString,
|
|||
}
|
||||
}
|
||||
|
||||
void dump_parameter(std::ostream &f, std::string indent, RTLIL::IdString id_string, RTLIL::Const parameter)
|
||||
{
|
||||
f << stringf("%sparameter %s", indent.c_str(), id(id_string).c_str());
|
||||
f << stringf(" = ");
|
||||
dump_const(f, parameter);
|
||||
f << stringf(";\n");
|
||||
}
|
||||
|
||||
void dump_wire(std::ostream &f, std::string indent, RTLIL::Wire *wire)
|
||||
{
|
||||
dump_attributes(f, indent, wire->attributes, "\n", /*modattr=*/false, /*regattr=*/reg_wires.count(wire->name));
|
||||
|
@ -2356,6 +2369,9 @@ void dump_module(std::ostream &f, std::string indent, RTLIL::Module *module)
|
|||
f << indent + " " << "reg " << id(initial_id) << " = 0;\n";
|
||||
}
|
||||
|
||||
for (auto p : module->parameter_default_values)
|
||||
dump_parameter(f, indent + " ", p.first, p.second);
|
||||
|
||||
for (auto w : module->wires())
|
||||
dump_wire(f, indent + " ", w);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue