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 > Learning FPGAs > Lucid Reference > Array Size and Bit Selection

Array Size and Bit Selection

FONT SIZE : AAA

Array sizes are used when declaring many types in Lucid to turn them into arrays. Bit selection is used to index the various elements inside an array.

Array Size

Array sizes are pretty simple and take the following form:

('[' expr ']')*

Here expr is an expression, but it must have a value that can be determined at synthesis time.

If no sizes are specified, the type is assumed to be 1 bit or one instance. For each size specified, the array will get another dimension. For example, something declared with [4][8] would be considered a 4 x 8 two-dimensional array.

Bit Selectors

Bit selectors are used to index into arrays. The most basic kind, simple indices, select a single element from the array. The more complex constant bit and fixed-width bit selectors allow selection of multiple elements.

When indexing into a multidimensional array, only the last index can be a constant bit selector or a fixed-width bit selectors. Every other index must be a simple array index.

Array index

The array index is the simplest form of indexing into an array. It selects a single ele‐ ment and takes the following form:

'[' expr ']'

Here expr is an expression. When indexing into a multidimensional array, the first index specified will index into the leftmost dimension when the array was declared. For example, sig mySig[4][7] can be indexed later with mySig[3]. This will have a width of 7. To index to a single bit, you could use mySig[3][6].

Constant bit selector

Constant bit selectors allow you to select everything between a fixed start and stop indices. It takes the following form:

'[' expr ':' expr ']'

Both expr elements are expressions, but they both must be constant values that can be determined at synthesis time.

The first expr must be greater or equal to the second expr in value. These specify an inclusive range to select from the array.

Fixed-width bit selector

The fixed-width bit selector allows you to specify a start index and the number of elements to select above or below that index. The benefit of this over the constant index selector is that the start index doesn’t need to be a constant value.

It takes the following form:

'[' expr ('+'|'-') ':' expr ']'

Again, both expr elements are expressions. The first expr is the starting index. The second expr is the number of elements to select. If the selector uses the + symbol, it selects that many elements above the starting index. If it is a - symbol, it selects that many elements below the starting index. The starting index itself is always included. 

  • XC2C64A-7VQ44C

    Manufacturer:Xilinx

  • CPLD CoolRunner -II Family 1.5K Gates 64 Macro Cells 159MHz 0.18um Technology 1.8V 44-Pin VQFP
  • Product Categories: CPLDs

    Lifecycle:Active Active

    RoHS: No RoHS

  • XC3064-125PC84C

    Manufacturer:Xilinx

  • FPGA XC3000 Family 4.5K Gates 224 Cells 125MHz 5V 84-Pin PLCC
  • Product Categories:

    Lifecycle:Obsolete -

    RoHS: No RoHS

  • XCV200-6FG256C

    Manufacturer:Xilinx

  • FPGA Virtex Family 236.666K Gates 5292 Cells 333MHz 0.22um Technology 2.5V 256-Pin FBGA
  • Product Categories: Socle de fusible

    Lifecycle:Obsolete -

    RoHS:

  • XC4028XL-2HQ160I

    Manufacturer:Xilinx

  • FPGA XC4000X Family 28K Gates 2432 Cells 0.35um Technology 3.3V 160-Pin HSPQFP EP
  • Product Categories: Contrôlleur 32 Bit

    Lifecycle:Obsolete -

    RoHS: No RoHS

  • XC5VFX130T-1FFG1738I

    Manufacturer:Xilinx

  • FPGA Virtex-5 FXT Family 65nm Technology 1V 1738-Pin FCBGA
  • Product Categories: Contrôleur logique

    Lifecycle:Active Active

    RoHS:

Need Help?

Support

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