P
pallav
Guest
I am trying to implement the following operation: If exponent (zexp)
is negative, shift the significand (zsig0) right by the -zexp (negated
zexp so it is positive) and if any of the shifted off bits are one,
the LSB is jammed as 1. The maximum shift amt can be 32. I'm trying to
figure out how I can do this efficiently. I have the following so far:
reg [11:0] zexp;
reg [31:0] zsig0, zsig0t, jambits;
always @(/*AUTOSENSE*/)
begin
// if exponent is negative
if (zexp[11]) begin
{zsig0t, jambits} = {zsig0, 32'b0} >> ((zexp[4:0] ^ {5{zexp
[11]}) + {4'b0, zexp[11]}); // shift zsig0 right by -zexp[4:0].
zsig0t = {zsig0t[31:1], zsig[0] | (| jambits)};
end
end
Is there a better way to do the above? Main problem is the jamming of
the LSB if done as above requires a 64-bit shifter.
Thanks for any ideas.
Kind regards.
is negative, shift the significand (zsig0) right by the -zexp (negated
zexp so it is positive) and if any of the shifted off bits are one,
the LSB is jammed as 1. The maximum shift amt can be 32. I'm trying to
figure out how I can do this efficiently. I have the following so far:
reg [11:0] zexp;
reg [31:0] zsig0, zsig0t, jambits;
always @(/*AUTOSENSE*/)
begin
// if exponent is negative
if (zexp[11]) begin
{zsig0t, jambits} = {zsig0, 32'b0} >> ((zexp[4:0] ^ {5{zexp
[11]}) + {4'b0, zexp[11]}); // shift zsig0 right by -zexp[4:0].
zsig0t = {zsig0t[31:1], zsig[0] | (| jambits)};
end
end
Is there a better way to do the above? Main problem is the jamming of
the LSB if done as above requires a 64-bit shifter.
Thanks for any ideas.
Kind regards.