mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 14:13:23 +00:00
write_verilog -onlysrcattr option
This commit is contained in:
parent
2679e1d458
commit
e35032f2f6
1 changed files with 9 additions and 1 deletions
|
@ -36,7 +36,7 @@
|
||||||
USING_YOSYS_NAMESPACE
|
USING_YOSYS_NAMESPACE
|
||||||
PRIVATE_NAMESPACE_BEGIN
|
PRIVATE_NAMESPACE_BEGIN
|
||||||
|
|
||||||
bool verbose, norename, noattr, 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;
|
||||||
int auto_name_counter, auto_name_offset, auto_name_digits, extmem_counter;
|
int auto_name_counter, auto_name_offset, auto_name_digits, extmem_counter;
|
||||||
dict<RTLIL::IdString, int> auto_name_map;
|
dict<RTLIL::IdString, int> auto_name_map;
|
||||||
std::set<RTLIL::IdString> reg_wires;
|
std::set<RTLIL::IdString> reg_wires;
|
||||||
|
@ -400,6 +400,7 @@ void dump_attributes(std::ostream &f, std::string indent, dict<RTLIL::IdString,
|
||||||
as_comment = true;
|
as_comment = true;
|
||||||
for (auto it = attributes.begin(); it != attributes.end(); ++it) {
|
for (auto it = attributes.begin(); it != attributes.end(); ++it) {
|
||||||
if (it->first == ID::init && regattr) continue;
|
if (it->first == ID::init && regattr) continue;
|
||||||
|
if (srcattronly && it->first != ID::src) continue;
|
||||||
f << stringf("%s" "%s %s", indent.c_str(), as_comment ? "/*" : "(*", id(it->first).c_str());
|
f << stringf("%s" "%s %s", indent.c_str(), as_comment ? "/*" : "(*", id(it->first).c_str());
|
||||||
f << stringf(" = ");
|
f << stringf(" = ");
|
||||||
if (modattr && (it->second == State::S0 || it->second == Const(0)))
|
if (modattr && (it->second == State::S0 || it->second == Const(0)))
|
||||||
|
@ -2419,6 +2420,8 @@ struct VerilogBackend : public Backend {
|
||||||
log("\n");
|
log("\n");
|
||||||
log(" -noattr\n");
|
log(" -noattr\n");
|
||||||
log(" with this option no attributes are included in the output\n");
|
log(" with this option no attributes are included in the output\n");
|
||||||
|
log(" -onlysrcattr\n");
|
||||||
|
log(" with this option only src attributes are included in the output\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
log(" -attr2comment\n");
|
log(" -attr2comment\n");
|
||||||
log(" with this option attributes are included as comments in the output\n");
|
log(" with this option attributes are included as comments in the output\n");
|
||||||
|
@ -2497,6 +2500,7 @@ struct VerilogBackend : public Backend {
|
||||||
verbose = false;
|
verbose = false;
|
||||||
norename = false;
|
norename = false;
|
||||||
noattr = false;
|
noattr = false;
|
||||||
|
srcattronly = false;
|
||||||
attr2comment = false;
|
attr2comment = false;
|
||||||
noexpr = false;
|
noexpr = false;
|
||||||
nodec = false;
|
nodec = false;
|
||||||
|
@ -2535,6 +2539,10 @@ struct VerilogBackend : public Backend {
|
||||||
noattr = true;
|
noattr = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (arg == "-srcattronly") {
|
||||||
|
srcattronly = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (arg == "-attr2comment") {
|
if (arg == "-attr2comment") {
|
||||||
attr2comment = true;
|
attr2comment = true;
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue