RE: [sv-bc] Clarify -- Type casting issue]

From: Brad Pierce <Brad.Pierce@synopsys.com>
Date: Tue Jun 22 2004 - 08:48:51 PDT

According to

    http://www.eda.org/sv-bc/display_issue.cgi?issue_num=38

the following two statements have identical results

      typeA A = expr;
      typeA A = typeA'(expr);

So
      assign r2 = byte'(r1);

has the same result as

      assign r2 = r1 ;

so r2 gets 00000111.

-- Brad

-----Original Message-----
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org]On Behalf Of
Vassilios.Gerousis@Infineon.Com
Sent: Tuesday, June 22, 2004 1:49 AM
To: sv-bc@eda.org
Cc: kausikd@cal.interrasystems.com
Subject: [sv-bc] Clarify -- Type casting issue]

Could someone answer this please!

Thanks
-------- Original Message --------
Subject: [sv-ec] Type casting issue
Date: Mon, 31 May 2004 19:17:07 +0530
From: Kausik Datta <kausikd@cal.interrasystems.com>
Reply-To: kausikd@cal.interrasystems.com
Organization: Interra Systems India Pvt. Ltd.
To: sv-ec@eda.org, sv-ac@eda.org

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 Tue Jun 22 08:48:54 2004

This archive was generated by hypermail 2.1.8 : Tue Jun 22 2004 - 08:50:34 PDT