Fix 96 bit DPI input/outputs, bug359

This commit is contained in:
Wilson Snyder 2011-06-28 20:45:50 -04:00
parent cca759a41e
commit 2789e3dba5
6 changed files with 24 additions and 4 deletions

View File

@ -5,15 +5,15 @@ indicates the contributor was also the author of the fix; Thanks!
* Verilator 3.813****
**** Support bit vectors > 64 bits wide in DPI import and exports.
**** Fix error on enum references to other packages, bug339. [Alex Solomatnikov]
*** Support bit vectors > 64 bits wide in DPI import and exports.
*** Fix out of memory on slice syntax error, bug354. [Alex Solomatnikov]
**** Fix error on enum references to other packages, bug339. [Alex Solomatnikov]
**** Fix DPI undeclared svBitVecVal compile error, bug346. [Chandan Egbert]
**** Fix DPI bit vector compile errors, bug347. [Chandan Egbert]
**** Fix DPI bit vector compile errors, bug347, bug359. [Chandan Egbert]
**** Fix CDCRSTLOGIC report showing endpoint flops without resets.

View File

@ -127,6 +127,7 @@ public:
nodep->lhsp()->iterateAndNext(*this); puts(", ");
} else if (nodep->isWide()
&& nodep->lhsp()->castVarRef()
&& !nodep->rhsp()->castCMath()
&& !nodep->rhsp()->castVarRef()
&& !nodep->rhsp()->castArraySel()) {
// Wide functions assign into the array directly, don't need separate assign statement

View File

@ -40,6 +40,8 @@ module t;
export "DPI-C" task dpix_t_bit95;
task dpix_t_bit95(input bit [94:0] i, output bit [94:0] o); o = ~i; endtask
export "DPI-C" task dpix_t_bit96;
task dpix_t_bit96(input bit [95:0] i, output bit [95:0] o); o = ~i; endtask
int lineno;

View File

@ -144,6 +144,14 @@ int dpix_run_tests() {
CHECK_RESULT(int, o_vec95[1], ~i_vec95[1]);
CHECK_RESULT(int, o_vec95[2], (~i_vec95[2])&0x7fffffffUL);
}
{
svBitVecVal i_vec96[3] = {0xf2912312,0xab782a12,0x8a413bd9};
svBitVecVal o_vec96[3] = {0,0,0};
dpix_t_bit96(i_vec96, o_vec96);
CHECK_RESULT(int, o_vec96[0], ~i_vec96[0]);
CHECK_RESULT(int, o_vec96[1], ~i_vec96[1]);
CHECK_RESULT(int, o_vec96[2], ~i_vec96[2]);
}
if (int bad=check_sub("top.t.a",1)) return bad;
if (int bad=check_sub("top.t.b",2)) return bad;

View File

@ -60,6 +60,7 @@ module t ();
import "DPI-C" pure function void dpii_v_shortreal(input shortreal i, output shortreal o);
`endif
import "DPI-C" pure function void dpii_v_bit95 (input bit [95-1:0] i, output bit [95-1:0] o);
import "DPI-C" pure function void dpii_v_bit96 (input bit [96-1:0] i, output bit [96-1:0] o);
import "DPI-C" pure function int dpii_f_strlen (input string i);
@ -84,6 +85,7 @@ module t ();
bit [32:0] i_b33, o_b33;
bit [63:0] i_b64, o_b64;
bit [94:0] i_b95, o_b95;
bit [95:0] i_b96, o_b96;
int i_i, o_i;
byte i_y, o_y;
@ -114,6 +116,7 @@ module t ();
i_b33 = {1'b1,wide[33-2:0]};
i_b64 = {1'b1,wide[64-2:0]};
i_b95 = {1'b1,wide[95-2:0]};
i_b96 = {1'b1,wide[96-2:0]};
i_i = {1'b1,wide[32-2:0]};
i_y = {1'b1,wide[8-2:0]};
@ -163,6 +166,7 @@ module t ();
dpii_v_shortreal(i_f,o_f); if (o_f != i_f+1.5) $stop;
`endif
dpii_v_bit95 (i_b95,o_b95); if (o_b95 !== ~i_b95) $stop;
dpii_v_bit96 (i_b96,o_b96); if (o_b96 !== ~i_b96) $stop;
if (dpii_f_strlen ("")!=0) $stop;
if (dpii_f_strlen ("s")!=1) $stop;

View File

@ -106,6 +106,11 @@ void dpii_v_bit95(const svBitVecVal* i, svBitVecVal* o) {
o[1] = ~i[1];
o[2] = SV_MASK(95-64) & ~i[2];
}
void dpii_v_bit96(const svBitVecVal* i, svBitVecVal* o) {
o[0] = ~i[0];
o[1] = ~i[1];
o[2] = ~i[2];
}
int dpii_f_strlen (const char* i) { return strlen(i); }