Forums » Development »
Question about VerilatedImp::ExportNameMap
Added by Terry Chen over 1 year ago
Hi,
I have a question about defining the type of VerilatedImp::ExportNameMap as map<const char*, int>. Aren't you comparing against the ptr address value instead of the actual value of the string when you use s_s.m_nameMap.find(namep)?
The reason why I am asking is b/c I keep getting "Testbench C called publicSetBool but no such DPI export function name exists in ANY model" error even I verified that the string is actually inside s_s.m_exportMap via a printf.
Once I had changed the const char * to std::string and changed where it is used to it->first.c_str(), the problem goes away. However, before I start hacking at the innards of the verilator I wanted to confirm that the problem I see is real and that I had fixed it the right way. I am not entirely convinced b/c test_regress/t/t_dpi_export works for some reason...
Thanks, Terry
Replies (3)
RE: Question about VerilatedImp::ExportNameMap - Added by Wilson Snyder over 1 year ago
Originally the lookup was only called internally, always based on the same scope string and same pointer. And so for speed it used the pointer rather than the contents of the pointer. You've correctly discovered that assumption is no longer the case. It sounds like you already have most of a patch ready, if you send it I'll patch it in.
RE: Question about VerilatedImp::ExportNameMap - Added by Terry Chen over 1 year ago
(not sure if I could just reply to redmine@veripool.org)
Hi Wilson,
Here is the patch, generated via:
"git format-patch origin --stdout > ExportNameMap.patch"
Thanks,
Terry
ExportNameMap.patch (932 Bytes)
RE: Question about VerilatedImp::ExportNameMap - Added by Wilson Snyder over 1 year ago
Thanks, applied in git for next release - 3.805.
(1-3/3)
![[logo]](/img/veripool_small.png)