Question to VHDL code fragment

Feb 08, 2008 1 Replies

Hi



I came across the following code statement, and here I wonder what does this integer'image attribute with the loc(i) mean?



This RLOC specifies where to put the stuff on an Xilinx FPGA, but I really wonder what the second part is doing. In addition, I have never come across the integer'image attribute.


INST : for i in 0 to WIDTH-1 generate attribute RLOC of u_lut : label is "R" & integer'image(loc(i)) & "C0.S1"; attribute RLOC of u_1 : label is "R" & integer'image(loc(i)) & "C0.S1"; attribute RLOC of u_2 : label is "R" & integer'image(loc(i)) & "C0.S1"; attribute RLOC of u_3 : label is "R" & integer'image(loc(i)) & "C0.S1"; attribute INIT of u_lut : label is "C66C";



thanks C


For scalar types (integer, std_logic, bit, real, time, etc.) the 'image' attribute returns a string. So integer'image(x) will return the string "123" assuming that 'x' is an integer and has the value

123.

So the code you posted is generating a set of "RLOC" attributes and building up the string representation of that by concatenating the string "R" with a string representing the integer value of 'loc(i)' and the string "C0.S1".

The image attribute doesn't work for vectors though, so you can't say std_logic_vector'image(my_slv)...in case you were wondering about that as well, even though it does not apply to the code you were wondering about.

Kevin Jennings

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required