Fix X shift issue, bug772.

This commit is contained in:
Wilson Snyder 2014-05-24 07:05:23 -04:00
parent dcf351f847
commit 91e706ec1f
3 changed files with 9 additions and 1 deletions

View File

@ -9,7 +9,7 @@ indicates the contributor was also the author of the fix; Thanks!
*** Support SV 2012 package import before port list.
**** Fix huge shifts to zero with -Wno-WIDTH, bug765, bug766, bug768. [Clifford Wolf]
**** Fix shift corner issues, bug765, bug766, bug768, bug772. [Clifford Wolf]
**** Fix gate primitives with arrays and non-arrayed pins.

View File

@ -274,6 +274,8 @@ private:
// We can only get rid of a<<b>>c or a<<b<<c, with constant b & c
// because bits may be masked in that process, or (b+c) may exceed the word width.
if (!(nodep->rhsp()->castConst() && lhsp->rhsp()->castConst())) return false;
if (nodep->rhsp()->castConst()->num().isFourState()
|| lhsp->rhsp()->castConst()->num().isFourState()) return false;
if (nodep->width()!=lhsp->width()) return false;
if (nodep->width()!=lhsp->lhsp()->width()) return false;
return true;

View File

@ -133,6 +133,12 @@
w4_u = $signed(5'd1 > w4_s-w4_s);
`checkh(w4_u, 4'b1111);
// bug772
w4_s = w4_u << 1 <<< 0/0;
`ifndef VERILATOR // In v4 can't check value as not 4-state
`checkh(w4_s, 4'bxxxx);
`endif
if (fail) $stop;
$write("*-* All Finished *-*\n");
$finish;