77114e63cc8fb1d2d64a437ee5bebc61b7121753
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);
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

12)         o_data_req:     OUT std_logic;
13)         i_data_grant:   IN  std_logic;
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

14)         o_data_addr:    OUT std_logic_vector(31 DOWNTO 0);
15)         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

16)         o_data_rd_en:   OUT std_logic_vector( 3 DOWNTO 0);
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

17)         o_data_wr_data: OUT std_logic_vector(31 DOWNTO 0);
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

18)         o_data_wr_en:   OUT std_logic_vector( 3 DOWNTO 0)
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 converted core to use req a...

Stefan Schuermans authored 12 years ago

424)     o_data_req <= '1' WHEN (r_data_rd = data_rd_idle AND r_op = op_l)
425)                            OR r_op = op_s
426)                       ELSE '0';
427) 
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

428)     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

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

Stefan Schuermans authored 12 years ago

431)     BEGIN
432)         s_data_addr <= (OTHERS => '0');
433)         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

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

437)             s_data_addr         <= std_logic_vector(v_addr);
438)         END IF;
439)     END PROCESS p_data_addr;
440) 
441)     o_data_addr <= s_data_addr(31 DOWNTO 2) & "00";
442) 
Stefan Schuermans add read_enable signal to d...

Stefan Schuermans authored 12 years ago

443)     p_data_rd_en: PROCESS(r_data_rd, r_op, r_ldst, s_data_addr)
444)     BEGIN
445)         o_data_rd_en <= "0000";
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

446)         IF r_data_rd = data_rd_idle AND r_op = op_l THEN
Stefan Schuermans add read_enable signal to d...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

485)     p_data_rd: PROCESS(r_data_rd, r_op, r_ldst, s_data_addr, r_reg_t,
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

486)                        i_data_rd_data, i_data_grant, s_val_t)
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

487)         VARIABLE v_read: boolean;
488)         VARIABLE v_b:    std_logic_vector( 7 DOWNTO 0);
489)         VARIABLE v_h:    std_logic_vector(15 DOWNTO 0);
490)         VARIABLE v_w:    std_logic_vector(31 DOWNTO 0);
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

492)         v_read          := false;
493)         s_stall_data_rd <= '0';
494)         n_data_rd       <= data_rd_idle;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

495)         CASE r_data_rd IS
496)             WHEN data_rd_idle =>
497)                 IF r_op = op_l THEN
498)                     s_stall_data_rd <= '1';
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

499)                     IF i_data_grant = '1' THEN
500)                         n_data_rd <= data_rd_read;
501)                     END IF;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

502)                 END IF;
503)             WHEN data_rd_read =>
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

504)                 v_read := true;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

569)         END IF;
570)     END PROCESS p_sync_data_rd;
571) 
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

640)                 WHEN OTHERS => NULL;
641)             END CASE;
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

642)             IF i_data_grant = '0' THEN
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

643)                 s_stall_data_wr <= '1';
644)             END IF;
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

647) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

692)     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

693)     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

694) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

695)     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

696)     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

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

Stefan Schuermans authored 12 years ago

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