File tree Expand file tree Collapse file tree 3 files changed +65
-0
lines changed Expand file tree Collapse file tree 3 files changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -2112,6 +2112,7 @@ class WidthVisitor final : public VNVisitor {
2112
2112
VFlagChildDType{}, refp};
2113
2113
nodep->replaceWith (newp);
2114
2114
VL_DO_DANGLING (pushDeletep (nodep), nodep);
2115
+ userIterate (newp, m_vup);
2115
2116
} else {
2116
2117
nodep->v3warn (E_UNSUPPORTED,
2117
2118
" Unsupported: Cast to " << nodep->dtp ()->prettyTypeName ());
@@ -2126,6 +2127,11 @@ class WidthVisitor final : public VNVisitor {
2126
2127
if (m_vup->prelim ()) {
2127
2128
if (debug () >= 9 ) nodep->dumpTree (" - CastPre: " );
2128
2129
// if (debug()) nodep->backp()->dumpTree("- CastPreUpUp: ");
2130
+ if (AstSigned* const fromp = VN_CAST (nodep->fromp (), Signed)) {
2131
+ AstNode* const lhsp = fromp->lhsp ()->unlinkFrBack ();
2132
+ fromp->replaceWith (lhsp);
2133
+ VL_DO_DANGLING (fromp->deleteTree (), fromp);
2134
+ }
2129
2135
userIterateAndNext (nodep->fromp (), WidthVP{SELF, PRELIM}.p ());
2130
2136
if (debug () >= 9 ) nodep->dumpTree (" - CastDit: " );
2131
2137
AstNodeDType* const toDtp = nodep->dtypep ()->skipRefToEnump ();
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ # DESCRIPTION: Verilator: Verilog Test driver/expect definition
3
+ #
4
+ # Copyright 2025 by Wilson Snyder. This program is free software; you
5
+ # can redistribute it and/or modify it under the terms of either the GNU
6
+ # Lesser General Public License Version 3 or the Perl Artistic License
7
+ # Version 2.0.
8
+ # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
9
+
10
+ import vltest_bootstrap
11
+
12
+ test .scenarios ("simulator" )
13
+
14
+ test .compile ()
15
+
16
+ test .execute ()
17
+
18
+ test .passes ()
Original file line number Diff line number Diff line change
1
+ // DESCRIPTION: Verilator: Verilog Test module
2
+ //
3
+ // This file ONLY is placed into the Public Domain, for any use,
4
+ // without warranty, 2025 by Wilson Snyder.
5
+ // SPDX-License-Identifier: CC0-1.0
6
+
7
+ package my_pkg;
8
+ typedef enum logic [1 :0 ] {
9
+ SIG_0, SIG_1, SIG_2
10
+ } sig_t;
11
+ endpackage : my_pkg
12
+
13
+
14
+ module t ;
15
+ import my_pkg::* ;
16
+
17
+ typedef logic [7 :0 ] foo_t;
18
+ typedef logic [31 :0 ] bar_t;
19
+
20
+ bar_t [1 :0 ] the_bars;
21
+
22
+ foo_t [0 :0 ][1 :0 ] the_foos;
23
+
24
+ always_comb begin
25
+ the_bars = {32'd7 , 32'd8 };
26
+ the_foos[0 ] = {foo_t'(the_bars[1 ]), foo_t'(the_bars[0 ])};
27
+ end
28
+
29
+ logic [6 :0 ] data;
30
+ logic [2 :0 ] opt;
31
+
32
+ assign data = 7'b110_0101 ;
33
+ assign opt = {data[5 ], sig_t'(data[1 :0 ])};
34
+
35
+ initial begin
36
+ if (the_foos != 'h0708) $stop ();
37
+ if (opt != 'b101) $stop ();
38
+ $write("*-* All Finished *-*\n " );
39
+ $finish ;
40
+ end
41
+ endmodule
You can’t perform that action at this time.
0 commit comments