Skip to content

Commit

Permalink
Add an imlementation of VL_CAST_DYNAMIC for VlNull
Browse files Browse the repository at this point in the history
  • Loading branch information
RRozak committed Oct 27, 2023
1 parent 58b50b7 commit e3a5171
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/verilated_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,12 @@ static inline bool VL_CAST_DYNAMIC(VlClassRef<T> in, VlClassRef<U>& outr) {
}
}

template <typename T>
static inline bool VL_CAST_DYNAMIC(VlNull in, VlClassRef<T>& outr) {
outr = VlNull{};
return true;
}

//=============================================================================
// VlSampleQueue stores samples for input clockvars in clocking blocks. At a clocking event,
// samples from this queue should be written to the correct input clockvar.
Expand Down
6 changes: 6 additions & 0 deletions test_regress/t/t_castdyn.v
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ module t (/*AUTOARG*/);
if (i != 1) $stop;
if (b != bb) $stop;

bb = null;
b = bb;
i = $cast(bbo, b);
if (i != 1) $stop;
if (b != bb) $stop;

bb = new;
b = bb;
bao = ba;
Expand Down

0 comments on commit e3a5171

Please sign in to comment.