Forum Discussion
Altera_Forum
Honored Contributor
8 years agoHow different are the init files? Are they mostly the same with a few bytes different that could be handled at startup? If not, I think what kaz is suggesting is to look into the file the Wizard generates and modify it. For example, I used the wizard to generate a RAM called ram_test and in the directory chosen for the core it created a file called ram_test.vhd which acts as a wrapper for the altsyncram megafunction on line 46:
-- megafunction wizard: %RAM: 1-PORT%
-- GENERATION: STANDARD
-- VERSION: WM1.0
-- MODULE: altsyncram
-- ============================================================
-- File Name: ram_test.vhd
-- Megafunction Name(s):
-- altsyncram
--
-- Simulation Library Files(s):
-- altera_mf
-- ============================================================
-- ************************************************************
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
--
-- 16.1.2 Build 203 01/18/2017 SJ Standard Edition
-- ************************************************************
LIBRARY ieee;
USE ieee.std_logic_1164.all;
LIBRARY altera_mf;
USE altera_mf.altera_mf_components.all;
ENTITY ram_test IS
PORT
(
address : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
clock : IN STD_LOGIC := '1';
data : IN STD_LOGIC_VECTOR (12 DOWNTO 0);
wren : IN STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (12 DOWNTO 0)
);
END ram_test;
ARCHITECTURE SYN OF ram_test IS
SIGNAL sub_wire0 : STD_LOGIC_VECTOR (12 DOWNTO 0);
BEGIN
q <= sub_wire0(12 DOWNTO 0);
altsyncram_component : altsyncram
GENERIC MAP (
clock_enable_input_a => "BYPASS",
clock_enable_output_a => "BYPASS",
init_file => "./cores/rom_test_001.mif",
intended_device_family => "MAX 10",
lpm_hint => "ENABLE_RUNTIME_MOD=NO",
lpm_type => "altsyncram",
numwords_a => 256,
operation_mode => "SINGLE_PORT",
outdata_aclr_a => "NONE",
outdata_reg_a => "CLOCK0",
power_up_uninitialized => "FALSE",
read_during_write_mode_port_a => "NEW_DATA_NO_NBE_READ",
widthad_a => 8,
width_a => 13,
width_byteena_a => 1
)
PORT MAP (
address_a => address,
clock0 => clock,
data_a => data,
wren_a => wren,
q_a => sub_wire0
);
END SYN;
On line 50 there is a generic named init_file mapped to the hardwired string "./cores/rom_test_001.mif" I chose in the wizard. You need to modify their wrapper so ram_test entity has a generic init_file string variable that you can set in a generate loop in you main code. That's alot of files though.