Results 1 to 4 of 4

Thread: Verillo's integer and reg?

  1. #1
    Join Date
    May 2008
    Posts
    34

    Verillo's integer and reg?

    Hi all,

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

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

    Any suggestions will be appreciated!
    Best regards,

  2. #2
    Join Date
    May 2008
    Posts
    372

    Re: Verillo's integer and reg?

    You need [at least partial] 2001 support to use "reg signed". It isn't in the 1995 standard.

    2) A variable declared integer is not necessarily exactly 32 bits wide. If I recall correctly, it must be at least 32 bits wide, but
    it could be 64 bits wide if that were more convenient to the implementation.

    3) In some implementations, I have found wierd artifacts occur when using integers in calculations that were longer that 32 bits wide,
    they didn't necessarily sign extend in consistent ways past the 32 bit length, sometimes they would sign extend and other times that
    would 0 pad.

    4) You can't do bit-selects or part-selects on integers, just on regs (and wires, et al).

    5) You shouldn't use "integer" declarations for things like flops or signals that will exist as actual circuitry (partially because of 2
    through 4). You should use integer declarations only for for look indexes and similar items that "go away" as the design is turned
    into silicon. You can use integers in non-synthesizable code, e.g. testbench parts.

    Thus, if your tools are modern and support the current standard,you should use "reg signed" when you want a synthesizable part that
    works in a signed way. If you don't have modern tools, life is more difficult.

  3. #3
    Join Date
    May 2008
    Posts
    372

    Re: Verillo's integer and reg?

    I incorrectly said:
    through 4). You should use integer declarations only for for look
    I meant:
    through 4). You should use integer declarations only for for loop
    indexes and similar items that "go away" as the design is turned

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: Verillo's integer and reg?

    Integers are always signed, and (usually, see Wingit comment) 32
    bits wide.
    Nothing, but it's often a convenience to have a signed value that is
    not 32 bits wide.

Similar Threads

  1. Integer range of CPU
    By Udyan in forum Motherboard Processor & RAM
    Replies: 6
    Last Post: 31-07-2010, 06:07 AM
  2. Convert int to Integer type
    By Angelica Maria in forum Software Development
    Replies: 5
    Last Post: 12-03-2010, 11:59 AM
  3. integer to string conversion
    By cyber-noob in forum Software Development
    Replies: 4
    Last Post: 03-03-2010, 10:26 PM
  4. Extract the integer from a string
    By New ID in forum Software Development
    Replies: 5
    Last Post: 26-02-2010, 12:31 AM
  5. How to know the length of an integer in C++
    By troop in forum Software Development
    Replies: 4
    Last Post: 29-01-2010, 09:32 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,386,511.83198 seconds with 16 queries