c45ea7af44c5234ce39e45550428c401bb223d8b
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

1) LIBRARY IEEE;
2) USE IEEE.STD_LOGIC_1164.ALL;
3) USE IEEE.NUMERIC_STD.ALL;
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

4) USE work.io_lcd_pins.all;
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

5) USE work.io_switches_pins.all;
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

6) 
7) ENTITY e_system IS
8)     PORT (
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

9)         clk:            IN  std_logic;
10)         pin_o_leds:     OUT std_logic_vector(7 DOWNTO 0);
11)         pin_o_lcd:      OUT t_io_lcd_pins;
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

12)         pin_i_switches: IN  t_io_switches_pins;
13)         pin_o_uart_tx:  OUT std_logic
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

14)     );
15) END ENTITY e_system;
16) 
17) ARCHITECTURE a_system OF e_system IS
18) 
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

19)     SIGNAL rst: std_logic := '0';
20) 
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

21)     SIGNAL s_instr_addr:   std_logic_vector(31 DOWNTO 0);
22)     SIGNAL s_instr_data:   std_logic_vector(31 DOWNTO 0);
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

23)     SIGNAL s_dbus_addr:    std_logic_vector(31 DOWNTO 0);
24)     SIGNAL s_dbus_rd_data: std_logic_vector(31 DOWNTO 0);
25)     SIGNAL s_dbus_wr_data: std_logic_vector(31 DOWNTO 0);
26)     SIGNAL s_dbus_wr_en:   std_logic_vector( 3 DOWNTO 0);
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

27)     SIGNAL s_data_addr:    std_logic_vector(31 DOWNTO 0);
28)     SIGNAL s_data_rd_data: std_logic_vector(31 DOWNTO 0);
29)     SIGNAL s_data_wr_data: std_logic_vector(31 DOWNTO 0);
30)     SIGNAL s_data_wr_en:   std_logic_vector( 3 DOWNTO 0);
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

31)     SIGNAL s_leds_rd_data: std_logic_vector( 7 DOWNTO 0);
32)     SIGNAL s_leds_wr_data: std_logic_vector( 7 DOWNTO 0);
33)     SIGNAL s_leds_wr_en:   std_logic;
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

34)     SIGNAL s_lcd_rd_data: std_logic_vector(31 DOWNTO 0);
35)     SIGNAL s_lcd_wr_data: std_logic_vector(31 DOWNTO 0);
36)     SIGNAL s_lcd_wr_en:   std_logic_vector( 3 DOWNTO 0);
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

37)     SIGNAL s_switches_addr:    std_logic_vector( 2 DOWNTO 0);
38)     SIGNAL s_switches_rd_data: std_logic_vector(31 DOWNTO 0);
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

39)     SIGNAL s_uart_addr:    std_logic_vector( 3 DOWNTO 0);
40)     SIGNAL s_uart_rd_data: std_logic_vector(31 DOWNTO 0);
41)     SIGNAL s_uart_wr_data: std_logic_vector(31 DOWNTO 0);
42)     SIGNAL s_uart_wr_en:   std_logic_vector( 3 DOWNTO 0);
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

43)     SIGNAL s_cyc_cnt_rd_data: std_logic_vector(31 DOWNTO 0);
44)     SIGNAL s_cyc_cnt_wr_data: std_logic_vector(31 DOWNTO 0);
45)     SIGNAL s_cyc_cnt_wr_en:   std_logic;
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

46) 
47)     COMPONENT e_mips_core IS
48)         PORT (
49)             rst:            IN  std_logic;
50)             clk:            IN  std_logic;
51)             i_stall:        IN  std_logic;
52)             o_instr_addr:   OUT std_logic_vector(31 DOWNTO 0);
53)             i_instr_data:   IN  std_logic_vector(31 DOWNTO 0);
54)             o_data_addr:    OUT std_logic_vector(31 DOWNTO 0);
55)             i_data_rd_data: IN  std_logic_vector(31 DOWNTO 0);
56)             o_data_wr_data: OUT std_logic_vector(31 DOWNTO 0);
57)             o_data_wr_en:   OUT std_logic_vector( 3 DOWNTO 0)
58)         );
59)     END COMPONENT e_mips_core;
60) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

61)     COMPONENT e_rom IS
62)         GENERIC (
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

63)             addr_width: natural
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

64)         );
65)         PORT (
66)             clk:    IN  std_logic;
67)             i_addr: IN  std_logic_vector(addr_width - 1 DOWNTO 0);
68)             o_data: OUT std_logic_vector(            31 DOWNTO 0)
69)         );
70)     END COMPONENT e_rom;
71) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

72)     COMPONENT e_ram_0 IS
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

73)         GENERIC (
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

74)             addr_width: natural
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

75)         );
76)         PORT (
77)             clk:       IN  std_logic;
78)             i_addr:    IN  std_logic_vector(addr_width - 1 DOWNTO 0);
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

79)             o_rd_data: OUT std_logic_vector(             7 DOWNTO 0);
80)             i_wr_data: IN  std_logic_vector(             7 DOWNTO 0);
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

81)             i_wr_en:   IN  std_logic
82)         );
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

83)     END COMPONENT e_ram_0;
84) 
85)     COMPONENT e_ram_1 IS
86)         GENERIC (
87)             addr_width: natural
88)         );
89)         PORT (
90)             clk:       IN  std_logic;
91)             i_addr:    IN  std_logic_vector(addr_width - 1 DOWNTO 0);
92)             o_rd_data: OUT std_logic_vector(             7 DOWNTO 0);
93)             i_wr_data: IN  std_logic_vector(             7 DOWNTO 0);
94)             i_wr_en:   IN  std_logic
95)         );
96)     END COMPONENT e_ram_1;
97) 
98)     COMPONENT e_ram_2 IS
99)         GENERIC (
100)             addr_width: natural
101)         );
102)         PORT (
103)             clk:       IN  std_logic;
104)             i_addr:    IN  std_logic_vector(addr_width - 1 DOWNTO 0);
105)             o_rd_data: OUT std_logic_vector(             7 DOWNTO 0);
106)             i_wr_data: IN  std_logic_vector(             7 DOWNTO 0);
107)             i_wr_en:   IN  std_logic
108)         );
109)     END COMPONENT e_ram_2;
110) 
111)     COMPONENT e_ram_3 IS
112)         GENERIC (
113)             addr_width: natural
114)         );
115)         PORT (
116)             clk:       IN  std_logic;
117)             i_addr:    IN  std_logic_vector(addr_width - 1 DOWNTO 0);
118)             o_rd_data: OUT std_logic_vector(             7 DOWNTO 0);
119)             i_wr_data: IN  std_logic_vector(             7 DOWNTO 0);
120)             i_wr_en:   IN  std_logic
121)         );
122)     END COMPONENT e_ram_3;
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

123) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

124)     COMPONENT e_io_leds IS
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

125)         PORT (
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

126)             rst:        IN  std_logic;
127)             clk:        IN  std_logic;
128)             o_rd_data:  OUT std_logic_vector(7 DOWNTO 0);
129)             i_wr_data:  IN  std_logic_vector(7 DOWNTO 0);
130)             i_wr_en:    IN  std_logic;
131)             pin_o_leds: OUT std_logic_vector(7 DOWNTO 0)
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

132)         );
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

133)     END COMPONENT e_io_leds;
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

134) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

135)     COMPONENT e_io_lcd IS
136)         PORT (
137)             rst:       IN  std_logic;
138)             clk:       IN  std_logic;
139)             o_rd_data: OUT std_logic_vector(31 DOWNTO 0);
140)             i_wr_data: IN  std_logic_vector(31 DOWNTO 0);
141)             i_wr_en:   IN  std_logic_vector( 3 DOWNTO 0);
142)             pin_o_lcd: OUT t_io_lcd_pins
143)         );
144)     END COMPONENT e_io_lcd;
145) 
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

146)     COMPONENT e_io_switches IS
147)         PORT (
148)             rst:            IN  std_logic;
149)             clk:            IN  std_logic;
150)             i_addr:         IN  std_logic_vector( 0 DOWNTO 0);
151)             o_rd_data:      OUT std_logic_vector(31 DOWNTO 0);
152)             pin_i_switches: IN  t_io_switches_pins
153)         );
154)     END COMPONENT e_io_switches;
155) 
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

156)     COMPONENT e_io_uart IS
157)         PORT (
158)             rst:       IN  std_logic;
159)             clk:       IN  std_logic;
160)             i_addr:    IN  std_logic_vector( 1 DOWNTO 0);
161)             o_rd_data: OUT std_logic_vector(31 DOWNTO 0);
162)             i_wr_data: IN  std_logic_vector(31 DOWNTO 0);
163)             i_wr_en:   IN  std_logic_vector( 3 DOWNTO 0);
164)             pin_o_tx:  OUT std_logic
165)         );
166)     END COMPONENT e_io_uart;
167) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

168)     COMPONENT e_io_cyc_cnt IS
169)         PORT (
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

170)             rst:       IN  std_logic;
171)             clk:       IN  std_logic;
172)             o_rd_data: OUT std_logic_vector(31 DOWNTO 0);
173)             i_wr_data: IN  std_logic_vector(31 DOWNTO 0);
174)             i_wr_en:   IN  std_logic
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

175)         );
176)     END COMPONENT e_io_cyc_cnt;
177) 
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

178) BEGIN
179) 
180)     core: e_mips_core
181)         PORT MAP (
182)             rst            => rst,
183)             clk            => clk,
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

184)             i_stall        => '0',
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

185)             o_instr_addr   => s_instr_addr,
186)             i_instr_data   => s_instr_data,
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

187)             o_data_addr    => s_dbus_addr,
188)             i_data_rd_data => s_dbus_rd_data,
189)             o_data_wr_data => s_dbus_wr_data,
190)             o_data_wr_en   => s_dbus_wr_en
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

191)         );
192) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

193)     instr: e_rom
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

194)         GENERIC MAP (
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

195)             addr_width => 10
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

196)         )
197)         PORT MAP (
198)             clk    => clk,
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

199)             i_addr => s_instr_addr(11 DOWNTO 2),
200)             o_data => s_instr_data
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

201)         );
202) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

203)     p_dbus: PROCESS(s_dbus_addr, s_dbus_wr_data, s_dbus_wr_en,
204)                     s_data_rd_data,
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

205)                     s_leds_rd_data,
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

206)                     s_lcd_rd_data,
Stefan Schuermans fix sensitivity list

Stefan Schuermans authored 12 years ago

207)                     s_switches_rd_data,
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

208)                     s_uart_rd_data,
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

209)                     s_cyc_cnt_rd_data)
210)         VARIABLE v_wr_en_word: std_logic;
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

211)     BEGIN
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

212)         v_wr_en_word := s_dbus_wr_en(0) AND s_dbus_wr_en(1) AND
213)                         s_dbus_wr_en(2) AND s_dbus_wr_en(3);
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

214)         s_dbus_rd_data <= (OTHERS => '0');
215)         s_data_addr    <= (OTHERS => '0');
216)         s_data_wr_data <= (OTHERS => '0');
217)         s_data_wr_en   <= (OTHERS => '0');
218)         s_leds_wr_data <= (OTHERS => '0');
219)         s_leds_wr_en   <= '0';
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

220)         s_lcd_wr_data <= (OTHERS => '0');
221)         s_lcd_wr_en   <= (OTHERS => '0');
Stefan Schuermans remove unwanted latch

Stefan Schuermans authored 12 years ago

222)         s_switches_addr <= (OTHERS => '0');
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

223)         s_uart_addr    <= (OTHERS => '0');
224)         s_uart_wr_data <= (OTHERS => '0');
225)         s_uart_wr_en   <= (OTHERS => '0');
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

226)         s_cyc_cnt_wr_data <= (OTHERS => '0');
227)         s_cyc_cnt_wr_en   <= '0';
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

228)         IF s_dbus_addr(31) = '0' THEN
229)             s_dbus_rd_data <= s_data_rd_data;
230)             s_data_addr    <= s_dbus_addr;
231)             s_data_wr_data <= s_dbus_wr_data;
232)             s_data_wr_en   <= s_dbus_wr_en;
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

233)         ELSIF s_dbus_addr(31 DOWNTO 16) = X"8000" THEN
234)             CASE s_dbus_addr(15 DOWNTO 8) IS
235)                 WHEN X"00" =>
236)                     s_dbus_rd_data <= X"000000" & s_leds_rd_data;
237)                     s_leds_wr_data <= s_dbus_wr_data(7 DOWNTO 0);
238)                     s_leds_wr_en   <= s_dbus_wr_en(0);
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

239)                 WHEN X"01" =>
240)                     s_dbus_rd_data <= s_lcd_rd_data;
241)                     s_lcd_wr_data  <= s_dbus_wr_data;
242)                     s_lcd_wr_en    <= s_dbus_wr_en;
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

243)                 WHEN X"02" =>
244)                     s_dbus_rd_data  <= s_switches_rd_data;
245)                     s_switches_addr <= s_dbus_addr(2 DOWNTO 0);
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

246)                 WHEN X"03" =>
247)                     s_dbus_rd_data <= s_uart_rd_data;
248)                     s_uart_addr    <= s_dbus_addr(3 DOWNTO 0);
249)                     s_uart_wr_data <= s_dbus_wr_data;
250)                     s_uart_wr_en   <= s_dbus_wr_en;
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

251)                 WHEN X"10" =>
252)                     s_dbus_rd_data    <= s_cyc_cnt_rd_data;
253)                     s_cyc_cnt_wr_data <= s_dbus_wr_data;
254)                     s_cyc_cnt_wr_en   <= v_wr_en_word;
255)                 WHEN OTHERS => NULL;
256)             END CASE;
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

257)         END IF;
258)     END PROCESS p_dbus;
259) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

260)     data_0: e_ram_0
261)         GENERIC MAP (
262)             addr_width => 10
263)         )
264)         PORT MAP (
265)             clk       => clk,
266)             i_addr    => s_data_addr(11 DOWNTO 2),
267)             o_rd_data => s_data_rd_data(7 DOWNTO 0),
268)             i_wr_data => s_data_wr_data(7 DOWNTO 0),
269)             i_wr_en   => s_data_wr_en(0)
270)         );
271) 
272)     data_1: e_ram_1
273)         GENERIC MAP (
274)             addr_width => 10
275)         )
276)         PORT MAP (
277)             clk       => clk,
278)             i_addr    => s_data_addr(11 DOWNTO 2),
279)             o_rd_data => s_data_rd_data(15 DOWNTO 8),
280)             i_wr_data => s_data_wr_data(15 DOWNTO 8),
281)             i_wr_en   => s_data_wr_en(1)
282)         );
283) 
284)     data_2: e_ram_2
285)         GENERIC MAP (
286)             addr_width => 10
287)         )
288)         PORT MAP (
289)             clk       => clk,
290)             i_addr    => s_data_addr(11 DOWNTO 2),
291)             o_rd_data => s_data_rd_data(23 DOWNTO 16),
292)             i_wr_data => s_data_wr_data(23 DOWNTO 16),
293)             i_wr_en   => s_data_wr_en(2)
294)         );
295) 
296)     data_3: e_ram_3
297)         GENERIC MAP (
298)             addr_width => 10
299)         )
300)         PORT MAP (
301)             clk       => clk,
302)             i_addr    => s_data_addr(11 DOWNTO 2),
303)             o_rd_data => s_data_rd_data(31 DOWNTO 24),
304)             i_wr_data => s_data_wr_data(31 DOWNTO 24),
305)             i_wr_en   => s_data_wr_en(3)
306)         );
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

307) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

308)     leds: e_io_leds
309)         PORT MAP (
310)             rst        => rst,
311)             clk        => clk,
312)             o_rd_data  => s_leds_rd_data,
313)             i_wr_data  => s_leds_wr_data,
314)             i_wr_en    => s_leds_wr_en,
315)             pin_o_leds => pin_o_leds
316)         );
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

317) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

318)     lcd: e_io_lcd
319)         PORT MAP (
320)             rst       => rst,
321)             clk       => clk,
322)             o_rd_data => s_lcd_rd_data,
323)             i_wr_data => s_lcd_wr_data,
324)             i_wr_en   => s_lcd_wr_en,
325)             pin_o_lcd => pin_o_lcd
326)         );
327) 
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

328)     switches: e_io_switches
329)         PORT MAP (
330)             rst            => rst,
331)             clk            => clk,
332)             i_addr         => s_switches_addr(2 DOWNTO 2),
333)             o_rd_data      => s_switches_rd_data,
334)             pin_i_switches => pin_i_switches
335)         );
336) 
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

337)     uart: e_io_uart
338)         PORT MAP (
339)             rst       => rst,
340)             clk       => clk,
341)             i_addr    => s_uart_addr(3 DOWNTO 2),
342)             o_rd_data => s_uart_rd_data,
343)             i_wr_data => s_uart_wr_data,
344)             i_wr_en   => s_uart_wr_en,
345)             pin_o_tx  => pin_o_uart_tx
346)         );
347) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

348)     cyc_cnt: e_io_cyc_cnt
349)         PORT MAP (
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

350)             rst       => rst,
351)             clk       => clk,
352)             o_rd_data => s_cyc_cnt_rd_data,
353)             i_wr_data => s_cyc_cnt_wr_data,
354)             i_wr_en   => s_cyc_cnt_wr_en
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

355)         );
356)