Add --structs-packed for forward compatibility, #1541.

This commit is contained in:
Wilson Snyder 2020-03-07 10:51:06 -05:00
parent e70cba77e6
commit 2d52f525c5
5 changed files with 16 additions and 0 deletions

View File

@ -15,6 +15,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
*** Add check for assertOn for asserts, #2162. [Tobias Wölfel]
*** Add --structs-packed for forward compatibility.
*** Fix genblk naming with directly nested generate blocks, #2176. [Alexander Grobman]
**** Implement $displayb/o/h, $writeb/o/h, etc, #1637.

View File

@ -1344,6 +1344,13 @@ Creates more detailed statistics, including a list of all the variables by
size (plain --stats just gives a count). See --stats, which is implied by
this.
=item --structs-packed
Converts all unpacked structures to packed structures and issues a UNPACKED
warning. Currently this is the default and --no-structs-packed will not
work. Specifying this option allows for forward compatibility when a
future version of Verilator no longer always packs unpacked structures.
=item -sv
Specifies SystemVerilog language features should be enabled; equivalent to

View File

@ -786,6 +786,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
else if ( onoffb(sw, "-skip-identical", bflag/*ref*/)) { m_skipIdentical = bflag; }
else if ( onoff (sw, "-stats", flag/*ref*/)) { m_stats = flag; }
else if ( onoff (sw, "-stats-vars", flag/*ref*/)) { m_statsVars = flag; m_stats |= flag; }
else if ( onoff (sw, "-structs-unpacked", flag/*ref*/)) { m_structsPacked = flag; }
else if (!strcmp(sw, "-sv")) { m_defaultLanguage = V3LangCode::L1800_2005; }
else if ( onoff (sw, "-threads-coarsen", flag/*ref*/)) { m_threadsCoarsen = flag; } // Undocumented, debug
else if ( onoff (sw, "-trace", flag/*ref*/)) { m_trace = flag; }
@ -1489,6 +1490,7 @@ V3Options::V3Options() {
m_savable = false;
m_stats = false;
m_statsVars = false;
m_structsPacked = true;
m_systemC = false;
m_threads = 0;
m_threadsDpiPure = true;

View File

@ -184,6 +184,7 @@ class V3Options {
bool m_relativeIncludes; // main switch: --relative-includes
bool m_reportUnoptflat; // main switch: --report-unoptflat
bool m_savable; // main switch: --savable
bool m_structsPacked; // main switch: --structs-packed
bool m_systemC; // main switch: --sc: System C instead of simple C++
bool m_stats; // main switch: --stats
bool m_statsVars; // main switch: --stats-vars
@ -322,6 +323,7 @@ class V3Options {
bool savable() const { return m_savable; }
bool stats() const { return m_stats; }
bool statsVars() const { return m_statsVars; }
bool structsPacked() const { return m_structsPacked; }
bool assertOn() const { return m_assert; } // assertOn as __FILE__ may be defined
bool autoflush() const { return m_autoflush; }
bool bboxSys() const { return m_bboxSys; }

View File

@ -1745,6 +1745,9 @@ private:
//if (debug()>=9) nodep->dumpTree("-class-in--");
if (!nodep->packed()) {
nodep->v3warn(UNPACKED, "Unsupported: Unpacked struct/union");
if (!v3Global.opt.structsPacked()) {
nodep->v3warn(UNPACKED, "Unsupported: --no-structs-packed");
}
}
userIterateChildren(nodep, NULL); // First size all members
nodep->repairMemberCache();