mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-15 03:35:40 +00:00
Merge from main
This commit is contained in:
commit
2b247d165b
30 changed files with 722 additions and 125 deletions
|
|
@ -95,7 +95,8 @@ bool VERILOG_BACKEND::id_is_verilog_escaped(const std::string &str) {
|
|||
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
bool verbose, norename, noattr, srcattronly, attr2comment, noexpr, nodec, nohex, nostr, extmem, defparam, decimal, siminit, systemverilog, simple_lhs, noparallelcase;
|
||||
bool verbose, norename, noattr, srcattronly, attr2comment, noexpr, nodec, nohex, nostr, extmem, defparam, decimal, siminit, systemverilog, simple_lhs,
|
||||
noparallelcase, default_params;
|
||||
int auto_name_counter, auto_name_offset, auto_name_digits, extmem_counter;
|
||||
dict<RTLIL::IdString, int> auto_name_map;
|
||||
std::set<RTLIL::IdString> reg_wires;
|
||||
|
|
@ -439,6 +440,13 @@ 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());
|
||||
dump_const(f, parameter);
|
||||
f << ";\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));
|
||||
|
|
@ -2456,6 +2464,10 @@ void dump_module(std::ostream &f, std::string indent, RTLIL::Module *module)
|
|||
f << indent + " " << "reg " << id(initial_id) << " = 0;\n";
|
||||
}
|
||||
|
||||
if (default_params)
|
||||
for (auto p : module->parameter_default_values)
|
||||
dump_parameter(f, indent + " ", p.first, p.second);
|
||||
|
||||
// first dump input / output according to their order in module->ports
|
||||
for (auto port : module->ports)
|
||||
dump_wire(f, indent + " ", module->wire(port));
|
||||
|
|
@ -2566,6 +2578,10 @@ struct VerilogBackend : public Backend {
|
|||
log(" use 'defparam' statements instead of the Verilog-2001 syntax for\n");
|
||||
log(" cell parameters.\n");
|
||||
log("\n");
|
||||
log(" -default_params\n");
|
||||
log(" emit module parameter declarations from\n");
|
||||
log(" parameter_default_values.\n");
|
||||
log("\n");
|
||||
log(" -blackboxes\n");
|
||||
log(" usually modules with the 'blackbox' attribute are ignored. with\n");
|
||||
log(" this option set only the modules with the 'blackbox' attribute\n");
|
||||
|
|
@ -2604,6 +2620,7 @@ struct VerilogBackend : public Backend {
|
|||
siminit = false;
|
||||
simple_lhs = false;
|
||||
noparallelcase = false;
|
||||
default_params = false;
|
||||
auto_prefix = "";
|
||||
|
||||
bool blackboxes = false;
|
||||
|
|
@ -2668,6 +2685,10 @@ struct VerilogBackend : public Backend {
|
|||
defparam = true;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-defaultparams") {
|
||||
default_params = true;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-decimal") {
|
||||
decimal = true;
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue