Fix casting etc of typedef'ed doubles.

This commit is contained in:
Wilson Snyder 2025-05-04 16:34:37 -04:00
parent 27ad648c16
commit 11cfa61f80
6 changed files with 27 additions and 18 deletions

View File

@ -34,7 +34,7 @@ int AstNode::widthInstrs() const {
return (!dtypep() ? 1 : (dtypep()->isWide() ? dtypep()->widthWords() : 1));
}
bool AstNode::isDouble() const VL_MT_STABLE {
return dtypep() && VN_IS(dtypep(), BasicDType) && VN_AS(dtypep(), BasicDType)->isDouble();
return dtypep() && dtypep()->basicp() && dtypep()->basicp()->isDouble();
}
bool AstNode::isString() const VL_MT_STABLE {
return dtypep() && dtypep()->basicp() && dtypep()->basicp()->isString();

View File

@ -408,7 +408,7 @@ public:
if (bit < 0) return false;
if (bit >= m_data.width()) return !bitIsXZ(m_data.width() - 1);
const ValueAndX v = m_data.num()[bit / 32];
return ((v.m_value & (1UL << (bit & 31))) == 0 && !(v.m_valueX & (1UL << (bit & 31))));
return ((v.m_value | v.m_valueX) & (1UL << (bit & 31))) == 0;
}
bool bitIs1(int bit) const VL_MT_SAFE {
if (!isNumber()) return false;

View File

@ -62,7 +62,7 @@ class Sum #(type T);
static int sum;
static function void add(T element);
sum += int'(element);
endfunction
endfunction
endclass
class IntQueue;
@ -221,8 +221,11 @@ module t (/*AUTOARG*/);
qi.q = '{2, 4, 6, 0, 2};
if (qi.getSum() != 14) $stop;
Sum#(int)::add(arr[0]);
if(Sum#(int)::sum != 16) $stop;
if(Sum#(real)::sum != 0) $stop;
if (Sum#(int)::sum != 16) $stop;
if (Sum#(real)::sum != 0) $stop;
Sum#(real)::add(1.9); // rounds
if (Sum#(real)::sum != 2) $stop;
if (ClsParam#(ClsStatic)::param_t::x != 1) $stop;
if (ClsParam#(ClsStatic)::param_t::get_2() != 2) $stop;
@ -231,7 +234,7 @@ module t (/*AUTOARG*/);
if (cls_param_field.get(2) != 7) $stop;
dict_op.set("abcd", 1);
if(dict_op.get("abcd") != 1) $stop;
if (dict_op.get("abcd") != 1) $stop;
if (getter1.get_1() != 1) $stop;
if (Getter1#()::get_1() != 1) $stop;

View File

@ -12,7 +12,7 @@
000019 input clk;
input real check_real; // Check issue #2741
000021 input real check_array_real [1:0];
input real check_array_real [1:0];
input string check_string; // Check issue #2766
typedef struct packed {

View File

@ -13,9 +13,7 @@
000019 input clk;
+000019 point: comment=clk hier=top.t
input real check_real; // Check issue #2741
000021 input real check_array_real [1:0];
+000021 point: comment=check_array_real[0] hier=top.t
+000021 point: comment=check_array_real[1] hier=top.t
input real check_array_real [1:0];
input string check_string; // Check issue #2766
typedef struct packed {

View File

@ -5,14 +5,22 @@ dpii_int_u3:
%Warning: DPI svOpenArrayHandle function index 1 out of bounds; 10 outside [2:-2].
%Warning: DPI svOpenArrayHandle function called on 3 dimensional array using 1 dimensional function.
dpii_real_u1:
%Warning: DPI svOpenArrayHandle function unsupported datatype (5).
%Warning: DPI svOpenArrayHandle function unsupported datatype (5).
%Warning: DPI svOpenArrayHandle function unsupported datatype (5).
%Warning: DPI svOpenArrayHandle function unsupported datatype (5).
%Warning: DPI svOpenArrayHandle function unsupported datatype (5).
%Warning: DPI svOpenArrayHandle function unsupported datatype (5).
%Warning: DPI svOpenArrayHandle function unsupported datatype (5).
%Warning: DPI svOpenArrayHandle function unsupported datatype (5).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
%Warning: DPI svOpenArrayHandle function unsupported datatype (8).
dpii_bit_u6:
%Warning: DPI svOpenArrayHandle function called on 6 dimensional array using -1 dimensional function.
%Warning: DPI svOpenArrayHandle function called on 6 dimensional array using -1 dimensional function.