We can define unsigned integer like these:

typedef bit[4:0] int5; // 5 bits unsigned integer
typedef bit[3:0] int4; // 4 bits unsigned integer

How to define type for signed integer?

e.g. 6 bits signed integer range from -32 to +31

typedef bit[5:0] signed int6signed; // doesn't work

You have the signed keyword in the wrong spot. It should be

typedef bit signed [5:0] int6signed; 
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.