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

Subversion Repositories mblite

[/] [mblite/] [trunk/] [hw/] [core/] [core.vhd] - Blame information for rev 6

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

Line No. Rev Author Line
1 2 takar
----------------------------------------------------------------------------------------------
2
--
3
--      Input file         : core.vhd
4
--      Design name        : core
5
--      Author             : Tamar Kranenburg
6
--      Company            : Delft University of Technology
7
--                         : Faculty EEMCS, Department ME&CE
8
--                         : Systems and Circuits group
9
--
10
--      Description        : Top level entity of the integer unit
11
--
12
--
13
----------------------------------------------------------------------------------------------
14
 
15
LIBRARY ieee;
16
USE ieee.std_logic_1164.ALL;
17
USE ieee.std_logic_unsigned.ALL;
18
 
19
LIBRARY mblite;
20
USE mblite.config_Pkg.ALL;
21
USE mblite.core_Pkg.ALL;
22
 
23
ENTITY core IS GENERIC
24
(
25
    G_INTERRUPT  : boolean := CFG_INTERRUPT;
26
    G_USE_HW_MUL : boolean := CFG_USE_HW_MUL;
27
    G_USE_BARREL : boolean := CFG_USE_BARREL;
28
    G_DEBUG      : boolean := CFG_DEBUG
29
);
30
PORT
31
(
32
    imem_o : OUT imem_out_type;
33
    dmem_o : OUT dmem_out_type;
34
    imem_i : IN imem_in_type;
35
    dmem_i : IN dmem_in_type;
36 6 takar
    int_i  : IN std_logic;
37
    rst_i  : IN std_logic;
38
    clk_i  : IN std_logic
39 2 takar
);
40
END core;
41
 
42
ARCHITECTURE arch OF core IS
43
 
44
    SIGNAL fetch_i : fetch_in_type;
45
    SIGNAL fetch_o : fetch_out_type;
46
 
47
    SIGNAL decode_i : decode_in_type;
48
    SIGNAL decode_o : decode_out_type;
49
 
50
    SIGNAL gprf_o : gprf_out_type;
51
 
52
    SIGNAL exec_i : execute_in_type;
53
    SIGNAL exec_o : execute_out_type;
54
 
55
    SIGNAL mem_i : mem_in_type;
56
    SIGNAL mem_o : mem_out_type;
57
 
58 6 takar
    SIGNAL ena_i : std_logic;
59 2 takar
 
60
BEGIN
61
 
62
    ena_i <= dmem_i.ena_i;
63
 
64
    fetch_i.hazard        <= decode_o.hazard;
65
    fetch_i.branch        <= exec_o.branch;
66
    fetch_i.branch_target <= exec_o.alu_result(CFG_IMEM_SIZE - 1 DOWNTO 0);
67
 
68
    fetch0 : fetch PORT MAP
69
    (
70
        fetch_o => fetch_o,
71
        imem_o  => imem_o,
72
        fetch_i => fetch_i,
73
        rst_i   => rst_i,
74
        ena_i   => ena_i,
75
        clk_i   => clk_i
76
    );
77
 
78
    decode_i.program_counter   <= fetch_o.program_counter;
79
    decode_i.instruction       <= imem_i.dat_i;
80
    decode_i.ctrl_wb           <= mem_o.ctrl_wb;
81
    decode_i.ctrl_mem_wb       <= mem_o.ctrl_mem_wb;
82
    decode_i.mem_result        <= dmem_i.dat_i;
83
    decode_i.alu_result        <= mem_o.alu_result;
84
    decode_i.interrupt         <= int_i;
85
    decode_i.flush_id          <= exec_o.flush_id;
86
 
87
    decode0: decode GENERIC MAP
88
    (
89
        G_INTERRUPT  => G_INTERRUPT,
90
        G_USE_HW_MUL => G_USE_HW_MUL,
91
        G_USE_BARREL => G_USE_BARREL,
92
        G_DEBUG      => G_DEBUG
93
    )
94
    PORT MAP
95
    (
96
        decode_o => decode_o,
97
        decode_i => decode_i,
98
        gprf_o   => gprf_o,
99
        ena_i    => ena_i,
100
        rst_i    => rst_i,
101
        clk_i    => clk_i
102
    );
103
 
104
    exec_i.fwd_dec              <= decode_o.fwd_dec;
105
    exec_i.fwd_dec_result       <= decode_o.fwd_dec_result;
106
 
107
    exec_i.dat_a                <= gprf_o.dat_a_o;
108
    exec_i.dat_b                <= gprf_o.dat_b_o;
109
    exec_i.dat_d                <= gprf_o.dat_d_o;
110
    exec_i.reg_a                <= decode_o.reg_a;
111
    exec_i.reg_b                <= decode_o.reg_b;
112
 
113
    exec_i.imm                  <= decode_o.imm;
114
    exec_i.program_counter      <= decode_o.program_counter;
115
    exec_i.ctrl_wb              <= decode_o.ctrl_wb;
116
    exec_i.ctrl_mem             <= decode_o.ctrl_mem;
117
    exec_i.ctrl_ex              <= decode_o.ctrl_ex;
118
 
119
    exec_i.fwd_mem              <= mem_o.ctrl_wb;
120
    exec_i.mem_result           <= dmem_i.dat_i;
121
    exec_i.alu_result           <= mem_o.alu_result;
122
    exec_i.ctrl_mem_wb          <= mem_o.ctrl_mem_wb;
123
 
124
    execute0 : execute GENERIC MAP
125
    (
126
        G_USE_HW_MUL => G_USE_HW_MUL,
127
        G_USE_BARREL => G_USE_BARREL
128
    )
129
    PORT MAP
130
    (
131
        exec_o => exec_o,
132
        exec_i => exec_i,
133
        ena_i  => ena_i,
134
        rst_i  => rst_i,
135
        clk_i  => clk_i
136
    );
137
 
138
    mem_i.alu_result      <= exec_o.alu_result;
139
    mem_i.program_counter <= exec_o.program_counter;
140
    mem_i.branch          <= exec_o.branch;
141
    mem_i.dat_d           <= exec_o.dat_d;
142
    mem_i.ctrl_wb         <= exec_o.ctrl_wb;
143
    mem_i.ctrl_mem        <= exec_o.ctrl_mem;
144
    mem_i.mem_result      <= dmem_i.dat_i;
145
 
146
    mem0 : mem PORT MAP
147
    (
148
        mem_o  => mem_o,
149
        dmem_o => dmem_o,
150
        mem_i  => mem_i,
151
        ena_i  => ena_i,
152
        rst_i  => rst_i,
153
        clk_i  => clk_i
154
    );
155
 
156
END arch;

powered by: WebSVN 2.1.0

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