|
|
@ -14,8 +14,8 @@ entity dram_init_mem is
|
|
|
|
);
|
|
|
|
);
|
|
|
|
port (
|
|
|
|
port (
|
|
|
|
clk : in std_ulogic;
|
|
|
|
clk : in std_ulogic;
|
|
|
|
wb_in : in wb_io_master_out;
|
|
|
|
wb_in : in wb_io_master_out;
|
|
|
|
wb_out : out wb_io_slave_out
|
|
|
|
wb_out : out wb_io_slave_out
|
|
|
|
);
|
|
|
|
);
|
|
|
|
end entity dram_init_mem;
|
|
|
|
end entity dram_init_mem;
|
|
|
|
|
|
|
|
|
|
|
@ -47,27 +47,27 @@ architecture rtl of dram_init_mem is
|
|
|
|
end procedure;
|
|
|
|
end procedure;
|
|
|
|
|
|
|
|
|
|
|
|
impure function init_load_ram(name : string) return ram_t is
|
|
|
|
impure function init_load_ram(name : string) return ram_t is
|
|
|
|
file ram_file : text open read_mode is name;
|
|
|
|
file ram_file : text open read_mode is name;
|
|
|
|
variable temp_word : std_logic_vector(63 downto 0);
|
|
|
|
variable temp_word : std_logic_vector(63 downto 0);
|
|
|
|
variable temp_ram : ram_t := (others => (others => '0'));
|
|
|
|
variable temp_ram : ram_t := (others => (others => '0'));
|
|
|
|
variable ram_line : line;
|
|
|
|
variable ram_line : line;
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
report "Payload size:" & integer'image(EXTRA_PAYLOAD_SIZE) &
|
|
|
|
report "Payload size:" & integer'image(EXTRA_PAYLOAD_SIZE) &
|
|
|
|
" rounded to:" & integer'image(RND_PAYLOAD_SIZE);
|
|
|
|
" rounded to:" & integer'image(RND_PAYLOAD_SIZE);
|
|
|
|
report "Total RAM size:" & integer'image(TOTAL_RAM_SIZE) &
|
|
|
|
report "Total RAM size:" & integer'image(TOTAL_RAM_SIZE) &
|
|
|
|
" bytes using " & integer'image(INIT_RAM_ABITS) &
|
|
|
|
" bytes using " & integer'image(INIT_RAM_ABITS) &
|
|
|
|
" address bits";
|
|
|
|
" address bits";
|
|
|
|
for i in 0 to (INIT_RAM_SIZE/8)-1 loop
|
|
|
|
for i in 0 to (INIT_RAM_SIZE/8)-1 loop
|
|
|
|
exit when endfile(ram_file);
|
|
|
|
exit when endfile(ram_file);
|
|
|
|
readline(ram_file, ram_line);
|
|
|
|
readline(ram_file, ram_line);
|
|
|
|
hread(ram_line, temp_word);
|
|
|
|
hread(ram_line, temp_word);
|
|
|
|
temp_ram(i*2) := temp_word(31 downto 0);
|
|
|
|
temp_ram(i*2) := temp_word(31 downto 0);
|
|
|
|
temp_ram(i*2+1) := temp_word(63 downto 32);
|
|
|
|
temp_ram(i*2+1) := temp_word(63 downto 32);
|
|
|
|
end loop;
|
|
|
|
end loop;
|
|
|
|
if RND_PAYLOAD_SIZE /= 0 then
|
|
|
|
if RND_PAYLOAD_SIZE /= 0 then
|
|
|
|
init_load_payload(temp_ram, EXTRA_PAYLOAD_FILE);
|
|
|
|
init_load_payload(temp_ram, EXTRA_PAYLOAD_FILE);
|
|
|
|
end if;
|
|
|
|
end if;
|
|
|
|
return temp_ram;
|
|
|
|
return temp_ram;
|
|
|
|
end function;
|
|
|
|
end function;
|
|
|
|
|
|
|
|
|
|
|
|
impure function init_zero return ram_t is
|
|
|
|
impure function init_zero return ram_t is
|
|
|
@ -95,27 +95,27 @@ architecture rtl of dram_init_mem is
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
init_ram_0: process(clk)
|
|
|
|
init_ram_0: process(clk)
|
|
|
|
variable adr : integer;
|
|
|
|
variable adr : integer;
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
if rising_edge(clk) then
|
|
|
|
if rising_edge(clk) then
|
|
|
|
oack <= '0';
|
|
|
|
oack <= '0';
|
|
|
|
if (wb_in.cyc and wb_in.stb) = '1' then
|
|
|
|
if (wb_in.cyc and wb_in.stb) = '1' then
|
|
|
|
adr := to_integer((unsigned(wb_in.adr(INIT_RAM_ABITS-1 downto 2))));
|
|
|
|
adr := to_integer((unsigned(wb_in.adr(INIT_RAM_ABITS-1 downto 2))));
|
|
|
|
if wb_in.we = '0' then
|
|
|
|
if wb_in.we = '0' then
|
|
|
|
obuf <= init_ram(adr);
|
|
|
|
obuf <= init_ram(adr);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
for i in 0 to 3 loop
|
|
|
|
for i in 0 to 3 loop
|
|
|
|
if wb_in.sel(i) = '1' then
|
|
|
|
if wb_in.sel(i) = '1' then
|
|
|
|
init_ram(adr)(((i + 1) * 8) - 1 downto i * 8) <=
|
|
|
|
init_ram(adr)(((i + 1) * 8) - 1 downto i * 8) <=
|
|
|
|
wb_in.dat(((i + 1) * 8) - 1 downto i * 8);
|
|
|
|
wb_in.dat(((i + 1) * 8) - 1 downto i * 8);
|
|
|
|
end if;
|
|
|
|
end if;
|
|
|
|
end loop;
|
|
|
|
end loop;
|
|
|
|
end if;
|
|
|
|
end if;
|
|
|
|
oack <= '1';
|
|
|
|
oack <= '1';
|
|
|
|
end if;
|
|
|
|
end if;
|
|
|
|
wb_out.ack <= oack;
|
|
|
|
wb_out.ack <= oack;
|
|
|
|
wb_out.dat <= obuf;
|
|
|
|
wb_out.dat <= obuf;
|
|
|
|
end if;
|
|
|
|
end if;
|
|
|
|
end process;
|
|
|
|
end process;
|
|
|
|
|
|
|
|
|
|
|
|
wb_out.stall <= '0';
|
|
|
|
wb_out.stall <= '0';
|
|
|
|