Re: [sv-bc] Re: Sysfunc to ask about signedness?

From: Steven Sharp <sharp_at_.....>
Date: Fri Jul 28 2006 - 11:44:39 PDT
>     `define IS_SIGNED(x) &(((((x) << $bits(x)) + 1'sb1) <<
>($bits(x)-1)) >>> $bits(x))


A simpler variation that should work also:

	`define IS_SIGNED(x) &(((x) | ~1'sb0) >>> $bits(x))

An even simpler version that should work in Verilog too:

	`define IS_SIGNED(x) (((x) | ~0) < 0)

Steven Sharp
sharp@cadence.com
Received on Fri Jul 28 11:44:43 2006

This archive was generated by hypermail 2.1.8 : Fri Jul 28 2006 - 11:44:58 PDT