[sv-ec] Type casting issue

From: Kausik Datta <kausikd@cal.interrasystems.com>
Date: Mon May 31 2004 - 06:47:07 PDT

Hi,
For the following design, what is the expected output
If we do the sign extension of r1 ( as byte is signed), the output becomes

r2 = 11111111

But if we do unsigned padding of r1 ( as it is unsigned ) the output
comes as

r2 = 00000111.

Please let me know what should be done for such type-casting.(LRM is not
clear)

Design
------
module test;

byte r2;
bit [2:0] r1;

assign r1 = 3'b111;
assign r2 = byte'(r1);

initial
begin
#1 $display("r2 = %b", r2);
end

endmodule

Thanks
Kausik
Received on Mon May 31 06:48:11 2004

This archive was generated by hypermail 2.1.8 : Mon May 31 2004 - 06:49:02 PDT