Xilinx VHDL multidimensional array synthesis

Jul 25, 2007 5 Replies

Hello,



I was working on a video font which I initially did as a 2 dimensional array of std_logic_vectors, one dimension for the bit output, and the other for the character and row selection. I suppose



3 dimensions may have also been an option.

The simulation ran fine. The synthesis, however, took a long time, and I discovered that the tool (I still use ISE7.1) had synthesized the font in slices rather than a BRAM, which I originally intended.



I vaguely remember reading that the synthesis tool will not synthesize multidimensional arrays into BRAM. Is this correct?



In the case of my font, I was able to convert it easily into a single dimensional array of std_logic but I am concerned that in the future that may not be a clean looking VHDL solution.



Thanks,



Brad Smallridge AiVision


The basic requirement to infer a bram is a clocked process with no reset. In other words the inference failure may or may not have to do with array dimensions. A simple array like this does work as expected:

ram_access : process (clk) is begin if rising_edge(clk) then if we = '1' then mem(to_integer(push_tail_ptr))

Hmm. I do remember taking a reset out of the code. I'll have to check to see if that was before or after I flattened the

2D array.

Thanks.

Hello Mike, No. The reset wasn't the problem. Here is the code:

library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all;

entity message is port( clk : in std_logic; row : in std_logic_vector(4 downto 0); col : in std_logic_vector(5 downto 0); char : out std_logic_vector(6 downto 0) ); end message;

architecture beh of message is

type message_type is array( 0 to 31 , 0 to 63) of character; constant message : message_type :=( " 0 ABCDEFGHIJKLMNOPQRSTUVWXYZ -------------------------------- 0", " 1 ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 ----------------- 1", " 2 2", " 3 VERSION ai\ntsc\n60 ____________ ----- 3", " 4 4", " 5 abcdefghijklmnopqrstuvwxyz 5", " 6 !@#$%^&*()_+{}:?~ AND HOW DO I DO DOUBLE QUOTE? 6", " 7 -=;',./` 7", " 8 8", " 9 BRAD SMALLRIDGE 9", "10 (c)2007 AiVision 10", "11 11", "12 12", "13 13", "14 14", "15 3456789012345678901234567890123456789012345678901234567890 15", "16 16", "17 17", "18 18", "19 19", "20 20", "21 21", "22 22", "23 3456789012345678901234567890123456789012345678901234567890 23", "24 24", "25 25", "26 26", "27 27", "28 28", "29 29", "30 30", "31 3456789012345678901234567890123456789012345678901234567890 31" );

begin

msg_proc: process(clk) variable pointer : natural; variable char_val : character; variable char_pos : natural; variable m : integer; variable n : integer;

begin if(clk'event and clk='1') then -- 2D array simulated OK but the synthesizer does not BRAM it m := to_integer(unsigned(row)); n := to_integer(unsigned(col)); char_val := message(m,n); -- Flattened -- in constant message, change the ending commas to ampersands -- pointer := to_integer(unsigned(row))*64 + to_integer(unsigned(col)); -- char_val := message( pointer ); char_pos := character'pos(char_val); char

Can't help with the BRAM, but if you still need a double quote, you need to double the double quote:

" 6 !@#$%^&*()_+{}:?~ ""

A bram requires a control for write enable.

-- Mike Treseler

Join the Discussion

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

Didn't find your answer?

Ask the community — no account required