Fix false ENUMVALUE errors in unstable branch (#3761)
This commit is contained in:
parent
09dff9c3a7
commit
3a27e3d67b
|
|
@ -1139,8 +1139,12 @@ private:
|
||||||
// The node got setup with the signed/real state of the node.
|
// 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
|
// 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());
|
// the number's sign. So we don't: nodep->dtypeChgSigned(nodep->num().isSigned());
|
||||||
|
if (nodep->didWidthAndSet()) return;
|
||||||
if (m_vup && m_vup->prelim()) {
|
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();
|
nodep->dtypeSetString();
|
||||||
} else if (nodep->num().sized()) {
|
} else if (nodep->num().sized()) {
|
||||||
nodep->dtypeChgWidth(nodep->num().width(), nodep->num().width());
|
nodep->dtypeChgWidth(nodep->num().width(), nodep->num().width());
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@ module t(/*AUTOARG*/);
|
||||||
localparam enum_t PARAMVAL1 = VAL1;
|
localparam enum_t PARAMVAL1 = VAL1;
|
||||||
localparam enum_t PARAMVAL1CONST = enum_t'(2);
|
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
|
initial begin
|
||||||
enum_t e;
|
enum_t e;
|
||||||
e = VAL01;
|
e = VAL01;
|
||||||
|
|
@ -27,6 +30,8 @@ module t(/*AUTOARG*/);
|
||||||
if (PARAMVAL1 != VAL1) $stop;
|
if (PARAMVAL1 != VAL1) $stop;
|
||||||
if (PARAMVAL1CONST != VAL1) $stop;
|
if (PARAMVAL1CONST != VAL1) $stop;
|
||||||
|
|
||||||
|
if (I_PARAM != I_ONE) $stop;
|
||||||
|
|
||||||
$write("*-* All Finished *-*\n");
|
$write("*-* All Finished *-*\n");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue