1
0
mirror of https://github.com/verilator/verilator.git synced 2025-04-11 23:46:55 +00:00

Fix false ENUMVALUE errors in unstable branch ()

This commit is contained in:
Wilson Snyder 2022-11-19 14:07:39 -05:00
parent 09dff9c3a7
commit 3a27e3d67b
2 changed files with 10 additions and 1 deletions

View File

@ -1139,8 +1139,12 @@ private:
// The node got setup with the signed/real state of the node.
// However a later operation may have changed the node->signed w/o changing
// the number's sign. So we don't: nodep->dtypeChgSigned(nodep->num().isSigned());
if (nodep->didWidthAndSet()) return;
if (m_vup && m_vup->prelim()) {
if (nodep->num().isString()) {
if (VN_IS(nodep->dtypep()->skipRefToEnump(), EnumDType)) {
// Assume this constant was properly casted ealier
// (Otherwise it couldn't have an enum data type)
} else if (nodep->num().isString()) {
nodep->dtypeSetString();
} else if (nodep->num().sized()) {
nodep->dtypeChgWidth(nodep->num().width(), nodep->num().width());

View File

@ -19,6 +19,9 @@ module t(/*AUTOARG*/);
localparam enum_t PARAMVAL1 = VAL1;
localparam enum_t PARAMVAL1CONST = enum_t'(2);
typedef enum {I_ZERO, I_ONE, I_TWO} inte_t;
localparam inte_t I_PARAM = inte_t'(1);
initial begin
enum_t e;
e = VAL01;
@ -27,6 +30,8 @@ module t(/*AUTOARG*/);
if (PARAMVAL1 != VAL1) $stop;
if (PARAMVAL1CONST != VAL1) $stop;
if (I_PARAM != I_ONE) $stop;
$write("*-* All Finished *-*\n");
$finish;
end