1d0a24ccc53079418a318393e40398d23ac421fd
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

1) LIBRARY ieee;
2) USE ieee.std_logic_1164.all;
3) USE ieee.numeric_std.all;
4) USE work.mips_types.all;
5) 
6) ENTITY e_mips_core IS
7)     PORT (
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

8)         rst:            IN  std_logic;
9)         clk:            IN  std_logic;
10)         o_instr_addr:   OUT std_logic_vector(31 DOWNTO 0);
11)         i_instr_data:   IN  std_logic_vector(31 DOWNTO 0);
12)         o_data_addr:    OUT std_logic_vector(31 DOWNTO 0);
13)         i_data_rd_data: IN  std_logic_vector(31 DOWNTO 0);
Stefan Schuermans add read_enable signal to d...

Stefan Schuermans authored 12 years ago

14)         o_data_rd_en:   OUT std_logic_vector( 3 DOWNTO 0);
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

15)         i_data_rd_ack:  IN  std_logic;
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

16)         o_data_wr_data: OUT std_logic_vector(31 DOWNTO 0);
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

17)         o_data_wr_en:   OUT std_logic_vector( 3 DOWNTO 0);
18)         i_data_wr_ack:  IN  std_logic
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

19)     );
20) END ENTITY e_mips_core;
21) 
22) ARCHITECTURE a_mips_core OF e_mips_core IS
23) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

24)     SIGNAL s_stall:         std_logic;
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

25)     SIGNAL r_stall_reset:   std_logic := '1';
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

26)     SIGNAL s_stall_data_rd: std_logic;
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

27)     SIGNAL s_stall_data_wr: std_logic;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

28) 
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

29)     SIGNAL r_pc:         std_logic_vector(31 DOWNTO 0) := X"FFFFFFFC";
30)     SIGNAL n_pc:         std_logic_vector(31 DOWNTO 0);
31)     SIGNAL r_instr_data: std_logic_vector(31 DOWNTO 0) := X"00000000";
32)     SIGNAL s_instr:      std_logic_vector(31 DOWNTO 0);
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

33) 
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

34)     SIGNAL n_reg_s:  std_logic_vector( 4 DOWNTO 0);
35)     SIGNAL n_reg_t:  std_logic_vector( 4 DOWNTO 0);
36)     SIGNAL n_reg_d:  std_logic_vector( 4 DOWNTO 0);
37)     SIGNAL n_imm_a:  std_logic_vector( 4 DOWNTO 0);
38)     SIGNAL n_imm_16: std_logic_vector(15 DOWNTO 0);
39)     SIGNAL n_imm_26: std_logic_vector(25 DOWNTO 0);
40)     SIGNAL n_op:     t_op;
41)     SIGNAL n_link:   t_link;
42)     SIGNAL n_cmp:    t_cmp;
43)     SIGNAL n_alu:    t_alu;
44)     SIGNAL n_imm:    t_imm;
Stefan Schuermans added decoding of simple lo...

Stefan Schuermans authored 12 years ago

45)     SIGNAL n_ldst:   t_ldst;
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

46) 
Stefan Schuermans add initial values for regi...

Stefan Schuermans authored 12 years ago

47)     SIGNAL r_reg_s:  std_logic_vector( 4 DOWNTO 0) := (OTHERS => '0');
48)     SIGNAL r_reg_t:  std_logic_vector( 4 DOWNTO 0) := (OTHERS => '0');
49)     SIGNAL r_reg_d:  std_logic_vector( 4 DOWNTO 0) := (OTHERS => '0');
50)     SIGNAL r_imm_a:  std_logic_vector( 4 DOWNTO 0) := (OTHERS => '0');
51)     SIGNAL r_imm_16: std_logic_vector(15 DOWNTO 0) := (OTHERS => '0');
52)     SIGNAL r_imm_26: std_logic_vector(25 DOWNTO 0) := (OTHERS => '0');
53)     SIGNAL r_op:     t_op                          := op_none;
54)     SIGNAL r_link:   t_link                        := link_none;
55)     SIGNAL r_cmp:    t_cmp                         := cmp_none;
56)     SIGNAL r_alu:    t_alu                         := alu_none;
57)     SIGNAL r_imm:    t_imm                         := imm_none;
58)     SIGNAL r_ldst:   t_ldst                        := ldst_none;
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

59) 
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

60)     SIGNAL s_val_s: std_logic_vector(31 DOWNTO 0);
61)     SIGNAL s_val_t: std_logic_vector(31 DOWNTO 0);
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

62) 
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

63)     SIGNAL s_alu_op1: std_logic_vector(31 DOWNTO 0);
64)     SIGNAL s_alu_op2: std_logic_vector(31 DOWNTO 0);
65)     SIGNAL s_alu_res: std_logic_vector(31 DOWNTO 0);
66) 
67)     SIGNAL s_cmp_op1: std_logic_vector(31 DOWNTO 0);
68)     SIGNAL s_cmp_op2: std_logic_vector(31 DOWNTO 0);
69)     SIGNAL s_cmp_res: std_logic;
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

70) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

71)     SIGNAL s_reg_wr_alu_no:   std_logic_vector( 4 DOWNTO 0);
72)     SIGNAL s_reg_wr_alu_data: std_logic_vector(31 DOWNTO 0);
73)     SIGNAL s_reg_wr_alu_en:   std_logic;
74) 
75)     SIGNAL s_reg_wr_data_no:   std_logic_vector( 4 DOWNTO 0);
76)     SIGNAL s_reg_wr_data_data: std_logic_vector(31 DOWNTO 0);
77)     SIGNAL s_reg_wr_data_en:   std_logic;
78) 
Stefan Schuermans implemented M T/F HI/LO

Stefan Schuermans authored 12 years ago

79)     SIGNAL s_reg_wr_hi_lo_no:   std_logic_vector( 4 DOWNTO 0);
80)     SIGNAL s_reg_wr_hi_lo_data: std_logic_vector(31 DOWNTO 0);
81)     SIGNAL s_reg_wr_hi_lo_en:   std_logic;
82) 
Stefan Schuermans implemented ... and link ->...

Stefan Schuermans authored 12 years ago

83)     SIGNAL s_reg_wr_link_no:   std_logic_vector( 4 DOWNTO 0);
84)     SIGNAL s_reg_wr_link_data: std_logic_vector(31 DOWNTO 0);
85)     SIGNAL s_reg_wr_link_en:   std_logic;
86) 
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

87)     SIGNAL s_reg_wr_no:   std_logic_vector( 4 DOWNTO 0);
88)     SIGNAL s_reg_wr_data: std_logic_vector(31 DOWNTO 0);
89)     SIGNAL s_reg_wr_en:   std_logic;
90) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

91)     SIGNAL s_data_addr: std_logic_vector(31 DOWNTO 0);
92) 
93)     TYPE t_data_rd IS (data_rd_idle, data_rd_read);
94)     SIGNAL n_data_rd: t_data_rd;
Stefan Schuermans add initial values for regi...

Stefan Schuermans authored 12 years ago

95)     SIGNAL r_data_rd: t_data_rd := data_rd_idle;
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

96) 
Stefan Schuermans implemented M T/F HI/LO

Stefan Schuermans authored 12 years ago

97)     SIGNAL n_reg_lo: std_logic_vector(31 DOWNTO 0);
98)     SIGNAL n_reg_hi: std_logic_vector(31 DOWNTO 0);
Stefan Schuermans add initial values for regi...

Stefan Schuermans authored 12 years ago

99)     SIGNAL r_reg_lo: std_logic_vector(31 DOWNTO 0) := (OTHERS => '0');
100)     SIGNAL r_reg_hi: std_logic_vector(31 DOWNTO 0) := (OTHERS => '0');
Stefan Schuermans implemented M T/F HI/LO

Stefan Schuermans authored 12 years ago

101) 
Stefan Schuermans moved multiplier to own module

Stefan Schuermans authored 12 years ago

102)     SIGNAL s_mul_signed: std_logic;
103)     SIGNAL s_mul_start:  std_logic;
104)     SIGNAL s_mul_busy:   std_logic;
105)     SIGNAL s_mul_res:    std_logic_vector(63 DOWNTO 0);
Stefan Schuermans implemented multiplier

Stefan Schuermans authored 12 years ago

106) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

107)     SIGNAL s_div_signed: std_logic;
108)     SIGNAL s_div_start:  std_logic;
109)     SIGNAL s_div_busy:   std_logic;
110)     SIGNAL s_div_res:    std_logic_vector(31 DOWNTO 0);
111)     SIGNAL s_div_rem:    std_logic_vector(31 DOWNTO 0);
112) 
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

113)     COMPONENT e_mips_decoder IS
114)         PORT (
115)             i_instr:  IN  std_logic_vector(31 DOWNTO 0);
Stefan Schuermans rename src/dest to more gen...

Stefan Schuermans authored 12 years ago

116)             o_reg_s:  OUT std_logic_vector( 4 DOWNTO 0);
117)             o_reg_t:  OUT std_logic_vector( 4 DOWNTO 0);
118)             o_reg_d:  OUT std_logic_vector( 4 DOWNTO 0);
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

119)             o_imm_a:  OUT std_logic_vector( 4 DOWNTO 0);
120)             o_imm_16: OUT std_logic_vector(15 DOWNTO 0);
121)             o_imm_26: OUT std_logic_vector(25 DOWNTO 0);
122)             o_op:     OUT t_op;
123)             o_link:   OUT t_link;
124)             o_cmp:    OUT t_cmp;
125)             o_alu:    OUT t_alu;
Stefan Schuermans added decoding of simple lo...

Stefan Schuermans authored 12 years ago

126)             o_imm:    OUT t_imm;
127)             o_ldst:   OUT t_ldst
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

128)         );
129)     END COMPONENT e_mips_decoder;
130) 
Stefan Schuermans added register file

Stefan Schuermans authored 12 years ago

131)     COMPONENT e_mips_regs IS
132)         PORT (
133)             clk:         IN  std_logic;
134)             i_rd_a_no:   IN  std_logic_vector( 4 DOWNTO 0);
135)             o_rd_a_data: OUT std_logic_vector(31 DOWNTO 0);
136)             i_rd_b_no:   IN  std_logic_vector( 4 DOWNTO 0);
137)             o_rd_b_data: OUT std_logic_vector(31 DOWNTO 0);
138)             i_wr_no:     IN  std_logic_vector( 4 DOWNTO 0);
139)             i_wr_data:   IN  std_logic_vector(31 DOWNTO 0);
140)             i_wr_en:     IN  std_logic
141)         );
142)     END COMPONENT e_mips_regs;
143) 
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

144)     COMPONENT e_mips_alu IS
145)         PORT (
146)             i_alu: IN  t_alu;
147)             i_op1: IN  std_logic_vector(31 DOWNTO 0);
148)             i_op2: IN  std_logic_vector(31 DOWNTO 0);
149)             o_res: OUT std_logic_vector(31 DOWNTO 0)
150)         );
151)     END COMPONENT e_mips_alu;
152) 
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

153)     COMPONENT e_mips_cmp IS
154)         PORT (
155)             i_cmp: IN  t_cmp;
156)             i_op1: IN  std_logic_vector(31 DOWNTO 0);
157)             i_op2: IN  std_logic_vector(31 DOWNTO 0);
158)             o_res: OUT std_logic
159)         );
160)     END COMPONENT e_mips_cmp;
161) 
Stefan Schuermans moved multiplier to own module

Stefan Schuermans authored 12 years ago

162)     COMPONENT e_mips_mul IS
163)         PORT (
164)             rst:      IN  std_logic;
165)             clk:      IN  std_logic;
166)             i_a:      IN  std_logic_vector(31 DOWNTO 0);
167)             i_b:      IN  std_logic_vector(31 DOWNTO 0);
168)             i_signed: IN  std_logic;
169)             i_start:  IN  std_logic;
170)             o_busy:   OUT std_logic;
171)             o_res:    OUT std_logic_vector(63 DOWNTO 0)
172)         );
173)     END COMPONENT e_mips_mul;
174) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

175)     COMPONENT e_mips_div IS
176)         PORT (
177)             rst:      IN  std_logic;
178)             clk:      IN  std_logic;
179)             i_num:    IN  std_logic_vector(31 DOWNTO 0);
180)             i_denom:  IN  std_logic_vector(31 DOWNTO 0);
181)             i_signed: IN  std_logic;
182)             i_start:  IN  std_logic;
183)             o_busy:   OUT std_logic;
184)             o_res:    OUT std_logic_vector(31 DOWNTO 0);
185)             o_rem:    OUT std_logic_vector(31 DOWNTO 0)
186)         );
187)     END COMPONENT e_mips_div;
188) 
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

189) BEGIN
190) 
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

191)     s_stall <= r_stall_reset OR s_stall_data_rd OR s_stall_data_wr OR s_mul_busy OR s_div_busy;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

192) 
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

193)     decoder: e_mips_decoder
194)         PORT MAP (
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

195)             i_instr  => s_instr,
196)             o_reg_s  => n_reg_s,
197)             o_reg_t  => n_reg_t,
198)             o_reg_d  => n_reg_d,
199)             o_imm_a  => n_imm_a,
200)             o_imm_16 => n_imm_16,
201)             o_imm_26 => n_imm_26,
202)             o_op     => n_op,
203)             o_link   => n_link,
204)             o_cmp    => n_cmp,
205)             o_alu    => n_alu,
Stefan Schuermans added decoding of simple lo...

Stefan Schuermans authored 12 years ago

206)             o_imm    => n_imm,
207)             o_ldst   => n_ldst
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

208)         );
209) 
Stefan Schuermans added register file

Stefan Schuermans authored 12 years ago

210)     regs: e_mips_regs
211)         PORT MAP (
212)             clk         => clk,
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

213)             i_rd_a_no   => r_reg_s,
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

214)             o_rd_a_data => s_val_s,
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

215)             i_rd_b_no   => r_reg_t,
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

216)             o_rd_b_data => s_val_t,
217)             i_wr_no     => s_reg_wr_no,
218)             i_wr_data   => s_reg_wr_data,
219)             i_wr_en     => s_reg_wr_en
Stefan Schuermans added register file

Stefan Schuermans authored 12 years ago

220)         );
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

221) 
222)     alu: e_mips_alu
223)         PORT MAP (
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

224)             i_alu => r_alu,
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

225)             i_op1 => s_alu_op1,
226)             i_op2 => s_alu_op2,
227)             o_res => s_alu_res
228)         );
229) 
230)     cmp: e_mips_cmp
231)         PORT MAP (
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

232)             i_cmp => r_cmp,
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

233)             i_op1 => s_cmp_op1,
234)             i_op2 => s_cmp_op2,
235)             o_res => s_cmp_res
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

236)         );
237) 
Stefan Schuermans moved multiplier to own module

Stefan Schuermans authored 12 years ago

238)     mul: e_mips_mul
239)         PORT MAP (
240)             rst      => rst,
241)             clk      => clk,
242)             i_a      => s_val_s,
243)             i_b      => s_val_t,
244)             i_signed => s_mul_signed,
245)             i_start  => s_mul_start,
246)             o_busy   => s_mul_busy,
247)             o_res    => s_mul_res
248)         );
249) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

250)     div: e_mips_div
251)         PORT MAP (
252)             rst      => rst,
253)             clk      => clk,
254)             i_num    => s_val_s,
255)             i_denom  => s_val_t,
256)             i_signed => s_div_signed,
257)             i_start  => s_div_start,
258)             o_busy   => s_div_busy,
259)             o_res    => s_div_res,
260)             o_rem    => s_div_rem
261)         );
262) 
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

263)     p_sync_pc: PROCESS(rst, clk)
264)     BEGIN
265)         IF rst = '1' THEN
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

266)             r_stall_reset <= '1';
267)             r_pc          <= X"FFFFFFFC";
268)             r_instr_data  <= X"00000000";
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

269)         ELSIF rising_edge(clk) THEN
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

270)             r_stall_reset <= '0';
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

271)             IF s_stall = '0' THEN
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

272)                 r_pc         <= n_pc;
273)                 r_instr_data <= i_instr_data;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

274)             END IF;
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

275)         END IF;
276)     END PROCESS p_sync_pc;
277) 
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

278)     p_fetch: PROCESS(s_stall, r_pc, n_pc, r_instr_data, i_instr_data)
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

279)     BEGIN
Stefan Schuermans fixed instruction fetch dur...

Stefan Schuermans authored 12 years ago

280)         IF s_stall = '1' THEN
281)             o_instr_addr <= r_pc;
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

282)             s_instr      <= r_instr_data;
Stefan Schuermans fixed instruction fetch dur...

Stefan Schuermans authored 12 years ago

283)         ELSE
284)             o_instr_addr <= n_pc;
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

285)             s_instr      <= i_instr_data;
Stefan Schuermans fixed instruction fetch dur...

Stefan Schuermans authored 12 years ago

286)         END IF;
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

287)     END PROCESS p_fetch;
288) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

289)     p_sync_dec2ex: PROCESS(rst, clk)
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

290)     BEGIN
291)         IF rst = '1' THEN
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

292)             r_reg_s  <= (OTHERS => '0');
293)             r_reg_t  <= (OTHERS => '0');
294)             r_reg_d  <= (OTHERS => '0');
295)             r_imm_a  <= (OTHERS => '0');
296)             r_imm_16 <= (OTHERS => '0');
297)             r_imm_26 <= (OTHERS => '0');
298)             r_op     <= op_none;
299)             r_link   <= link_none;
300)             r_cmp    <= cmp_none;
301)             r_alu    <= alu_none;
302)             r_imm    <= imm_none;
Stefan Schuermans added decoding of simple lo...

Stefan Schuermans authored 12 years ago

303)             r_ldst   <= ldst_none;
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

304)         ELSIF rising_edge(clk) THEN
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

305)             IF s_stall = '0' THEN
306)                 r_reg_s  <= n_reg_s;
307)                 r_reg_t  <= n_reg_t;
308)                 r_reg_d  <= n_reg_d;
309)                 r_imm_a  <= n_imm_a;
310)                 r_imm_16 <= n_imm_16;
311)                 r_imm_26 <= n_imm_26;
312)                 r_op     <= n_op;
313)                 r_link   <= n_link;
314)                 r_cmp    <= n_cmp;
315)                 r_alu    <= n_alu;
316)                 r_imm    <= n_imm;
317)                 r_ldst   <= n_ldst;
318)             END IF;
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

319)         END IF;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

320)     END PROCESS p_sync_dec2ex;
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

321) 
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

322)     p_alu_in: PROCESS(r_op, r_imm, s_val_s, s_val_t, r_imm_a, r_imm_16)
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

323)     BEGIN
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

324)         s_alu_op1 <= (OTHERS => '0');
325)         s_alu_op2 <= (OTHERS => '0');
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

326)         IF r_op = op_alu THEN
327)             CASE r_imm IS
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

328)                 WHEN imm_none =>
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

329)                     s_alu_op1 <= s_val_s;
330)                     s_alu_op2 <= s_val_t;
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

331)                 WHEN imm_a =>
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

332)                     s_alu_op1(4 DOWNTO 0) <= r_imm_a;
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

333)                     s_alu_op2 <= s_val_t;
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

334)                 WHEN imm_16se =>
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

335)                     s_alu_op1 <= s_val_s;
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

336)                     s_alu_op2(15 DOWNTO 0) <= r_imm_16;
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

337)                     s_alu_op2(31 DOWNTO 16) <= (OTHERS => r_imm_16(15));
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

338)                 WHEN imm_16ze =>
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

339)                     s_alu_op1 <= s_val_s;
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

340)                     s_alu_op2(15 DOWNTO 0) <= r_imm_16;
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

341)                 WHEN OTHERS => NULL;
342)             END CASE;
343)         END IF;
344)     END PROCESS p_alu_in;
345) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

346)     p_alu_out: PROCESS(r_op, r_imm, r_reg_t, r_reg_d, s_alu_res)
347)     BEGIN
348)         s_reg_wr_alu_no   <= (OTHERS => '0');
349)         s_reg_wr_alu_data <= (OTHERS => '0');
350)         s_reg_wr_alu_en   <= '0';
351)         IF r_op = op_alu THEN
352)             CASE r_imm IS
353)                 WHEN imm_none | imm_a =>
354)                     s_reg_wr_alu_no   <= r_reg_d;
355)                     s_reg_wr_alu_data <= s_alu_res;
356)                     s_reg_wr_alu_en   <= '1';
357)                 WHEN imm_16se | imm_16ze =>
358)                     s_reg_wr_alu_no   <= r_reg_t;
359)                     s_reg_wr_alu_data <= s_alu_res;
360)                     s_reg_wr_alu_en   <= '1';
361)                 WHEN OTHERS => NULL;
362)             END CASE;
363)         END IF;
364)     END PROCESS p_alu_out;
365) 
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

366)     p_cmp_in: PROCESS(r_op, s_val_s, s_val_t)
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

367)     BEGIN
368)         s_cmp_op1 <= (OTHERS => '0');
369)         s_cmp_op2 <= (OTHERS => '0');
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

370)         IF r_op = op_j THEN
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

371)             s_cmp_op1 <= s_val_s;
372)             s_cmp_op2 <= s_val_t;
373)         END IF;
374)     END PROCESS p_cmp_in;
375) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

376)     p_reg_wr: PROCESS(s_stall,
377)                       s_reg_wr_alu_no, s_reg_wr_alu_data, s_reg_wr_alu_en,
Stefan Schuermans implemented M T/F HI/LO

Stefan Schuermans authored 12 years ago

378)                       s_reg_wr_data_no, s_reg_wr_data_data, s_reg_wr_data_en,
Stefan Schuermans implemented ... and link ->...

Stefan Schuermans authored 12 years ago

379)                       s_reg_wr_hi_lo_no, s_reg_wr_hi_lo_data, s_reg_wr_hi_lo_en,
380)                       s_reg_wr_link_no, s_reg_wr_link_data, s_reg_wr_link_en)
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

381)     BEGIN
382)         s_reg_wr_no   <= (OTHERS => '0');
383)         s_reg_wr_data <= (OTHERS => '0');
384)         s_reg_wr_en   <= '0';
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

385)         IF s_stall = '0' THEN
386)             IF s_reg_wr_alu_en = '1' THEN
387)                 s_reg_wr_no   <= s_reg_wr_alu_no;
388)                 s_reg_wr_data <= s_reg_wr_alu_data;
389)                 s_reg_wr_en   <= '1';
390)             ELSIF s_reg_wr_data_en = '1' THEN
391)                 s_reg_wr_no   <= s_reg_wr_data_no;
392)                 s_reg_wr_data <= s_reg_wr_data_data;
393)                 s_reg_wr_en   <= '1';
Stefan Schuermans implemented M T/F HI/LO

Stefan Schuermans authored 12 years ago

394)             ELSIF s_reg_wr_hi_lo_en = '1' THEN
395)                 s_reg_wr_no   <= s_reg_wr_hi_lo_no;
396)                 s_reg_wr_data <= s_reg_wr_hi_lo_data;
397)                 s_reg_wr_en   <= '1';
Stefan Schuermans implemented ... and link ->...

Stefan Schuermans authored 12 years ago

398)             ELSIF s_reg_wr_link_en = '1' THEN
399)                 s_reg_wr_no   <= s_reg_wr_link_no;
400)                 s_reg_wr_data <= s_reg_wr_link_data;
401)                 s_reg_wr_en   <= '1';
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

402)             END IF;
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

403)         END IF;
404)     END PROCESS p_reg_wr;
405) 
Stefan Schuermans implemented jump register i...

Stefan Schuermans authored 12 years ago

406)     p_next_pc: PROCESS(r_pc, r_op, r_imm, s_cmp_res, r_imm_16, r_imm_26, s_val_s)
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

407)         VARIABLE v_pc:  signed(31 DOWNTO 0);
408)         VARIABLE v_rel: signed(17 DOWNTO 0);
409)     BEGIN
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

410)         IF r_op = op_j AND s_cmp_res = '1' THEN
411)             IF r_imm = imm_26 THEN
412)                 n_pc <= r_pc(31 DOWNTO 28) & r_imm_26 & "00";
Stefan Schuermans implemented jump register i...

Stefan Schuermans authored 12 years ago

413)             ELSIF r_imm = imm_16se THEN
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

414)                 n_pc <= std_logic_vector(signed(r_pc) +
415)                                          signed(r_imm_16 & "00"));
Stefan Schuermans implemented jump register i...

Stefan Schuermans authored 12 years ago

416)             ELSE
417)                 n_pc <= s_val_s;
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

418)             END IF;
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

419)         ELSE
420)             n_pc <= std_logic_vector(signed(r_pc) + to_signed(4, 32));
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

421)         END IF;
422)     END PROCESS p_next_pc;
423) 
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

424)     p_data_addr: PROCESS(r_op, s_val_s, r_imm_16)
Stefan Schuermans add read_enable signal to d...

Stefan Schuermans authored 12 years ago

425)         VARIABLE v_ofs: unsigned(31 DOWNTO 0);
426)         VARIABLE v_addr: unsigned(31 DOWNTO 0);
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

427)     BEGIN
428)         s_data_addr <= (OTHERS => '0');
429)         IF r_op = op_l OR r_op = op_s THEN
Stefan Schuermans add read_enable signal to d...

Stefan Schuermans authored 12 years ago

430)             v_ofs(15 DOWNTO 0)  := unsigned(r_imm_16);
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

431)             v_ofs(31 DOWNTO 16) := (OTHERS => r_imm_16(15));
Stefan Schuermans add read_enable signal to d...

Stefan Schuermans authored 12 years ago

432)             v_addr              := unsigned(s_val_s) + v_ofs;
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

433)             s_data_addr         <= std_logic_vector(v_addr);
434)         END IF;
435)     END PROCESS p_data_addr;
436) 
437)     o_data_addr <= s_data_addr(31 DOWNTO 2) & "00";
438) 
Stefan Schuermans add read_enable signal to d...

Stefan Schuermans authored 12 years ago

439)     p_data_rd_en: PROCESS(r_data_rd, r_op, r_ldst, s_data_addr)
440)     BEGIN
441)         o_data_rd_en <= "0000";
Stefan Schuermans keep read enable active dur...

Stefan Schuermans authored 12 years ago

442)         IF r_op = op_l THEN
Stefan Schuermans add read_enable signal to d...

Stefan Schuermans authored 12 years ago

443)             CASE r_ldst IS
444)                 WHEN ldst_b | ldst_bu =>
445)                     CASE s_data_addr(1 DOWNTO 0) IS
446)                         WHEN "00" => o_data_rd_en <= "0001";
447)                         WHEN "01" => o_data_rd_en <= "0010";
448)                         WHEN "10" => o_data_rd_en <= "0100";
449)                         WHEN "11" => o_data_rd_en <= "1000";
450)                         WHEN OTHERS => NULL;
451)                     END CASE;
452)                 WHEN ldst_h | ldst_hu =>
453)                     CASE s_data_addr(1 DOWNTO 1) IS
454)                         WHEN "0" => o_data_rd_en <= "0011";
455)                         WHEN "1" => o_data_rd_en <= "1100";
456)                         WHEN OTHERS => NULL;
457)                     END CASE;
458)                 WHEN ldst_w =>
459)                     o_data_rd_en <= "1111";
460)                 WHEN ldst_wl =>
461)                     CASE s_data_addr(1 DOWNTO 0) IS
462)                         WHEN "00" => o_data_rd_en <= "0001";
463)                         WHEN "01" => o_data_rd_en <= "0011";
464)                         WHEN "10" => o_data_rd_en <= "0111";
465)                         WHEN "11" => o_data_rd_en <= "1111";
466)                         WHEN OTHERS => NULL;
467)                     END CASE;
468)                 WHEN ldst_wr =>
469)                     CASE s_data_addr(1 DOWNTO 0) IS
470)                         WHEN "00" => o_data_rd_en <= "1111";
471)                         WHEN "01" => o_data_rd_en <= "1110";
472)                         WHEN "10" => o_data_rd_en <= "1100";
473)                         WHEN "11" => o_data_rd_en <= "1000";
474)                         WHEN OTHERS => NULL;
475)                     END CASE;
476)                 WHEN OTHERS => NULL;
477)             END CASE;
478)         END IF;
479)     END PROCESS p_data_rd_en;
480) 
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

481)     p_data_rd: PROCESS(r_data_rd, r_op, r_ldst, s_data_addr, r_reg_t,
482)                        i_data_rd_data, i_data_rd_ack, s_val_t)
483)         VARIABLE v_read: boolean;
484)         VARIABLE v_b:    std_logic_vector( 7 DOWNTO 0);
485)         VARIABLE v_h:    std_logic_vector(15 DOWNTO 0);
486)         VARIABLE v_w:    std_logic_vector(31 DOWNTO 0);
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

487)     BEGIN
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

488)         v_read          := false;
489)         s_stall_data_rd <= '0';
490)         n_data_rd       <= data_rd_idle;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

491)         CASE r_data_rd IS
492)             WHEN data_rd_idle =>
493)                 IF r_op = op_l THEN
494)                     s_stall_data_rd <= '1';
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

495)                     n_data_rd       <= data_rd_read;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

496)                 END IF;
497)             WHEN data_rd_read =>
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

498)                 IF i_data_rd_ack = '0' THEN
499)                     s_stall_data_rd <= '1';
500)                     n_data_rd       <= data_rd_read;
501)                 ELSE
502)                     v_read := true;
503)                 END IF;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

504)             WHEN OTHERS => NULL;
505)         END CASE;
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

506)         s_reg_wr_data_no   <= (OTHERS => '0');
507)         s_reg_wr_data_data <= (OTHERS => '0');
508)         s_reg_wr_data_en   <= '0';
509)         IF v_read THEN
510)             CASE r_ldst IS
511)                 WHEN ldst_b | ldst_bu =>
512)                     CASE s_data_addr(1 DOWNTO 0) IS
513)                         WHEN "00" => v_b := i_data_rd_data( 7 DOWNTO  0);
514)                         WHEN "01" => v_b := i_data_rd_data(15 DOWNTO  8);
515)                         WHEN "10" => v_b := i_data_rd_data(23 DOWNTO 16);
516)                         WHEN "11" => v_b := i_data_rd_data(31 DOWNTO 24);
517)                         WHEN OTHERS => NULL;
518)                     END CASE;
519)                     s_reg_wr_data_data(7 DOWNTO 0) <= v_b;
520)                     IF r_ldst = ldst_b THEN
521)                         s_reg_wr_data_data(31 DOWNTO 8) <= (OTHERS => v_b(7));
522)                     END IF;
523)                 WHEN ldst_h | ldst_hu =>
524)                     CASE s_data_addr(1 DOWNTO 1) IS
525)                         WHEN "0" => v_h := i_data_rd_data(15 DOWNTO  0);
526)                         WHEN "1" => v_h := i_data_rd_data(31 DOWNTO 16);
527)                         WHEN OTHERS => NULL;
528)                     END CASE;
529)                     s_reg_wr_data_data(15 DOWNTO 0) <= v_h;
530)                     IF r_ldst = ldst_h THEN
531)                         s_reg_wr_data_data(31 DOWNTO 16) <= (OTHERS => v_h(15));
532)                     END IF;
533)                 WHEN ldst_w =>
534)                     s_reg_wr_data_data <= i_data_rd_data;
535)                 WHEN ldst_wl =>
536)                     v_w := s_val_t;
537)                     CASE s_data_addr(1 DOWNTO 0) IS
538)                         WHEN "00" => v_w(31 DOWNTO 24) := i_data_rd_data( 7 DOWNTO 0);
539)                         WHEN "01" => v_w(31 DOWNTO 16) := i_data_rd_data(15 DOWNTO 0);
540)                         WHEN "10" => v_w(31 DOWNTO  8) := i_data_rd_data(23 DOWNTO 0);
541)                         WHEN "11" => v_w(31 DOWNTO  0) := i_data_rd_data(31 DOWNTO 0);
542)                         WHEN OTHERS => NULL;
543)                     END CASE;
544)                     s_reg_wr_data_data <= v_w;
545)                 WHEN ldst_wr =>
546)                     v_w := s_val_t;
547)                     CASE s_data_addr(1 DOWNTO 0) IS
548)                         WHEN "00" => v_w(31 DOWNTO  0) := i_data_rd_data(31 DOWNTO  0);
549)                         WHEN "01" => v_w(23 DOWNTO  0) := i_data_rd_data(31 DOWNTO  8);
550)                         WHEN "10" => v_w(15 DOWNTO  0) := i_data_rd_data(31 DOWNTO 16);
551)                         WHEN "11" => v_w( 7 DOWNTO  0) := i_data_rd_data(31 DOWNTO 24);
552)                         WHEN OTHERS => NULL;
553)                     END CASE;
554)                     s_reg_wr_data_data <= v_w;
555)                 WHEN OTHERS => NULL;
556)             END CASE;
557)             s_reg_wr_data_no <= r_reg_t;
558)             s_reg_wr_data_en <= '1';
559)         END IF;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

560)     END PROCESS p_data_rd;
561) 
562)     p_sync_data_rd: PROCESS(rst, clk)
563)     BEGIN
564)         IF rst = '1' THEN
565)             r_data_rd <= data_rd_idle;
566)         ELSIF rising_edge(clk) THEN
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

567)             r_data_rd <= n_data_rd;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

568)         END IF;
569)     END PROCESS p_sync_data_rd;
570) 
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

571)     p_data_wr: PROCESS(r_op, r_ldst, s_data_addr, s_val_t, i_data_wr_ack)
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

572)     BEGIN
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

573)         o_data_wr_data  <= (OTHERS => '0');
574)         o_data_wr_en    <= "0000";
575)         s_stall_data_wr <= '0';
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

576)         IF r_op = op_s THEN
577)             CASE r_ldst IS
578)                 WHEN ldst_b =>
579)                     CASE s_data_addr(1 DOWNTO 0) IS
580)                         WHEN "00" =>
581)                             o_data_wr_data( 7 DOWNTO  0) <= s_val_t(7 DOWNTO 0);
582)                             o_data_wr_en                 <= "0001";
583)                         WHEN "01" =>
584)                             o_data_wr_data(15 DOWNTO  8) <= s_val_t(7 DOWNTO 0);
585)                             o_data_wr_en                 <= "0010";
586)                         WHEN "10" =>
587)                             o_data_wr_data(23 DOWNTO 16) <= s_val_t(7 DOWNTO 0);
588)                             o_data_wr_en                 <= "0100";
589)                         WHEN "11" =>
590)                             o_data_wr_data(31 DOWNTO 24) <= s_val_t(7 DOWNTO 0);
591)                             o_data_wr_en                 <= "1000";
592)                         WHEN OTHERS => NULL;
593)                     END CASE;
594)                 WHEN ldst_h =>
595)                     CASE s_data_addr(1 DOWNTO 1) IS
596)                         WHEN "0" =>
597)                             o_data_wr_data(15 DOWNTO  0) <= s_val_t(15 DOWNTO 0);
598)                             o_data_wr_en                 <= "0011";
599)                         WHEN "1" =>
600)                             o_data_wr_data(31 DOWNTO 16) <= s_val_t(15 DOWNTO 0);
601)                             o_data_wr_en                 <= "1100";
602)                         WHEN OTHERS => NULL;
603)                     END CASE;
604)                 WHEN ldst_w =>
605)                     o_data_wr_data <= s_val_t;
606)                     o_data_wr_en   <= "1111";
Stefan Schuermans implemented M T/F HI/LO

Stefan Schuermans authored 12 years ago

607)                 WHEN ldst_wl =>
608)                     CASE s_data_addr(1 DOWNTO 0) IS
609)                         WHEN "00" =>
610)                             o_data_wr_data( 7 DOWNTO 0) <= s_val_t(31 DOWNTO 24);
611)                             o_data_wr_en                <= "0001";
612)                         WHEN "01" =>
613)                             o_data_wr_data(15 DOWNTO 0) <= s_val_t(31 DOWNTO 16);
614)                             o_data_wr_en                <= "0011";
615)                         WHEN "10" =>
616)                             o_data_wr_data(23 DOWNTO 0) <= s_val_t(31 DOWNTO  8);
617)                             o_data_wr_en                <= "0111";
618)                         WHEN "11" =>
619)                             o_data_wr_data(31 DOWNTO 0) <= s_val_t(31 DOWNTO  0);
620)                             o_data_wr_en                <= "1111";
621)                         WHEN OTHERS => NULL;
622)                     END CASE;
623)                 WHEN ldst_wr =>
624)                     CASE s_data_addr(1 DOWNTO 0) IS
625)                         WHEN "00" =>
626)                             o_data_wr_data(31 DOWNTO  0) <= s_val_t(31 DOWNTO 0);
627)                             o_data_wr_en                 <= "1111";
628)                         WHEN "01" =>
629)                             o_data_wr_data(31 DOWNTO  8) <= s_val_t(23 DOWNTO 0);
630)                             o_data_wr_en                 <= "1110";
631)                         WHEN "10" =>
632)                             o_data_wr_data(31 DOWNTO 16) <= s_val_t(15 DOWNTO 0);
633)                             o_data_wr_en                 <= "1100";
634)                         WHEN "11" =>
635)                             o_data_wr_data(31 DOWNTO 24) <= s_val_t( 7 DOWNTO 0);
636)                             o_data_wr_en                 <= "1000";
637)                         WHEN OTHERS => NULL;
638)                     END CASE;
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

639)                 WHEN OTHERS => NULL;
640)             END CASE;
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

641)             IF i_data_wr_ack = '0' THEN
642)                 s_stall_data_wr <= '1';
643)             END IF;
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

644)         END IF;
645)     END PROCESS p_data_wr;
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

646) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

647)     p_reg_hi_lo: PROCESS(r_reg_lo, r_reg_hi, r_op, r_reg_d, s_val_s,
648)                          s_mul_res, s_div_res, s_div_rem)
Stefan Schuermans implemented M T/F HI/LO

Stefan Schuermans authored 12 years ago

649)     BEGIN
650)         n_reg_lo            <= r_reg_lo;
651)         n_reg_hi            <= r_reg_hi;
652)         s_reg_wr_hi_lo_no   <= (OTHERS => '0');
653)         s_reg_wr_hi_lo_data <= (OTHERS => '0');
654)         s_reg_wr_hi_lo_en   <= '0';
655)         CASE r_op IS
656)             WHEN op_mfhi =>
657)                 s_reg_wr_hi_lo_no   <= r_reg_d;
658)                 s_reg_wr_hi_lo_data <= r_reg_hi;
659)                 s_reg_wr_hi_lo_en   <= '1';            
660)             WHEN op_mflo =>
661)                 s_reg_wr_hi_lo_no   <= r_reg_d;
662)                 s_reg_wr_hi_lo_data <= r_reg_lo;
663)                 s_reg_wr_hi_lo_en   <= '1';            
664)             WHEN op_mthi =>
665)                 n_reg_hi <= s_val_s;
666)             WHEN op_mtlo =>
667)                 n_reg_lo <= s_val_s;
Stefan Schuermans implemented multiplier

Stefan Schuermans authored 12 years ago

668)             WHEN op_mult | op_multu =>
Stefan Schuermans moved multiplier to own module

Stefan Schuermans authored 12 years ago

669)                 n_reg_lo <= std_logic_vector(s_mul_res(31 DOWNTO  0));
670)                 n_reg_hi <= std_logic_vector(s_mul_res(63 DOWNTO 32));
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

671)             WHEN op_div | op_divu =>
672)                 n_reg_lo <= s_div_res;
673)                 n_reg_hi <= s_div_rem;
Stefan Schuermans implemented M T/F HI/LO

Stefan Schuermans authored 12 years ago

674)             WHEN OTHERS => NULL;
675)         END CASE;
676)     END PROCESS p_reg_hi_lo;
677) 
678)     p_sync_reg_hi_lo: PROCESS(clk, rst)
679)     BEGIN
680)         IF rst = '1' THEN
681)             r_reg_lo <= (OTHERS => '0');
682)             r_reg_hi <= (OTHERS => '0');
683)         ELSIF rising_edge(clk) THEN
684)             IF s_stall = '0' THEN
685)                 r_reg_lo <= n_reg_lo;
686)                 r_reg_hi <= n_reg_hi;
687)             END IF;
688)         END IF;
689)     END PROCESS p_sync_reg_hi_lo;
690) 
Stefan Schuermans moved multiplier to own module

Stefan Schuermans authored 12 years ago

691)     s_mul_signed <= '1' WHEN r_op = op_mult ELSE '0';
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

692)     s_mul_start  <= '1' WHEN r_op = op_mult OR r_op = op_multu ELSE '0';
Stefan Schuermans implemented multiplier

Stefan Schuermans authored 12 years ago

693) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

694)     s_div_signed <= '1' WHEN r_op = op_div ELSE '0';
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

695)     s_div_start  <= '1' WHEN r_op = op_div OR r_op = op_divu ELSE '0';
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

696) 
Stefan Schuermans implemented ... and link ->...

Stefan Schuermans authored 12 years ago

697)     p_link: PROCESS(r_pc, r_link)
698)     BEGIN
699)         s_reg_wr_link_no   <= std_logic_vector(to_unsigned(31, 5));
700)         s_reg_wr_link_data <= std_logic_vector(signed(r_pc) + to_signed(4, 32));
701)         IF r_link = link_link THEN
702)             s_reg_wr_link_en <= '1';
703)         ELSE
704)             s_reg_wr_link_en <= '0';
705)         END IF;
706)     END PROCESS p_link;
707)