902aa402b3830b9c9aa26758390b6eb93b42a0f5
Stefan Schuermans added file headers

Stefan Schuermans authored 12 years ago

1) -- MIPS I system
Stefan Schuermans replace email address in he...

Stefan Schuermans authored 12 years ago

2) -- Copyright 2011-2012 Stefan Schuermans <stefan@blinkenarea.org>
Stefan Schuermans added file headers

Stefan Schuermans authored 12 years ago

3) -- Copyleft GNU public license V2 or later
4) --          http://www.gnu.org/copyleft/gpl.html
5) 
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

6) LIBRARY ieee;
7) USE ieee.std_logic_1164.all;
8) USE ieee.numeric_std.all;
9) USE work.mips_types.all;
10) 
11) ENTITY e_mips_core IS
12)     PORT (
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

13)         rst:            IN  std_logic;
14)         clk:            IN  std_logic;
15)         o_instr_addr:   OUT std_logic_vector(31 DOWNTO 0);
16)         i_instr_data:   IN  std_logic_vector(31 DOWNTO 0);
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

17)         o_data_req:     OUT std_logic;
18)         i_data_grant:   IN  std_logic;
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

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

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

Stefan Schuermans authored 12 years ago

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

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

24)     );
25) END ENTITY e_mips_core;
26) 
27) ARCHITECTURE a_mips_core OF e_mips_core IS
28) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

33) 
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

34)     SIGNAL r_pc:         std_logic_vector(31 DOWNTO 0) := X"FFFFFFFC";
35)     SIGNAL n_pc:         std_logic_vector(31 DOWNTO 0);
36)     SIGNAL r_instr_data: std_logic_vector(31 DOWNTO 0) := X"00000000";
37)     SIGNAL s_instr:      std_logic_vector(31 DOWNTO 0);
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

64) 
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

67) 
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

68)     SIGNAL s_alu_op1: std_logic_vector(31 DOWNTO 0);
69)     SIGNAL s_alu_op2: std_logic_vector(31 DOWNTO 0);
70)     SIGNAL s_alu_res: std_logic_vector(31 DOWNTO 0);
71) 
72)     SIGNAL s_cmp_op1: std_logic_vector(31 DOWNTO 0);
73)     SIGNAL s_cmp_op2: std_logic_vector(31 DOWNTO 0);
74)     SIGNAL s_cmp_res: std_logic;
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

75) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

76)     SIGNAL s_reg_wr_alu_no:   std_logic_vector( 4 DOWNTO 0);
77)     SIGNAL s_reg_wr_alu_data: std_logic_vector(31 DOWNTO 0);
78)     SIGNAL s_reg_wr_alu_en:   std_logic;
79) 
80)     SIGNAL s_reg_wr_data_no:   std_logic_vector( 4 DOWNTO 0);
81)     SIGNAL s_reg_wr_data_data: std_logic_vector(31 DOWNTO 0);
82)     SIGNAL s_reg_wr_data_en:   std_logic;
83) 
Stefan Schuermans implemented M T/F HI/LO

Stefan Schuermans authored 12 years ago

84)     SIGNAL s_reg_wr_hi_lo_no:   std_logic_vector( 4 DOWNTO 0);
85)     SIGNAL s_reg_wr_hi_lo_data: std_logic_vector(31 DOWNTO 0);
86)     SIGNAL s_reg_wr_hi_lo_en:   std_logic;
87) 
Stefan Schuermans implemented ... and link ->...

Stefan Schuermans authored 12 years ago

88)     SIGNAL s_reg_wr_link_no:   std_logic_vector( 4 DOWNTO 0);
89)     SIGNAL s_reg_wr_link_data: std_logic_vector(31 DOWNTO 0);
90)     SIGNAL s_reg_wr_link_en:   std_logic;
91) 
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

92)     SIGNAL s_reg_wr_no:   std_logic_vector( 4 DOWNTO 0);
93)     SIGNAL s_reg_wr_data: std_logic_vector(31 DOWNTO 0);
94)     SIGNAL s_reg_wr_en:   std_logic;
95) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

96)     SIGNAL s_data_addr: std_logic_vector(31 DOWNTO 0);
97) 
98)     TYPE t_data_rd IS (data_rd_idle, data_rd_read);
99)     SIGNAL n_data_rd: t_data_rd;
Stefan Schuermans add initial values for regi...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

104)     SIGNAL r_reg_lo: std_logic_vector(31 DOWNTO 0) := (OTHERS => '0');
105)     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

106) 
Stefan Schuermans moved multiplier to own module

Stefan Schuermans authored 12 years ago

107)     SIGNAL s_mul_signed: std_logic;
108)     SIGNAL s_mul_start:  std_logic;
109)     SIGNAL s_mul_busy:   std_logic;
110)     SIGNAL s_mul_res:    std_logic_vector(63 DOWNTO 0);
Stefan Schuermans implemented multiplier

Stefan Schuermans authored 12 years ago

111) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

112)     SIGNAL s_div_signed: std_logic;
113)     SIGNAL s_div_start:  std_logic;
114)     SIGNAL s_div_busy:   std_logic;
115)     SIGNAL s_div_res:    std_logic_vector(31 DOWNTO 0);
116)     SIGNAL s_div_rem:    std_logic_vector(31 DOWNTO 0);
117) 
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

121)             o_reg_s:  OUT std_logic_vector( 4 DOWNTO 0);
122)             o_reg_t:  OUT std_logic_vector( 4 DOWNTO 0);
123)             o_reg_d:  OUT std_logic_vector( 4 DOWNTO 0);
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

124)             o_imm_a:  OUT std_logic_vector( 4 DOWNTO 0);
125)             o_imm_16: OUT std_logic_vector(15 DOWNTO 0);
126)             o_imm_26: OUT std_logic_vector(25 DOWNTO 0);
127)             o_op:     OUT t_op;
128)             o_link:   OUT t_link;
129)             o_cmp:    OUT t_cmp;
130)             o_alu:    OUT t_alu;
Stefan Schuermans added decoding of simple lo...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

133)         );
134)     END COMPONENT e_mips_decoder;
135) 
Stefan Schuermans added register file

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

149)     COMPONENT e_mips_alu IS
150)         PORT (
151)             i_alu: IN  t_alu;
152)             i_op1: IN  std_logic_vector(31 DOWNTO 0);
153)             i_op2: IN  std_logic_vector(31 DOWNTO 0);
154)             o_res: OUT std_logic_vector(31 DOWNTO 0)
155)         );
156)     END COMPONENT e_mips_alu;
157) 
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

158)     COMPONENT e_mips_cmp IS
159)         PORT (
160)             i_cmp: IN  t_cmp;
161)             i_op1: IN  std_logic_vector(31 DOWNTO 0);
162)             i_op2: IN  std_logic_vector(31 DOWNTO 0);
163)             o_res: OUT std_logic
164)         );
165)     END COMPONENT e_mips_cmp;
166) 
Stefan Schuermans moved multiplier to own module

Stefan Schuermans authored 12 years ago

167)     COMPONENT e_mips_mul IS
168)         PORT (
169)             rst:      IN  std_logic;
170)             clk:      IN  std_logic;
171)             i_a:      IN  std_logic_vector(31 DOWNTO 0);
172)             i_b:      IN  std_logic_vector(31 DOWNTO 0);
173)             i_signed: IN  std_logic;
174)             i_start:  IN  std_logic;
175)             o_busy:   OUT std_logic;
176)             o_res:    OUT std_logic_vector(63 DOWNTO 0)
177)         );
178)     END COMPONENT e_mips_mul;
179) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

194) BEGIN
195) 
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

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

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

Stefan Schuermans authored 12 years ago

198)     decoder: e_mips_decoder
199)         PORT MAP (
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

213)         );
214) 
Stefan Schuermans added register file

Stefan Schuermans authored 12 years ago

215)     regs: e_mips_regs
216)         PORT MAP (
217)             clk         => clk,
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

221)             o_rd_b_data => s_val_t,
222)             i_wr_no     => s_reg_wr_no,
223)             i_wr_data   => s_reg_wr_data,
224)             i_wr_en     => s_reg_wr_en
Stefan Schuermans added register file

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

226) 
227)     alu: e_mips_alu
228)         PORT MAP (
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

230)             i_op1 => s_alu_op1,
231)             i_op2 => s_alu_op2,
232)             o_res => s_alu_res
233)         );
234) 
235)     cmp: e_mips_cmp
236)         PORT MAP (
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

238)             i_op1 => s_cmp_op1,
239)             i_op2 => s_cmp_op2,
240)             o_res => s_cmp_res
Stefan Schuermans start of MIPS core: begin o...

Stefan Schuermans authored 12 years ago

241)         );
242) 
Stefan Schuermans moved multiplier to own module

Stefan Schuermans authored 12 years ago

243)     mul: e_mips_mul
244)         PORT MAP (
245)             rst      => rst,
246)             clk      => clk,
247)             i_a      => s_val_s,
248)             i_b      => s_val_t,
249)             i_signed => s_mul_signed,
250)             i_start  => s_mul_start,
251)             o_busy   => s_mul_busy,
252)             o_res    => s_mul_res
253)         );
254) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

268)     p_sync_pc: PROCESS(rst, clk)
269)     BEGIN
270)         IF rst = '1' THEN
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

271)             r_stall_reset <= '1';
272)             r_pc          <= X"FFFFFFFC";
273)             r_instr_data  <= X"00000000";
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

277)                 r_pc         <= n_pc;
278)                 r_instr_data <= i_instr_data;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

280)         END IF;
281)     END PROCESS p_sync_pc;
282) 
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

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

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

288)         ELSE
289)             o_instr_addr <= n_pc;
Stefan Schuermans fixed instruction word inpu...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

292)     END PROCESS p_fetch;
293) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

297)             r_reg_s  <= (OTHERS => '0');
298)             r_reg_t  <= (OTHERS => '0');
299)             r_reg_d  <= (OTHERS => '0');
300)             r_imm_a  <= (OTHERS => '0');
301)             r_imm_16 <= (OTHERS => '0');
302)             r_imm_26 <= (OTHERS => '0');
303)             r_op     <= op_none;
304)             r_link   <= link_none;
305)             r_cmp    <= cmp_none;
306)             r_alu    <= alu_none;
307)             r_imm    <= imm_none;
Stefan Schuermans added decoding of simple lo...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

328)     BEGIN
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

331)         IF r_op = op_alu THEN
332)             CASE r_imm IS
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

334)                     s_alu_op1 <= s_val_s;
335)                     s_alu_op2 <= s_val_t;
Stefan Schuermans implement correctly writing...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

346)                 WHEN OTHERS => NULL;
347)             END CASE;
348)         END IF;
349)     END PROCESS p_alu_in;
350) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

372)     BEGIN
373)         s_cmp_op1 <= (OTHERS => '0');
374)         s_cmp_op2 <= (OTHERS => '0');
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

376)             s_cmp_op1 <= s_val_s;
377)             s_cmp_op2 <= s_val_t;
378)         END IF;
379)     END PROCESS p_cmp_in;
380) 
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

381)     p_reg_wr: PROCESS(s_stall,
382)                       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

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

384)                       s_reg_wr_hi_lo_no, s_reg_wr_hi_lo_data, s_reg_wr_hi_lo_en,
385)                       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

386)     BEGIN
387)         s_reg_wr_no   <= (OTHERS => '0');
388)         s_reg_wr_data <= (OTHERS => '0');
389)         s_reg_wr_en   <= '0';
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

390)         IF s_stall = '0' THEN
391)             IF s_reg_wr_alu_en = '1' THEN
392)                 s_reg_wr_no   <= s_reg_wr_alu_no;
393)                 s_reg_wr_data <= s_reg_wr_alu_data;
394)                 s_reg_wr_en   <= '1';
395)             ELSIF s_reg_wr_data_en = '1' THEN
396)                 s_reg_wr_no   <= s_reg_wr_data_no;
397)                 s_reg_wr_data <= s_reg_wr_data_data;
398)                 s_reg_wr_en   <= '1';
Stefan Schuermans implemented M T/F HI/LO

Stefan Schuermans authored 12 years ago

399)             ELSIF s_reg_wr_hi_lo_en = '1' THEN
400)                 s_reg_wr_no   <= s_reg_wr_hi_lo_no;
401)                 s_reg_wr_data <= s_reg_wr_hi_lo_data;
402)                 s_reg_wr_en   <= '1';
Stefan Schuermans implemented ... and link ->...

Stefan Schuermans authored 12 years ago

403)             ELSIF s_reg_wr_link_en = '1' THEN
404)                 s_reg_wr_no   <= s_reg_wr_link_no;
405)                 s_reg_wr_data <= s_reg_wr_link_data;
406)                 s_reg_wr_en   <= '1';
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

408)         END IF;
409)     END PROCESS p_reg_wr;
410) 
Stefan Schuermans implemented jump register i...

Stefan Schuermans authored 12 years ago

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

412)         VARIABLE v_pc:  signed(31 DOWNTO 0);
413)         VARIABLE v_rel: signed(17 DOWNTO 0);
414)     BEGIN
Stefan Schuermans implement jump logic, imple...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

421)             ELSE
422)                 n_pc <= s_val_s;
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

424)         ELSE
425)             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

426)         END IF;
427)     END PROCESS p_next_pc;
428) 
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

429)     o_data_req <= '1' WHEN (r_data_rd = data_rd_idle AND r_op = op_l)
430)                            OR r_op = op_s
431)                       ELSE '0';
432) 
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

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

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

Stefan Schuermans authored 12 years ago

436)     BEGIN
437)         s_data_addr <= (OTHERS => '0');
438)         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

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

442)             s_data_addr         <= std_logic_vector(v_addr);
443)         END IF;
444)     END PROCESS p_data_addr;
445) 
446)     o_data_addr <= s_data_addr(31 DOWNTO 2) & "00";
447) 
Stefan Schuermans add read_enable signal to d...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

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

Stefan Schuermans authored 12 years ago

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

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

Stefan Schuermans authored 12 years ago

492)         VARIABLE v_read: boolean;
493)         VARIABLE v_b:    std_logic_vector( 7 DOWNTO 0);
494)         VARIABLE v_h:    std_logic_vector(15 DOWNTO 0);
495)         VARIABLE v_w:    std_logic_vector(31 DOWNTO 0);
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

497)         v_read          := false;
498)         s_stall_data_rd <= '0';
499)         n_data_rd       <= data_rd_idle;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

500)         CASE r_data_rd IS
501)             WHEN data_rd_idle =>
502)                 IF r_op = op_l THEN
503)                     s_stall_data_rd <= '1';
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

504)                     IF i_data_grant = '1' THEN
505)                         n_data_rd <= data_rd_read;
506)                     END IF;
Stefan Schuermans implemented simple load ins...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

566)     END PROCESS p_data_rd;
567) 
568)     p_sync_data_rd: PROCESS(rst, clk)
569)     BEGIN
570)         IF rst = '1' THEN
571)             r_data_rd <= data_rd_idle;
572)         ELSIF rising_edge(clk) THEN
Stefan Schuermans changed MIPS core to use re...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

574)         END IF;
575)     END PROCESS p_sync_data_rd;
576) 
Stefan Schuermans converted core to use req a...

Stefan Schuermans authored 12 years ago

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

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

Stefan Schuermans authored 12 years ago

579)         o_data_wr_data  <= (OTHERS => '0');
580)         o_data_wr_en    <= "0000";
581)         s_stall_data_wr <= '0';
Stefan Schuermans implemented simple store in...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

652) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

677)             WHEN op_div | op_divu =>
678)                 n_reg_lo <= s_div_res;
679)                 n_reg_hi <= s_div_rem;
Stefan Schuermans implemented M T/F HI/LO

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

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

699) 
Stefan Schuermans implemented divider

Stefan Schuermans authored 12 years ago

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

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

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

Stefan Schuermans authored 12 years ago

703)     p_link: PROCESS(r_pc, r_link)
704)     BEGIN
705)         s_reg_wr_link_no   <= std_logic_vector(to_unsigned(31, 5));
706)         s_reg_wr_link_data <= std_logic_vector(signed(r_pc) + to_signed(4, 32));
707)         IF r_link = link_link THEN
708)             s_reg_wr_link_en <= '1';
709)         ELSE
710)             s_reg_wr_link_en <= '0';
711)         END IF;
712)     END PROCESS p_link;
713)