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

Subversion Repositories mblite

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

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 8 takar
library ieee;
16
use ieee.std_logic_1164.all;
17
use ieee.std_logic_unsigned.all;
18 2 takar
 
19 8 takar
library mblite;
20
use mblite.config_Pkg.all;
21
use mblite.core_Pkg.all;
22 2 takar
 
23 8 takar
entity core is generic
24 2 takar
(
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 8 takar
port
31 2 takar
(
32 8 takar
    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
    int_i  : in std_logic;
37
    rst_i  : in std_logic;
38
    clk_i  : in std_logic
39 2 takar
);
40 8 takar
end core;
41 2 takar
 
42 8 takar
architecture arch of core is
43 2 takar
 
44 8 takar
    signal fetch_i : fetch_in_type;
45
    signal fetch_o : fetch_out_type;
46 2 takar
 
47 8 takar
    signal decode_i : decode_in_type;
48
    signal decode_o : decode_out_type;
49 2 takar
 
50 8 takar
    signal gprf_o : gprf_out_type;
51 2 takar
 
52 8 takar
    signal exec_i : execute_in_type;
53
    signal exec_o : execute_out_type;
54 2 takar
 
55 8 takar
    signal mem_i : mem_in_type;
56
    signal mem_o : mem_out_type;
57 2 takar
 
58 8 takar
    signal ena_i : std_logic;
59 2 takar
 
60 8 takar
begin
61 2 takar
 
62
    ena_i <= dmem_i.ena_i;
63
 
64
    fetch_i.hazard        <= decode_o.hazard;
65
    fetch_i.branch        <= exec_o.branch;
66 8 takar
    fetch_i.branch_target <= exec_o.alu_result(CFG_IMEM_SIZE - 1 downto 0);
67 2 takar
 
68 8 takar
    fetch0 : fetch port map
69 2 takar
    (
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 8 takar
    decode_i.ctrl_wrb          <= mem_o.ctrl_wrb;
81
    decode_i.ctrl_mem_wrb      <= mem_o.ctrl_mem_wrb;
82 2 takar
    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 8 takar
    decode0: decode generic map
88 2 takar
    (
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 8 takar
    port map
95 2 takar
    (
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 8 takar
    exec_i.ctrl_wrb             <= decode_o.ctrl_wrb;
116 2 takar
    exec_i.ctrl_mem             <= decode_o.ctrl_mem;
117
    exec_i.ctrl_ex              <= decode_o.ctrl_ex;
118
 
119 8 takar
    exec_i.fwd_mem              <= mem_o.ctrl_wrb;
120 2 takar
    exec_i.mem_result           <= dmem_i.dat_i;
121
    exec_i.alu_result           <= mem_o.alu_result;
122 8 takar
    exec_i.ctrl_mem_wrb         <= mem_o.ctrl_mem_wrb;
123 2 takar
 
124 8 takar
    execute0 : execute generic map
125 2 takar
    (
126
        G_USE_HW_MUL => G_USE_HW_MUL,
127
        G_USE_BARREL => G_USE_BARREL
128
    )
129 8 takar
    port map
130 2 takar
    (
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 8 takar
    mem_i.ctrl_wrb        <= exec_o.ctrl_wrb;
143 2 takar
    mem_i.ctrl_mem        <= exec_o.ctrl_mem;
144
    mem_i.mem_result      <= dmem_i.dat_i;
145
 
146 8 takar
    mem0 : mem port map
147 2 takar
    (
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 8 takar
end arch;

powered by: WebSVN 2.1.0

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