Fix shift by x, bug760.

This commit is contained in:
Wilson Snyder 2014-05-04 08:50:44 -04:00
parent 4a58e859a4
commit 621c51589a
2 changed files with 8 additions and 0 deletions

View File

@ -234,16 +234,19 @@ private:
}
bool operandHugeShiftL(AstNodeBiop* nodep) {
return (nodep->rhsp()->castConst()
&& !nodep->rhsp()->castConst()->num().isFourState()
&& nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->width())
&& isTPure(nodep->lhsp()));
}
bool operandHugeShiftR(AstNodeBiop* nodep) {
return (nodep->rhsp()->castConst()
&& !nodep->rhsp()->castConst()->num().isFourState()
&& nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->lhsp()->width())
&& isTPure(nodep->lhsp()));
}
bool operandIsTwo(AstNode* nodep) {
return (nodep->castConst()
&& !nodep->castConst()->num().isFourState()
&& nodep->width() <= VL_QUADSIZE
&& nodep->castConst()->toUQuad()==2);
}

View File

@ -4,11 +4,14 @@
// without warranty, 2004 by Wilson Snyder.
module t (/*AUTOARG*/
// Outputs
ign,
// Inputs
clk
);
input clk;
output [31:0] ign;
reg [31:0] right;
reg [31:0] left;
@ -16,6 +19,8 @@ module t (/*AUTOARG*/
reg [63:0] qleft;
reg [31:0] amt;
assign ign = {31'h0, clk} >>> 4'bx; // bug760
always @* begin
right = 32'h819b018a >> amt;
left = 32'h819b018a << amt;