Fix skipping public enum values with four-state values (#3303).

This commit is contained in:
Wilson Snyder 2022-02-10 19:27:28 -05:00
parent 3b7ad1820d
commit 7a355d448a
3 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,7 @@ Verilator 4.219 devel
* Removed the deprecated lint_off flag -msg; use -rule instead.
* Removed the deprecated "fl" attribute in XML output; use "loc" attribute instead.
* Fix skipping public enum values with four-state values (#3303).
Verilator 4.218 2022-01-17

View File

@ -192,6 +192,12 @@ class EmitCHeader final : public EmitCConstInit {
puts("enum " + tdefp->name() + " {\n");
for (const AstEnumItem* itemp = edtypep->itemsp(); itemp;
itemp = VN_AS(itemp->nextp(), EnumItem)) {
if (const AstConst* const constp = VN_CAST(itemp->valuep(), Const)) {
if (constp->num().isFourState()) {
puts("// " + itemp->nameProtect() + " is four-state\n");
continue;
}
}
puts(itemp->nameProtect());
puts(" = ");
iterate(itemp->valuep());

View File

@ -8,6 +8,9 @@ package p3;
typedef enum logic [2:0] {
ZERO = 3'b0,
ONE = 3'b1 } e3_t /*verilator public*/;
typedef enum logic [2:0] {
TWO = 3'd2,
XES = 3'b?1? } has_x_t /*verilator public*/;
endpackage
package p62;