Altera_Forum
Honored Contributor
9 years agoProgramming MAX 10 with .mif
I'm trying to program a 10M50 on the Altera Development Kit. It's programming fine, but I'm not getting the expected readout over UART (I keep getting a semi-random single number continously), so I'd like to confirm that I'm filling the RAM correctly. The RAM is a 2-port altsyncram from the IP generator, and simulates correctly.
Can anyone see if I'm doing it right? https://s30.postimg.org/4rk3103vh/programmer.png (https://postimg.org/image/4rk3103vh/) The .mif file:DEPTH = 12500; -- The size of memory in words
WIDTH = 12; -- The size of data in bits
ADDRESS_RADIX = HEX; -- The radix for address values
DATA_RADIX = HEX; -- The radix for data values
CONTENT -- start of (address : data pairs)
BEGIN
-- memory address : data
-- 1..12500
0000 : 0001;
0001 : 0002;
0002 : 0003;
0003 : 0004;
0004 : 0005;
0005 : 0006;
0006 : 0007;
0007 : 0008; And it goes on like that up to 12499. The .qsf file contains: set_global_assignment -name MIF_FILE ../source/RAM_init.mif And in Quartus, this option is selected: Assignments -> Device -> Device and Pin Options -> Configuration -> Configuration Mode: Single Uncompressed Image with Memory Initialization (512Kbits UFM) The RAM: LIBRARY ieee;USE ieee.std_logic_1164.all;
LIBRARY altera_mf;
USE altera_mf.altera_mf_components.all;
ENTITY RAM IS
PORT
(
data : IN STD_LOGIC_VECTOR (11 DOWNTO 0);
rdaddress : IN STD_LOGIC_VECTOR (13 DOWNTO 0);
rdclock : IN STD_LOGIC ;
rden : IN STD_LOGIC := '1';
wraddress : IN STD_LOGIC_VECTOR (13 DOWNTO 0);
wrclock : IN STD_LOGIC := '1';
wren : IN STD_LOGIC := '0';
q : OUT STD_LOGIC_VECTOR (11 DOWNTO 0)
);
END RAM;
ARCHITECTURE SYN OF ram IS
SIGNAL sub_wire0 : STD_LOGIC_VECTOR (11 DOWNTO 0);
BEGIN
q <= sub_wire0(11 DOWNTO 0);
altsyncram_component : altsyncram
GENERIC MAP (
address_aclr_b => "NONE",
address_reg_b => "CLOCK1",
clock_enable_input_a => "BYPASS",
clock_enable_input_b => "BYPASS",
clock_enable_output_b => "BYPASS",
init_file => "../source/RAM_init.mif",
intended_device_family => "MAX 10",
lpm_type => "altsyncram",
numwords_a => 12500,
numwords_b => 12500,
operation_mode => "DUAL_PORT",
outdata_aclr_b => "NONE",
outdata_reg_b => "CLOCK1",
power_up_uninitialized => "FALSE",
rdcontrol_reg_b => "CLOCK1",
widthad_a => 14,
widthad_b => 14,
width_a => 12,
width_b => 12,
width_byteena_a => 1
)
PORT MAP (
address_a => wraddress,
address_b => rdaddress,
clock0 => wrclock,
clock1 => rdclock,
data_a => data,
rden_b => rden,
wren_a => wren,
q_b => sub_wire0
);
END SYN; /edit: I tried the In-System Memory Content Editor, but it does not detect the RAM, which I'm thinking is a clue. https://s29.postimg.org/4e30d5lgz/memory_editor.png (https://postimg.org/image/4e30d5lgz/)