Download Handel-C Language Reference Manual
Transcript
Handel-C Language Reference Manual
4.7.5 RAM and ROM support on different devices
Creating internal RAMs can only be done if the target device supports on-chip RAMs. Most
devices currently targeted by Handel-C do so (e.g. Altera Flex 10K, APEX, APEXII,
Mercury, Stratix and Cyclone, Xilinx Spartan series devices and Virtex series devices).
No Actel families support ROMs. ProASIC and ProASIC+ devices support RAMs, but these
may not be initialized.
4.7.6 Multidimensional memory arrays
You can create simple multi-dimensional arrays of memory using the ram, rom and wom
keywords. The definitions can be made clearer by using the optional disambiguator <>.
Syntax
ram | rom | wom logicType entry_width
Name[[const_expression]] {[[const_expression]]}
[= {initialization}];
Possible logic types are ints, structs, pointers and arrays.
The last constant expression is the index for the RAM. The other indices give the number
of copies of that type of RAM.
Example
ram <int 6> a[15][43];
static rom <int 16> b[4][2][2] =
{{{1, 2},
{3, 4}
},
{{5, 6},
{7, 8}
},
{{9, 10},
{11, 12}
},
{{13, 14},
{15, 16}
}
};
This example constructs 15 RAMs, each consisting of 43 entries of 6 bits wide and 4 * 2
ROMs, each consisting of 2 entries of 16 bits wide. The ROM is initialized with the
constants in the following list in the same way as a multidimensional array would be
www.celoxica.com
Page 63