You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
It seems that Verilator ignores some_map_t specialization of class wrapper and try to cast this.map to a default type. This can be connected to #4997, as I become able to reach this point after that fix. The code below works in major simulators.
The code:
moduletest;
typedef int some_map_t[string];
class wrapper#(type VAL_T=bit);
VAL_T value;
static function wrapper#(VAL_T) from (VAL_T value);
wrapper#(VAL_T) obj = new();
obj.value = value;
return obj;
endfunction
endclass
class foo;
some_map_t map;
function wrapper#(some_map_t) to_map();
return wrapper#(some_map_t)::from(this.map); // <--- errorendfunction
endclass
initialbegin#1$finish();
endendmodule
The error:
$ verilator --binary test.sv && ./obj_dir/Vtest
Vtest_test__03a__03afoo__Vclpkg__DepSet_hf3806fa6__0.cpp: In member function‘void Vtest_test__03a__03afoo::__VnoInFunc_to_map(Vtest__Syms*, VlClassRef<Vtest_test__03a__03awrapper>&)’:
Vtest_test__03a__03afoo__Vclpkg__DepSet_hf3806fa6__0.cpp:14:81: error: cannot convert ‘VlAssocArray<std::__cxx11::basic_string<char>, unsigned int>’ to ‘CData’ {aka ‘unsigned char’}
14 | vlSymsp->TOP__test__03a__03awrapper__Vclpkg.__VnoInFunc_from(vlSymsp, this->__PVT__map, __Vfunc_from__0__Vfuncout);|~~~~~~^~~~~~~~~~
||| VlAssocArray<std::__cxx11::basic_string<char>, unsigned int>
In file included from Vtest__ALL.cpp:7:
Vtest_test__03a__03awrapper__Vclpkg__DepSet_h3427c6c0__0.cpp:9:106: note: initializing argument 2 of ‘void Vtest_test__03a__03awrapper__Vclpkg::__VnoInFunc_from(Vtest__Syms*, CData, VlClassRef<Vtest_test__03a__03awrapper>&)’
9 | void Vtest_test__03a__03awrapper__Vclpkg::__VnoInFunc_from(Vtest__Syms* __restrict vlSymsp, CData/*0:0*/ value, VlClassRef<Vtest_test__03a__03awrapper>&from__Vfuncrtn) {
|~~~~~~~~~~~~~^~~~~
Hello,
It seems that Verilator ignores
some_map_t
specialization of classwrapper
and try to castthis.map
to a default type. This can be connected to #4997, as I become able to reach this point after that fix. The code below works in major simulators.The code:
The error:
Verilator version: Verilator 5.023 devel rev v5.020-202-g1c79df863
OS: Ubuntu 22.04.4 LTS
The text was updated successfully, but these errors were encountered: