Fix shift by x, bug760.
This commit is contained in:
parent
4a58e859a4
commit
621c51589a
|
|
@ -234,16 +234,19 @@ private:
|
||||||
}
|
}
|
||||||
bool operandHugeShiftL(AstNodeBiop* nodep) {
|
bool operandHugeShiftL(AstNodeBiop* nodep) {
|
||||||
return (nodep->rhsp()->castConst()
|
return (nodep->rhsp()->castConst()
|
||||||
|
&& !nodep->rhsp()->castConst()->num().isFourState()
|
||||||
&& nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->width())
|
&& nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->width())
|
||||||
&& isTPure(nodep->lhsp()));
|
&& isTPure(nodep->lhsp()));
|
||||||
}
|
}
|
||||||
bool operandHugeShiftR(AstNodeBiop* nodep) {
|
bool operandHugeShiftR(AstNodeBiop* nodep) {
|
||||||
return (nodep->rhsp()->castConst()
|
return (nodep->rhsp()->castConst()
|
||||||
|
&& !nodep->rhsp()->castConst()->num().isFourState()
|
||||||
&& nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->lhsp()->width())
|
&& nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->lhsp()->width())
|
||||||
&& isTPure(nodep->lhsp()));
|
&& isTPure(nodep->lhsp()));
|
||||||
}
|
}
|
||||||
bool operandIsTwo(AstNode* nodep) {
|
bool operandIsTwo(AstNode* nodep) {
|
||||||
return (nodep->castConst()
|
return (nodep->castConst()
|
||||||
|
&& !nodep->castConst()->num().isFourState()
|
||||||
&& nodep->width() <= VL_QUADSIZE
|
&& nodep->width() <= VL_QUADSIZE
|
||||||
&& nodep->castConst()->toUQuad()==2);
|
&& nodep->castConst()->toUQuad()==2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,14 @@
|
||||||
// without warranty, 2004 by Wilson Snyder.
|
// without warranty, 2004 by Wilson Snyder.
|
||||||
|
|
||||||
module t (/*AUTOARG*/
|
module t (/*AUTOARG*/
|
||||||
|
// Outputs
|
||||||
|
ign,
|
||||||
// Inputs
|
// Inputs
|
||||||
clk
|
clk
|
||||||
);
|
);
|
||||||
|
|
||||||
input clk;
|
input clk;
|
||||||
|
output [31:0] ign;
|
||||||
|
|
||||||
reg [31:0] right;
|
reg [31:0] right;
|
||||||
reg [31:0] left;
|
reg [31:0] left;
|
||||||
|
|
@ -16,6 +19,8 @@ module t (/*AUTOARG*/
|
||||||
reg [63:0] qleft;
|
reg [63:0] qleft;
|
||||||
reg [31:0] amt;
|
reg [31:0] amt;
|
||||||
|
|
||||||
|
assign ign = {31'h0, clk} >>> 4'bx; // bug760
|
||||||
|
|
||||||
always @* begin
|
always @* begin
|
||||||
right = 32'h819b018a >> amt;
|
right = 32'h819b018a >> amt;
|
||||||
left = 32'h819b018a << amt;
|
left = 32'h819b018a << amt;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue