Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Verilog's integer and reg?

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
Hi all,

I heard that Verilog has integer type.
Someone said integer can be signed or unsigned.
How to declare signed integer?

And what's the difference with integer and reg signed [31:0](2's complement) ?

Any suggestions will be appreciated!
Best regards,
Davy
 

I guess you cannt specifically declare signed or unsigned integer as in C language. THe value will be stored as signed when you declare integer. there is no difference between reg [31:0] and integer for synthesis.
 

integer is signed 32 bit.

the difference between signed reg 32 bit and integer...

I was told that for integer, if the value reach the maximum, e.g. 32'h7FFF_FFFF, no matter what value u add in, the value will remain as 32'h7FFF_FFFF.

but for signed reg, if u add 1 for 32'h7FFF_FFFF, the value will go to 32'h0000_0000.

I have no time to verify that. Tell me if you have verified that :)
 

    davyzhu

    Points: 2
    Helpful Answer Positive Rating
integer will roll to 0 when overflow,same as reg, it can be used in compare expression,like (i<-1).
 

davyzhu said:
Hi all,

I heard that Verilog has integer type.
Someone said integer can be signed or unsigned.
How to declare signed integer?

And what's the difference with integer and reg signed [31:0](2's complement) ?

Any suggestions will be appreciated!
Best regards,
Davy

Please see the Verilog-2001 spec.

Thomson
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top