Skip to content

Commit

Permalink
Add VL_RANDOMIZE for wide types
Browse files Browse the repository at this point in the history
  • Loading branch information
kiryk committed Nov 27, 2023
1 parent 37cfb94 commit 6f56d18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions include/verilated_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,12 @@ std::string VL_TO_STRING(const VlWide<T_Words>& obj) {
return VL_TO_STRING_W(T_Words, obj.data());
}

template <std::size_t T_Words>
inline bool VL_RANDOMIZE(VlWide<T_Words>& valuer, VlRNG& rngr = VlRNG::vl_thread_rng()) {
VL_RANDOM_W(VL_EDATASIZE*T_Words, valuer);
return true;
}

//===================================================================
// Verilog queue and dynamic array container
// There are no multithreaded locks on this; the base variable must
Expand Down
2 changes: 1 addition & 1 deletion test_regress/t/t_randomize_dynamic.v
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ end
int N = 10;

class Cls;
rand int dyn[];
rand bit [127:0] dyn[];
function new;
dyn = new[N];
endfunction
Expand Down

0 comments on commit 6f56d18

Please sign in to comment.