Commit 1c362003 authored by Dimitris Lampridis's avatar Dimitris Lampridis

hdl: add generics to initialize IRAMs

parent 71f76b73
general-cores @ a50772ea
Subproject commit 1d8a2e8a31c0e5f7c6bd14a42f2251e4d4c3ecc0
Subproject commit a50772ea3d4687226fbb6339bd951137946c7ad5
......@@ -39,6 +39,7 @@ entity mt_cpu_cb is
generic (
g_CPU_ID : integer;
g_CPU_CONFIG : t_mt_cpu_config;
g_CPU_IRAM_INIT : string;
g_SYSTEM_CLOCK_FREQ : integer;
g_WITH_WHITE_RABBIT : boolean);
port (
......@@ -307,6 +308,7 @@ begin -- arch
U_TheCoreCPU : entity work.mt_urv_wrapper
generic map (
g_IRAM_SIZE => g_CPU_CONFIG.memsize,
g_IRAM_INIT => g_CPU_IRAM_INIT,
g_CPU_ID => g_CPU_ID)
port map (
clk_sys_i => clk_sys_i,
......
......@@ -34,6 +34,7 @@ use work.mt_per_cpu_csr_pkg.all;
entity mt_urv_wrapper is
generic(
g_IRAM_SIZE : integer;
g_IRAM_INIT : string;
g_CPU_ID : integer);
port(
clk_sys_i : in std_logic;
......@@ -155,7 +156,8 @@ begin
g_SIZE => g_IRAM_SIZE,
g_WITH_BYTE_ENABLE => TRUE,
g_ADDR_CONFLICT_RESOLUTION => "dont_care",
g_INIT_FILE => "",
g_INIT_FILE => g_IRAM_INIT,
g_FAIL_IF_FILE_NOT_FOUND => FALSE,
g_DUAL_CLOCK => FALSE)
port map (
rst_n_i => rst_n_i,
......
......@@ -42,6 +42,17 @@ entity mock_turtle_core is
g_CONFIG : t_mt_config := c_DEFAULT_MT_CONFIG;
-- Frequency of clk_i, in Hz
g_SYSTEM_CLOCK_FREQ : integer := 62500000;
-- Optional instruction memory init files. Unfortunately prior to VHDL2008,
-- strings are not allowed within records, otherwise these could be embedded
-- in g_CONFIG.cpu_config.
g_CPU0_IRAM_INITF : string := "none";
g_CPU1_IRAM_INITF : string := "none";
g_CPU2_IRAM_INITF : string := "none";
g_CPU3_IRAM_INITF : string := "none";
g_CPU4_IRAM_INITF : string := "none";
g_CPU5_IRAM_INITF : string := "none";
g_CPU6_IRAM_INITF : string := "none";
g_CPU7_IRAM_INITF : string := "none";
-- Enables/disables WR support
g_WITH_WHITE_RABBIT : boolean := FALSE);
port (
......@@ -73,9 +84,23 @@ end mock_turtle_core;
architecture arch of mock_turtle_core is
------------------------------------------
-- CONSTANTS DECLARATION
------------------------------------------
-- Not elegant at all. Unfortunately, prior to VHDL2008, strings are not allowed
-- within records, otherwise these could be embedded in g_CONFIG.cpu_config.
function f_mt_cpu_iram_init_pick(idx : integer)
return string is
begin
case idx is
when 0 => return g_CPU0_IRAM_INITF;
when 1 => return g_CPU1_IRAM_INITF;
when 2 => return g_CPU2_IRAM_INITF;
when 3 => return g_CPU3_IRAM_INITF;
when 4 => return g_CPU4_IRAM_INITF;
when 5 => return g_CPU5_IRAM_INITF;
when 6 => return g_CPU6_IRAM_INITF;
when 7 => return g_CPU7_IRAM_INITF;
when others => return "none";
end case;
end function f_mt_cpu_iram_init_pick;
constant c_SMEM_REMAP_BASE_IN : t_wishbone_address_array(0 to 2) := (
0 => x"00000000",
......@@ -369,6 +394,7 @@ begin -- arch
generic map (
g_CPU_ID => i,
g_CPU_CONFIG => c_CFG,
g_CPU_IRAM_INIT => f_mt_cpu_iram_init_pick(i),
g_WITH_WHITE_RABBIT => g_WITH_WHITE_RABBIT,
g_SYSTEM_CLOCK_FREQ => g_SYSTEM_CLOCK_FREQ)
port map (
......
......@@ -144,6 +144,14 @@ package mock_turtle_pkg is
generic (
g_CONFIG : t_mt_config := c_DEFAULT_MT_CONFIG;
g_SYSTEM_CLOCK_FREQ : integer := 62500000;
g_CPU0_IRAM_INITF : string := "none";
g_CPU1_IRAM_INITF : string := "none";
g_CPU2_IRAM_INITF : string := "none";
g_CPU3_IRAM_INITF : string := "none";
g_CPU4_IRAM_INITF : string := "none";
g_CPU5_IRAM_INITF : string := "none";
g_CPU6_IRAM_INITF : string := "none";
g_CPU7_IRAM_INITF : string := "none";
g_WITH_WHITE_RABBIT : boolean := FALSE);
port (
clk_i : in std_logic;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment