24e5d842d5bbe7de2650c872adf41f2c0b2cdb0d
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;
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

13)         pin_i_uart_rx:  IN  std_logic;
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

14)         pin_o_uart_tx:  OUT std_logic
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

135) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

157)     COMPONENT e_io_uart IS
158)         PORT (
159)             rst:       IN  std_logic;
160)             clk:       IN  std_logic;
161)             i_addr:    IN  std_logic_vector( 1 DOWNTO 0);
162)             o_rd_data: OUT std_logic_vector(31 DOWNTO 0);
163)             i_wr_data: IN  std_logic_vector(31 DOWNTO 0);
164)             i_wr_en:   IN  std_logic_vector( 3 DOWNTO 0);
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

165)             pin_i_rx:  IN  std_logic;
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

166)             pin_o_tx:  OUT std_logic
167)         );
168)     END COMPONENT e_io_uart;
169) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

170)     COMPONENT e_io_cyc_cnt IS
171)         PORT (
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

177)         );
178)     END COMPONENT e_io_cyc_cnt;
179) 
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

207)                     s_leds_rd_data,
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

208)                     s_lcd_rd_data,
Stefan Schuermans fix sensitivity list

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

210)                     s_uart_rd_data,
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

213)     BEGIN
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

259)         END IF;
260)     END PROCESS p_dbus;
261) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

319) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

339)     uart: e_io_uart
340)         PORT MAP (
341)             rst       => rst,
342)             clk       => clk,
343)             i_addr    => s_uart_addr(3 DOWNTO 2),
344)             o_rd_data => s_uart_rd_data,
345)             i_wr_data => s_uart_wr_data,
346)             i_wr_en   => s_uart_wr_en,
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

347)             pin_i_rx  => pin_i_uart_rx,
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

348)             pin_o_tx  => pin_o_uart_tx
349)         );
350) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

351)     cyc_cnt: e_io_cyc_cnt
352)         PORT MAP (
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

353)             rst       => rst,
354)             clk       => clk,
355)             o_rd_data => s_cyc_cnt_rd_data,
356)             i_wr_data => s_cyc_cnt_wr_data,
357)             i_wr_en   => s_cyc_cnt_wr_en
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

358)         );
359)