Hi,
Here’s the code:
module top;
reg [63:0]a1,b1;
reg [63:0] out1, out2;
initial begin
a1 = 64'habcd1234abcd5678;
b1 = 64'h1234abcd1234efba;
out1 = shortint'(a1);
out2 = shortint'(b1);
$display("out1 = %h ", out1);
$display("out2 = %h", out2);
end
endmodule
output:
out1 = 0000000000005678
out2 = ffffffffffffefba
I think the typecasted value of 16 bit (last 4 hex bits) are assigned to out1/out2 which is again a 64 bit reg. The LSB of 16-bit shortint value is taken and the LSB of this typecasted value is replicated to fill the remaining bits of register.
I have the doubt whether this correct as per the LRM ?
Shouldn’t extra LSB bit always be filled with 0 in order to maintain the shorint’() output intact?