From 185e5d8f428d203bfda8650c21f613c0205fb2fc Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Tue, 9 Nov 2021 21:29:28 +0000 Subject: [PATCH] Make 'bit', 'logic' and 'time' types unsigned by default IEEE 1800-2017 6.11.3 says these types are unsigned. Until now these types were treated as not having a signedness (NOSIGN), and nodes having these types were later resolved by V3Width to be unsigned. This is a bit problematic when creating nodes of these types after V3Width. Treating these types as unsigned from the get go is fine, and actually improves generated code slightly. --- src/V3Ast.h | 3 +- test_regress/t/t_xml_debugcheck.out | 257 ++++++++++++------------- test_regress/t/t_xml_flat_vlvbound.out | 67 ++++--- 3 files changed, 163 insertions(+), 164 deletions(-) diff --git a/src/V3Ast.h b/src/V3Ast.h index be0a03321..ac027182c 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -504,7 +504,8 @@ public: } bool isUnsigned() const { return m_e == CHANDLE || m_e == EVENTVALUE || m_e == STRING || m_e == SCOPEPTR - || m_e == CHARPTR || m_e == UINT32 || m_e == UINT64; + || m_e == CHARPTR || m_e == UINT32 || m_e == UINT64 || m_e == BIT || m_e == LOGIC + || m_e == TIME; } bool isFourstate() const { return m_e == INTEGER || m_e == LOGIC || m_e == LOGIC_IMPLICIT || m_e == TIME; diff --git a/test_regress/t/t_xml_debugcheck.out b/test_regress/t/t_xml_debugcheck.out index 3b62af357..791baf602 100644 --- a/test_regress/t/t_xml_debugcheck.out +++ b/test_regress/t/t_xml_debugcheck.out @@ -104,10 +104,10 @@ - + - + @@ -120,7 +120,7 @@ - + @@ -134,10 +134,10 @@ - + - + @@ -150,7 +150,7 @@ - + @@ -164,14 +164,14 @@ - + - + - + @@ -186,11 +186,11 @@ - + - + @@ -206,10 +206,10 @@ - + - + @@ -222,7 +222,7 @@ - + @@ -236,10 +236,10 @@ - + - + @@ -252,7 +252,7 @@ - + @@ -266,14 +266,14 @@ - + - + - + @@ -288,11 +288,11 @@ - + - + @@ -354,10 +354,10 @@ - + - + @@ -370,7 +370,7 @@ - + @@ -384,10 +384,10 @@ - + - + @@ -400,7 +400,7 @@ - + @@ -414,14 +414,14 @@ - + - + - + @@ -436,11 +436,11 @@ - + - + @@ -456,10 +456,10 @@ - + - + @@ -472,7 +472,7 @@ - + @@ -486,10 +486,10 @@ - + - + @@ -502,7 +502,7 @@ - + @@ -516,14 +516,14 @@ - + - + - + @@ -538,11 +538,11 @@ - + - + @@ -604,10 +604,10 @@ - + - + @@ -620,7 +620,7 @@ - + @@ -634,10 +634,10 @@ - + - + @@ -650,7 +650,7 @@ - + @@ -664,14 +664,14 @@ - + - + - + @@ -686,11 +686,11 @@ - + - + @@ -706,10 +706,10 @@ - + - + @@ -722,7 +722,7 @@ - + @@ -736,10 +736,10 @@ - + - + @@ -752,7 +752,7 @@ - + @@ -766,14 +766,14 @@ - + - + - + @@ -788,11 +788,11 @@ - + - + @@ -855,10 +855,10 @@ - + - + @@ -871,7 +871,7 @@ - + @@ -885,14 +885,14 @@ - + - + - + @@ -907,11 +907,11 @@ - + - + @@ -927,14 +927,14 @@ - + - + - + @@ -949,11 +949,11 @@ - + - + @@ -969,18 +969,18 @@ - + - + - + - + @@ -997,15 +997,15 @@ - + - + - + @@ -1023,18 +1023,18 @@ - + - + - + - + @@ -1051,15 +1051,15 @@ - + - + - + @@ -1077,18 +1077,18 @@ - + - + - + - + @@ -1105,15 +1105,15 @@ - + - + - + @@ -1131,10 +1131,10 @@ - + - + @@ -1147,7 +1147,7 @@ - + @@ -1161,10 +1161,10 @@ - + - + @@ -1177,7 +1177,7 @@ - + @@ -1191,14 +1191,14 @@ - + - + - + @@ -1213,11 +1213,11 @@ - + - + @@ -1233,14 +1233,14 @@ - + - + - + @@ -1255,11 +1255,11 @@ - + - + @@ -1347,7 +1347,7 @@ - + @@ -1419,7 +1419,7 @@ - + @@ -1442,7 +1442,7 @@ - + @@ -1455,7 +1455,7 @@ - + @@ -1484,10 +1484,10 @@ - + - + @@ -1511,7 +1511,7 @@ - + @@ -1523,15 +1523,15 @@ - + - + - + @@ -1543,13 +1543,12 @@ - + - - + diff --git a/test_regress/t/t_xml_flat_vlvbound.out b/test_regress/t/t_xml_flat_vlvbound.out index aafd3bcf6..0ccd4afa3 100644 --- a/test_regress/t/t_xml_flat_vlvbound.out +++ b/test_regress/t/t_xml_flat_vlvbound.out @@ -77,37 +77,37 @@ - - - - + + + + - + - - + + - + - + - - + + - + - - + + @@ -143,37 +143,37 @@ - - - - + + + + - + - - + + - + - + - - + + - + - - + + @@ -201,16 +201,15 @@ - - + + - - - + + + -