Fix dpi exports with > 32 bit but < 64 bit args, bug423.
This commit is contained in:
parent
8ff2bf51c5
commit
f488701adc
2
Changes
2
Changes
|
|
@ -8,6 +8,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
|||
|
||||
**** Suppress VARHIDDEN on dpi import arguments. [Ruben Diez]
|
||||
|
||||
**** Fix dpi exports with > 32 bit but < 64 bit args, bug423. [Chandan Egbert]
|
||||
|
||||
|
||||
* Verilator 3.830 2011/11/27
|
||||
|
||||
|
|
|
|||
|
|
@ -627,7 +627,7 @@ private:
|
|||
ket += ")";
|
||||
}
|
||||
if (!cvt
|
||||
&& portp->basicp() && portp->basicp()->isBitLogic() && portp->widthMin() != 1 && !portp->isWide())
|
||||
&& portp->basicp() && portp->basicp()->isBitLogic() && portp->widthMin() != 1 && !portp->isWide() && !portp->isQuad())
|
||||
stmt += "*"; // it's a svBitVecVal, which other code won't think is arrayed (as WData aren't), but really is
|
||||
stmt += frName;
|
||||
stmt += ket;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2011 by Wilson Snyder. This program is free software; you can
|
||||
# redistribute it and/or modify it under the terms of either the GNU
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
|
||||
compile (
|
||||
v_flags2 => ["t/t_dpi_qw_c.cpp"],
|
||||
verilator_flags2 => ["-Wall -Wno-DECLFILENAME -no-l2name"],
|
||||
);
|
||||
|
||||
execute (
|
||||
check_finished=>1,
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// Copyright 2009 by Wilson Snyder. This program is free software; you can
|
||||
// redistribute it and/or modify it under the terms of either the GNU
|
||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||
// Version 2.0.
|
||||
|
||||
module t;
|
||||
|
||||
wire [39:0] out;
|
||||
sub a(.value(out));
|
||||
|
||||
import "DPI-C" context function void poke_value(input int i);
|
||||
|
||||
|
||||
initial begin
|
||||
poke_value(32'hdeadbeef);
|
||||
if (out !== 40'hdeadbeef) begin
|
||||
$display("[%0t] %%Error: t_dpi_qw: failed", $time);
|
||||
$stop;
|
||||
end
|
||||
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
module sub(value);
|
||||
parameter WIDTH = 40;
|
||||
|
||||
output [WIDTH-1:0] value;
|
||||
|
||||
reg [WIDTH-1:0] value;
|
||||
|
||||
task set_value(input bit [WIDTH-1:0] v);
|
||||
value = v;
|
||||
endtask
|
||||
|
||||
export "DPI-C" task set_value;
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
// -*- C++ -*-
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// Copyright 2009 by Wilson Snyder. This program is free software; you can
|
||||
// redistribute it and/or modify it under the terms of either the GNU
|
||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||
// Version 2.0.
|
||||
//*************************************************************************
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include "svdpi.h"
|
||||
|
||||
//======================================================================
|
||||
|
||||
#include "Vt_dpi_qw__Dpi.h"
|
||||
|
||||
//======================================================================
|
||||
|
||||
// Called from our Verilog code to run the tests
|
||||
void poke_value(int i) {
|
||||
printf("poke_value(%d)\n", i);
|
||||
|
||||
#ifdef VERILATOR
|
||||
static int didDump = 0;
|
||||
if (didDump++ == 0) {
|
||||
# ifdef TEST_VERBOSE
|
||||
Verilated::scopesDump();
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
svScope scope = svGetScopeFromName("top.t.a");
|
||||
if (scope == NULL) {
|
||||
printf("%%Error: null scope for top.t.a\n");
|
||||
return;
|
||||
}
|
||||
|
||||
svSetScope(scope);
|
||||
svBitVecVal val[2];
|
||||
val[0] = i;
|
||||
val[1] = 0;
|
||||
set_value(val);
|
||||
}
|
||||
Loading…
Reference in New Issue