Line 9... |
Line 9... |
--
|
--
|
-- Description : Instantiates instruction- and datamemories and the core
|
-- Description : Instantiates instruction- and datamemories and the core
|
--
|
--
|
----------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------
|
|
|
LIBRARY ieee;
|
library ieee;
|
USE ieee.std_logic_1164.ALL;
|
use ieee.std_logic_1164.all;
|
USE ieee.std_logic_unsigned.ALL;
|
use ieee.std_logic_unsigned.all;
|
|
|
LIBRARY mblite;
|
library mblite;
|
USE mblite.config_Pkg.ALL;
|
use mblite.config_Pkg.all;
|
USE mblite.core_Pkg.ALL;
|
use mblite.core_Pkg.all;
|
USE mblite.std_Pkg.ALL;
|
use mblite.std_Pkg.all;
|
|
|
ENTITY mblite_soc IS PORT
|
entity mblite_soc is port
|
(
|
(
|
sys_clk_i : IN std_logic;
|
sys_clk_i : in std_logic;
|
dbg_dmem_o_we_o : OUT std_logic;
|
dbg_dmem_o_we_o : out std_logic;
|
dbg_dmem_o_ena_o : OUT std_logic;
|
dbg_dmem_o_ena_o : out std_logic;
|
sys_rst_i : IN std_logic;
|
sys_rst_i : in std_logic;
|
sys_ena_i : IN std_logic;
|
sys_ena_i : in std_logic;
|
sys_int_i : IN std_logic;
|
sys_int_i : in std_logic;
|
dbg_dmem_o_adr_o : OUT std_logic_vector (31 DOWNTO 0);
|
dbg_dmem_o_adr_o : out std_logic_vector (31 downto 0);
|
dbg_dmem_o_dat_o : OUT std_logic_vector (31 DOWNTO 0);
|
dbg_dmem_o_dat_o : out std_logic_vector (31 downto 0);
|
dbg_dmem_o_sel_o : OUT std_logic_vector ( 3 DOWNTO 0)
|
dbg_dmem_o_sel_o : out std_logic_vector ( 3 downto 0)
|
);
|
);
|
END mblite_soc;
|
end mblite_soc;
|
|
|
ARCHITECTURE arch OF mblite_soc IS
|
architecture arch of mblite_soc is
|
|
|
COMPONENT sram_init IS GENERIC
|
component sram_init is generic
|
(
|
(
|
WIDTH : integer;
|
WIDTH : integer;
|
SIZE : integer
|
SIZE : integer
|
);
|
);
|
PORT
|
port
|
(
|
(
|
dat_o : OUT std_logic_vector(WIDTH - 1 DOWNTO 0);
|
dat_o : out std_logic_vector(WIDTH - 1 downto 0);
|
dat_i : IN std_logic_vector(WIDTH - 1 DOWNTO 0);
|
dat_i : in std_logic_vector(WIDTH - 1 downto 0);
|
adr_i : IN std_logic_vector(SIZE - 1 DOWNTO 0);
|
adr_i : in std_logic_vector(SIZE - 1 downto 0);
|
wre_i : IN std_logic;
|
wre_i : in std_logic;
|
ena_i : IN std_logic;
|
ena_i : in std_logic;
|
clk_i : IN std_logic
|
clk_i : in std_logic
|
);
|
);
|
END COMPONENT;
|
end component;
|
|
|
COMPONENT sram_4en_init IS GENERIC
|
component sram_4en_init is generic
|
(
|
(
|
WIDTH : integer;
|
WIDTH : integer;
|
SIZE : integer
|
SIZE : integer
|
);
|
);
|
PORT
|
port
|
(
|
(
|
dat_o : OUT std_logic_vector(WIDTH - 1 DOWNTO 0);
|
dat_o : out std_logic_vector(WIDTH - 1 downto 0);
|
dat_i : IN std_logic_vector(WIDTH - 1 DOWNTO 0);
|
dat_i : in std_logic_vector(WIDTH - 1 downto 0);
|
adr_i : IN std_logic_vector(SIZE - 1 DOWNTO 0);
|
adr_i : in std_logic_vector(SIZE - 1 downto 0);
|
wre_i : IN std_logic_vector(3 DOWNTO 0);
|
wre_i : in std_logic_vector(3 downto 0);
|
ena_i : IN std_logic;
|
ena_i : in std_logic;
|
clk_i : IN std_logic
|
clk_i : in std_logic
|
);
|
);
|
END COMPONENT;
|
end component;
|
|
|
SIGNAL dmem_o : dmem_out_type;
|
signal dmem_o : dmem_out_type;
|
SIGNAL imem_o : imem_out_type;
|
signal imem_o : imem_out_type;
|
SIGNAL dmem_i : dmem_in_type;
|
signal dmem_i : dmem_in_type;
|
SIGNAL imem_i : imem_in_type;
|
signal imem_i : imem_in_type;
|
|
|
SIGNAL mem_enable : std_logic;
|
signal mem_enable : std_logic;
|
SIGNAL sel_o : std_logic_vector(3 DOWNTO 0);
|
signal sel_o : std_logic_vector(3 downto 0);
|
|
|
CONSTANT std_out_adr : std_logic_vector(CFG_DMEM_SIZE - 1 DOWNTO 0) := X"FFFFFFC0";
|
constant std_out_adr : std_logic_vector(CFG_DMEM_SIZE - 1 downto 0) := X"FFFFFFC0";
|
CONSTANT rom_size : integer := 13;
|
constant rom_size : integer := 13;
|
CONSTANT ram_size : integer := 13;
|
constant ram_size : integer := 13;
|
|
|
BEGIN
|
begin
|
|
|
dbg_dmem_o_we_o <= dmem_o.we_o;
|
dbg_dmem_o_we_o <= dmem_o.we_o;
|
dbg_dmem_o_ena_o <= dmem_o.ena_o;
|
dbg_dmem_o_ena_o <= dmem_o.ena_o;
|
dbg_dmem_o_adr_o <= dmem_o.adr_o;
|
dbg_dmem_o_adr_o <= dmem_o.adr_o;
|
dbg_dmem_o_dat_o <= dmem_o.dat_o;
|
dbg_dmem_o_dat_o <= dmem_o.dat_o;
|
dbg_dmem_o_sel_o <= dmem_o.sel_o;
|
dbg_dmem_o_sel_o <= dmem_o.sel_o;
|
|
|
imem : sram GENERIC MAP
|
imem : sram generic map
|
(
|
(
|
WIDTH => CFG_IMEM_WIDTH,
|
WIDTH => CFG_IMEM_WIDTH,
|
SIZE => rom_size - 2
|
SIZE => rom_size - 2
|
)
|
)
|
PORT MAP
|
port map
|
(
|
(
|
dat_o => imem_i.dat_i,
|
dat_o => imem_i.dat_i,
|
dat_i => "00000000000000000000000000000000",
|
dat_i => "00000000000000000000000000000000",
|
adr_i => imem_o.adr_o(rom_size - 1 DOWNTO 2),
|
adr_i => imem_o.adr_o(rom_size - 1 downto 2),
|
wre_i => '0',
|
wre_i => '0',
|
ena_i => imem_o.ena_o,
|
ena_i => imem_o.ena_o,
|
clk_i => sys_clk_i
|
clk_i => sys_clk_i
|
);
|
);
|
|
|
mem_enable <= NOT sys_rst_i AND dmem_o.ena_o AND NOT compare(dmem_o.adr_o, std_out_adr);
|
mem_enable <= not sys_rst_i and dmem_o.ena_o and not compare(dmem_o.adr_o, std_out_adr);
|
sel_o <= dmem_o.sel_o WHEN dmem_o.we_o = '1' ELSE (OTHERS => '0');
|
sel_o <= dmem_o.sel_o when dmem_o.we_o = '1' else (others => '0');
|
|
|
dmem : sram_4en GENERIC MAP
|
dmem : sram_4en generic map
|
(
|
(
|
WIDTH => CFG_DMEM_WIDTH,
|
WIDTH => CFG_DMEM_WIDTH,
|
SIZE => ram_size - 2
|
SIZE => ram_size - 2
|
)
|
)
|
PORT MAP
|
port map
|
(
|
(
|
dat_o => dmem_i.dat_i,
|
dat_o => dmem_i.dat_i,
|
dat_i => dmem_o.dat_o,
|
dat_i => dmem_o.dat_o,
|
adr_i => dmem_o.adr_o(ram_size - 1 DOWNTO 2),
|
adr_i => dmem_o.adr_o(ram_size - 1 downto 2),
|
wre_i => sel_o,
|
wre_i => sel_o,
|
ena_i => mem_enable,
|
ena_i => mem_enable,
|
clk_i => sys_clk_i
|
clk_i => sys_clk_i
|
);
|
);
|
|
|
dmem_i.ena_i <= sys_ena_i;
|
dmem_i.ena_i <= sys_ena_i;
|
|
|
core0 : core PORT MAP
|
core0 : core port map
|
(
|
(
|
imem_o => imem_o,
|
imem_o => imem_o,
|
dmem_o => dmem_o,
|
dmem_o => dmem_o,
|
imem_i => imem_i,
|
imem_i => imem_i,
|
dmem_i => dmem_i,
|
dmem_i => dmem_i,
|
int_i => sys_int_i,
|
int_i => sys_int_i,
|
rst_i => sys_rst_i,
|
rst_i => sys_rst_i,
|
clk_i => sys_clk_i
|
clk_i => sys_clk_i
|
);
|
);
|
END arch;
|
|
No newline at end of file
|
No newline at end of file
|
|
end arch;
|
No newline at end of file
|
No newline at end of file
|