Altera_Forum
Honored Contributor
13 years agohow to pass a file name in a generate loop
Hi,
I need to instantiate the same module many times, so I'm using a for-generate loop. Each time, however, I've to pass to the module a different file name as a GENERIC to initialize a rom inside the module. The file name is function of the i parameter in the generate loop ... so I wrote this code in quartus (vhdl 2008) but I get errors ... can you help to write it in the right way ? ENGINES : -- engine instantiation for i in 0 to ENGINES_NUMBER-1 generate variable mystringnumber: string (1 to 4); variable romfile: string (1 to 30); begin mystringnumber := (to_string(i)); romfile := ("./roms/weight_lay0_engine" & mystringnumber & ".hex"); ENGINE_inst : entity work.engine GENERIC MAP (ENGINE_WEIGHT_FILE => romfile) PORT MAP (CLOCK => CLOCK, RESET => RESET, HITDATA => HITDATA, ACC => ACC_ENG(i), INTER_X => ENGINE1_INTER_X, INTER_Y => ENGINE1_INTER_Y); end generate ENGINES; thanks franco