OpenCores
URL https://opencores.org/ocsvn/mblite/mblite/trunk

Subversion Repositories mblite

[/] [mblite/] [trunk/] [designs/] [core_syn/] [mblite_soc.vhd] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 takar
----------------------------------------------------------------------------------------------
2
--
3
--      Input file         : config_Pkg.vhd
4
--      Design name        : config_Pkg
5
--      Author             : Tamar Kranenburg
6
--      Company            : Delft University of Technology
7
--                         : Faculty EEMCS, Department ME&CE
8
--                         : Systems and Circuits group
9
--
10
--      Description        : Instantiates instruction- and datamemories and the core
11
--
12
----------------------------------------------------------------------------------------------
13
 
14
LIBRARY ieee;
15
USE ieee.std_logic_1164.ALL;
16
USE ieee.std_logic_unsigned.ALL;
17
 
18
LIBRARY mblite;
19
USE mblite.config_Pkg.ALL;
20
USE mblite.core_Pkg.ALL;
21
USE mblite.std_Pkg.ALL;
22
 
23
ENTITY mblite_soc IS PORT
24
(
25
    sys_clk_i : IN std_ulogic;
26
    dbg_dmem_o_we_o : OUT std_ulogic;
27
    dbg_dmem_o_ena_o : OUT std_ulogic;
28
    sys_rst_i : IN std_ulogic;
29
    sys_ena_i : IN std_ulogic;
30
    sys_int_i : IN std_ulogic;
31
    dbg_dmem_o_adr_o : OUT std_ulogic_vector (31 DOWNTO 0);
32
    dbg_dmem_o_dat_o : OUT std_ulogic_vector (31 DOWNTO 0);
33
    dbg_dmem_o_sel_o : OUT std_ulogic_vector ( 3 DOWNTO 0)
34
);
35
END mblite_soc;
36
 
37
ARCHITECTURE arch OF mblite_soc IS
38
 
39
    COMPONENT sram_init IS GENERIC
40
    (
41
        WIDTH : integer;
42
        SIZE  : integer
43
    );
44
    PORT
45
    (
46
        dat_o : OUT std_ulogic_vector(WIDTH - 1 DOWNTO 0);
47
        dat_i : IN std_ulogic_vector(WIDTH - 1 DOWNTO 0);
48
        adr_i : IN std_ulogic_vector(SIZE - 1 DOWNTO 0);
49
        wre_i : IN std_ulogic;
50
        ena_i : IN std_ulogic;
51
        clk_i : IN std_ulogic
52
    );
53
    END COMPONENT;
54
 
55
    COMPONENT sram_4en_init IS GENERIC
56
    (
57
        WIDTH : integer;
58
        SIZE  : integer
59
    );
60
    PORT
61
    (
62
        dat_o : OUT std_ulogic_vector(WIDTH - 1 DOWNTO 0);
63
        dat_i : IN std_ulogic_vector(WIDTH - 1 DOWNTO 0);
64
        adr_i : IN std_ulogic_vector(SIZE - 1 DOWNTO 0);
65
        wre_i : IN std_ulogic_vector(3 DOWNTO 0);
66
        ena_i : IN std_ulogic;
67
        clk_i : IN std_ulogic
68
    );
69
    END COMPONENT;
70
 
71
    SIGNAL dmem_o : dmem_out_type;
72
    SIGNAL imem_o : imem_out_type;
73
    SIGNAL dmem_i : dmem_in_type;
74
    SIGNAL imem_i : imem_in_type;
75
 
76
    SIGNAL mem_enable : std_ulogic;
77
    SIGNAL sel_o : std_ulogic_vector(3 DOWNTO 0);
78
 
79
    CONSTANT std_out_adr : std_ulogic_vector(CFG_DMEM_SIZE - 1 DOWNTO 0) := X"FFFFFFC0";
80
    CONSTANT rom_size : integer := 13;
81
    CONSTANT ram_size : integer := 13;
82
 
83
BEGIN
84
 
85
    dbg_dmem_o_we_o  <= dmem_o.we_o;
86
    dbg_dmem_o_ena_o <= dmem_o.ena_o;
87
    dbg_dmem_o_adr_o <= dmem_o.adr_o;
88
    dbg_dmem_o_dat_o <= dmem_o.dat_o;
89
    dbg_dmem_o_sel_o <= dmem_o.sel_o;
90
 
91
    imem : sram GENERIC MAP
92
    (
93
        WIDTH => CFG_IMEM_WIDTH,
94
        SIZE => rom_size - 2
95
    )
96
    PORT MAP
97
    (
98
        dat_o => imem_i.dat_i,
99
        dat_i => "00000000000000000000000000000000",
100
        adr_i => imem_o.adr_o(rom_size - 1 DOWNTO 2),
101
        wre_i => '0',
102
        ena_i => imem_o.ena_o,
103
        clk_i => sys_clk_i
104
    );
105
 
106
    mem_enable <= NOT sys_rst_i AND dmem_o.ena_o AND NOT compare(dmem_o.adr_o, std_out_adr);
107
    sel_o <= dmem_o.sel_o WHEN dmem_o.we_o = '1' ELSE (OTHERS => '0');
108
 
109
    dmem : sram_4en GENERIC MAP
110
    (
111
        WIDTH => CFG_DMEM_WIDTH,
112
        SIZE => ram_size - 2
113
    )
114
    PORT MAP
115
    (
116
        dat_o => dmem_i.dat_i,
117
        dat_i => dmem_o.dat_o,
118
        adr_i => dmem_o.adr_o(ram_size - 1 DOWNTO 2),
119
        wre_i => sel_o,
120
        ena_i => mem_enable,
121
        clk_i => sys_clk_i
122
    );
123
 
124
    dmem_i.ena_i <= sys_ena_i;
125
 
126
    core0 : core PORT MAP
127
    (
128
        imem_o => imem_o,
129
        dmem_o => dmem_o,
130
        imem_i => imem_i,
131
        dmem_i => dmem_i,
132
        int_i  => sys_int_i,
133
        rst_i  => sys_rst_i,
134
        clk_i  => sys_clk_i
135
    );
136
END arch;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.