fix for dpi_export_unpack

This commit is contained in:
Yilin Li 2026-06-09 21:01:30 +02:00
parent de0236be2f
commit 1b847340e0
4 changed files with 41 additions and 1 deletions

View File

@ -325,3 +325,4 @@ Yogish Sekhar
24bit-xjkp
Zubin Jain
Muzaffer Kal
Yilin Li

View File

@ -463,7 +463,9 @@ void EmitCFunc::emitVarReset(const string& prefix, AstVar* varp, bool constructi
// 'constructing' indicates that the object was just constructed, so if it is a string or
// something that starts off clear already, no need to clear it again
AstNodeDType* const dtypep = varp->dtypep()->skipRefp();
const string vlSelf = VSelfPointerText::replaceThis(m_useSelfForThis, "this->");
const string vlSelf = m_cfuncp && m_cfuncp->isStatic() ?
"vlSymsp->TOP__" + m_modp->name() + "." :
VSelfPointerText::replaceThis(m_useSelfForThis, "this->");
const string varNameProtected
= ((VN_IS(m_modp, Class) || varp->isFuncLocal()) || !prefix.empty())
? varp->nameProtect()

View File

@ -0,0 +1,14 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test for dpi unpack array
#
# author: Yilin Li
import vltest_bootstrap
test.scenarios('simulator')
test.compile(verilator_flags2=["--binary"])
test.execute()
test.passes()

View File

@ -0,0 +1,23 @@
export "DPI-C" task readHEX;
export "DPI-C" task loadHEX;
task readHEX;
input string file;
output logic [7:0] stimuli[32'h00010000];
$readmemh(file, stimuli);
endtask
task loadHEX;
input string file;
logic [7:0] stimuli[32'h00010000];
readHEX(file, stimuli);
endtask
module tb();
logic [7:0] result[32'h00010000];
initial begin
loadHEX("dummy");
end
endmodule