mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-20 12:53:39 +00:00
Respect \A_SIGNED for $shift
This reflects the behaviour of $shr/$shl, which sign-extend their A operands to the size of their output, then do a logical shift (shift in 0-bits).
This commit is contained in:
parent
22765ef0a5
commit
928fd40c2e
7 changed files with 61 additions and 65 deletions
|
@ -480,10 +480,18 @@ input [B_WIDTH-1:0] B;
|
|||
output [Y_WIDTH-1:0] Y;
|
||||
|
||||
generate
|
||||
if (B_SIGNED) begin:BLOCK1
|
||||
assign Y = $signed(B) < 0 ? A << -B : A >> B;
|
||||
end else begin:BLOCK2
|
||||
assign Y = A >> B;
|
||||
if (A_SIGNED) begin:BLOCK1
|
||||
if (B_SIGNED) begin:BLOCK2
|
||||
assign Y = $signed(B) < 0 ? $signed(A) << -B : $signed(A) >> B;
|
||||
end else begin:BLOCK3
|
||||
assign Y = $signed(A) >> B;
|
||||
end
|
||||
end else begin:BLOCK4
|
||||
if (B_SIGNED) begin:BLOCK5
|
||||
assign Y = $signed(B) < 0 ? A << -B : A >> B;
|
||||
end else begin:BLOCK6
|
||||
assign Y = A >> B;
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue