2 use ieee.std_logic_1164.all;
3 use ieee.numeric_std.all;
7 use work.wishbone_types.all;
11 SIM : boolean := false
17 wishbone_insn_in : in wishbone_slave_out;
18 wishbone_insn_out : out wishbone_master_out;
20 wishbone_data_in : in wishbone_slave_out;
21 wishbone_data_out : out wishbone_master_out;
23 -- Added for debug, ghdl doesn't support external names unfortunately
24 registers : out regfile;
25 terminate_out : out std_ulogic
29 architecture behave of core is
31 signal fetch1_to_fetch2: Fetch1ToFetch2Type;
32 signal fetch2_to_decode1: Fetch2ToDecode1Type;
35 signal fetch2_to_icache : Fetch2ToIcacheType;
36 signal icache_to_fetch2 : IcacheToFetch2Type;
39 signal decode1_to_decode2: Decode1ToDecode2Type;
40 signal decode2_to_execute1: Decode2ToExecute1Type;
42 -- register file signals
43 signal register_file_to_decode2: RegisterFileToDecode2Type;
44 signal decode2_to_register_file: Decode2ToRegisterFileType;
45 signal writeback_to_register_file: WritebackToRegisterFileType;
48 signal decode2_to_cr_file: Decode2ToCrFileType;
49 signal cr_file_to_decode2: CrFileToDecode2Type;
50 signal writeback_to_cr_file: WritebackToCrFileType;
53 signal execute1_to_execute2: Execute1ToExecute2Type;
54 signal execute2_to_writeback: Execute2ToWritebackType;
55 signal execute1_to_fetch1: Execute1ToFetch1Type;
58 signal decode2_to_loadstore1: Decode2ToLoadstore1Type;
59 signal loadstore1_to_loadstore2: Loadstore1ToLoadstore2Type;
60 signal loadstore2_to_writeback: Loadstore2ToWritebackType;
63 signal decode2_to_multiply: Decode2ToMultiplyType;
64 signal multiply_to_writeback: MultiplyToWritebackType;
67 signal fetch1_stall_in : std_ulogic;
68 signal fetch2_stall_in : std_ulogic;
69 signal fetch2_stall_out : std_ulogic;
70 signal decode1_stall_in : std_ulogic;
71 signal decode2_stall_out : std_ulogic;
73 signal flush: std_ulogic;
75 signal complete: std_ulogic;
77 signal terminate: std_ulogic;
80 terminate_out <= terminate;
82 fetch1_0: entity work.fetch1
84 RESET_ADDRESS => (others => '0')
89 stall_in => fetch1_stall_in,
91 e_in => execute1_to_fetch1,
92 f_out => fetch1_to_fetch2
95 fetch1_stall_in <= fetch2_stall_out or decode2_stall_out;
97 fetch2_0: entity work.fetch2
101 stall_in => fetch2_stall_in,
102 stall_out => fetch2_stall_out,
104 i_in => icache_to_fetch2,
105 i_out => fetch2_to_icache,
106 f_in => fetch1_to_fetch2,
107 f_out => fetch2_to_decode1
110 fetch2_stall_in <= decode2_stall_out;
112 icache_0: entity work.icache
120 i_in => fetch2_to_icache,
121 i_out => icache_to_fetch2,
122 wishbone_out => wishbone_insn_out,
123 wishbone_in => wishbone_insn_in
126 decode1_0: entity work.decode1
130 stall_in => decode1_stall_in,
132 f_in => fetch2_to_decode1,
133 d_out => decode1_to_decode2
136 decode1_stall_in <= decode2_stall_out;
138 decode2_0: entity work.decode2
142 stall_out => decode2_stall_out,
144 complete_in => complete,
145 d_in => decode1_to_decode2,
146 e_out => decode2_to_execute1,
147 l_out => decode2_to_loadstore1,
148 m_out => decode2_to_multiply,
149 r_in => register_file_to_decode2,
150 r_out => decode2_to_register_file,
151 c_in => cr_file_to_decode2,
152 c_out => decode2_to_cr_file
155 register_file_0: entity work.register_file
158 d_in => decode2_to_register_file,
159 d_out => register_file_to_decode2,
160 w_in => writeback_to_register_file,
161 registers_out => registers);
163 cr_file_0: entity work.cr_file
166 d_in => decode2_to_cr_file,
167 d_out => cr_file_to_decode2,
168 w_in => writeback_to_cr_file
171 execute1_0: entity work.execute1
178 e_in => decode2_to_execute1,
179 f_out => execute1_to_fetch1,
180 e_out => execute1_to_execute2,
181 terminate_out => terminate
184 execute2_0: entity work.execute2
187 e_in => execute1_to_execute2,
188 e_out => execute2_to_writeback
191 loadstore1_0: entity work.loadstore1
194 l_in => decode2_to_loadstore1,
195 l_out => loadstore1_to_loadstore2
198 loadstore2_0: entity work.loadstore2
201 l_in => loadstore1_to_loadstore2,
202 w_out => loadstore2_to_writeback,
203 m_in => wishbone_data_in,
204 m_out => wishbone_data_out
207 multiply_0: entity work.multiply
210 m_in => decode2_to_multiply,
211 m_out => multiply_to_writeback
214 writeback_0: entity work.writeback
217 e_in => execute2_to_writeback,
218 l_in => loadstore2_to_writeback,
219 m_in => multiply_to_writeback,
220 w_out => writeback_to_register_file,
221 c_out => writeback_to_cr_file,
222 complete_out => complete