This website uses cookies. By using this site, you consent to the use of cookies. For more information, please take a look at our Privacy Policy.
Home > FPGA Technical Tutorials > Design Recipes for FPGAs Using Verilog and VHDL > Fixed Point Arithmetic > Fixed Point Types in Verilog

TABLE OF CONTENTS

Xilinx FPGA FPGA Forum

Fixed Point Types in Verilog

FONT SIZE : AAA

Verilog has built-in types for signed and unsigned when we define registers (reg). The default type for a reg is unsigned, and so, therefore, we can define a 16-bit unsigned integer using the following syntax:

1 reg [15:0] unsigned_integer;

It can be a little unclear as to where the decimal point occurs, and one approach to make this explicit in the declaration is to offset the array indices accordingly. For example, to use an unsigned integer of the form 8:8, the declaration could be redefined as follows:

1 reg [7:−8] unsigned_integer;

Signed integers are defined in Verilog in exactly the same manner, except using the addition of the keyword signed, so taking the previous example, the declaration would become:

1 reg signed [7:−8] signed_integer;

When using these numbers, no additional functions are required; however, care needs to be taken when shifting to ensure that the correct notation is used (i.e., that it is consistent), and the result is shifted by the appropriate number of bits to maintain the correct accuracy.

One of the nice aspects of Verilog is that it is not really necessary to define new types and conversion routines as with VHDL, and it is possible to allow Verilog to handle the conversions. For example, the low level definition of integers or fixed point data types as registers means that the conversion between the two is implicit, as long as the number of bits is consistent, making conversions very simple.

  • XC5VLX110T-1FF1738I

    Manufacturer:Xilinx

  • FPGA Virtex-5 LXT Family 110592 Cells 65nm Technology 1V 1738-Pin FCBGA
  • Product Categories: FPGAs (Field Programmable Gate Array)

    Lifecycle:Active Active

    RoHS: No RoHS

  • XC5VLX110T-1FFG1738I

    Manufacturer:Xilinx

  • FPGA Virtex-5 LXT Family 110592 Cells 65nm Technology 1V 1738-Pin FCBGA
  • Product Categories: FPGAs (Field Programmable Gate Array)

    Lifecycle:Active Active

    RoHS:

  • XCV300-4FG456C

    Manufacturer:Xilinx

  • FPGA Virtex Family 322.97K Gates 6912 Cells 250MHz 0.22um Technology 2.5V 456-Pin FBGA
  • Product Categories: FPGAs

    Lifecycle:Obsolete -

    RoHS:

  • XCV300-5BG432C

    Manufacturer:Xilinx

  • FPGA Virtex Family 322.97K Gates 6912 Cells 294MHz 0.22um Technology 2.5V 432-Pin BGA
  • Product Categories: FPGAs (Field Programmable Gate Array)

    Lifecycle:Obsolete -

    RoHS: No RoHS

  • XC2V2000-6FG676C

    Manufacturer:Xilinx

  • FPGA Virtex-II Family 2M Gates 24192 Cells 820MHz 0.15um Technology 1.5V 676-Pin FBGA
  • Product Categories:

    Lifecycle:Obsolete -

    RoHS:

Need Help?

Support

If you have any questions about the product and related issues, Please contact us.