6139e5a8cd4bfdc50b69ff481e9c8752b07d2d23
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;
12)         pin_i_switches: IN  t_io_switches_pins
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

36)     SIGNAL s_switches_addr:    std_logic_vector( 2 DOWNTO 0);
37)     SIGNAL s_switches_rd_data: std_logic_vector(31 DOWNTO 0);
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

38)     SIGNAL s_cyc_cnt_rd_data: std_logic_vector(31 DOWNTO 0);
39)     SIGNAL s_cyc_cnt_wr_data: std_logic_vector(31 DOWNTO 0);
40)     SIGNAL s_cyc_cnt_wr_en:   std_logic;
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

56)     COMPONENT e_rom IS
57)         GENERIC (
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

59)         );
60)         PORT (
61)             clk:    IN  std_logic;
62)             i_addr: IN  std_logic_vector(addr_width - 1 DOWNTO 0);
63)             o_data: OUT std_logic_vector(            31 DOWNTO 0)
64)         );
65)     END COMPONENT e_rom;
66) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

70)         );
71)         PORT (
72)             clk:       IN  std_logic;
73)             i_addr:    IN  std_logic_vector(addr_width - 1 DOWNTO 0);
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

76)             i_wr_en:   IN  std_logic
77)         );
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

121)             rst:        IN  std_logic;
122)             clk:        IN  std_logic;
123)             o_rd_data:  OUT std_logic_vector(7 DOWNTO 0);
124)             i_wr_data:  IN  std_logic_vector(7 DOWNTO 0);
125)             i_wr_en:    IN  std_logic;
126)             pin_o_leds: OUT std_logic_vector(7 DOWNTO 0)
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

129) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

130)     COMPONENT e_io_lcd IS
131)         PORT (
132)             rst:       IN  std_logic;
133)             clk:       IN  std_logic;
134)             o_rd_data: OUT std_logic_vector(31 DOWNTO 0);
135)             i_wr_data: IN  std_logic_vector(31 DOWNTO 0);
136)             i_wr_en:   IN  std_logic_vector( 3 DOWNTO 0);
137)             pin_o_lcd: OUT t_io_lcd_pins
138)         );
139)     END COMPONENT e_io_lcd;
140) 
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

141)     COMPONENT e_io_switches IS
142)         PORT (
143)             rst:            IN  std_logic;
144)             clk:            IN  std_logic;
145)             i_addr:         IN  std_logic_vector( 0 DOWNTO 0);
146)             o_rd_data:      OUT std_logic_vector(31 DOWNTO 0);
147)             pin_i_switches: IN  t_io_switches_pins
148)         );
149)     END COMPONENT e_io_switches;
150) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

151)     COMPONENT e_io_cyc_cnt IS
152)         PORT (
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

153)             rst:       IN  std_logic;
154)             clk:       IN  std_logic;
155)             o_rd_data: OUT std_logic_vector(31 DOWNTO 0);
156)             i_wr_data: IN  std_logic_vector(31 DOWNTO 0);
157)             i_wr_en:   IN  std_logic
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

158)         );
159)     END COMPONENT e_io_cyc_cnt;
160) 
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

161) BEGIN
162) 
163)     core: e_mips_core
164)         PORT MAP (
165)             rst            => rst,
166)             clk            => clk,
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

170)             o_data_addr    => s_dbus_addr,
171)             i_data_rd_data => s_dbus_rd_data,
172)             o_data_wr_data => s_dbus_wr_data,
173)             o_data_wr_en   => s_dbus_wr_en
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

179)         )
180)         PORT MAP (
181)             clk    => clk,
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

188)                     s_leds_rd_data,
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

189)                     s_lcd_rd_data,
Stefan Schuermans fix sensitivity list

Stefan Schuermans authored 12 years ago

190)                     s_switches_rd_data,
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

193)     BEGIN
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

196)         s_dbus_rd_data <= (OTHERS => '0');
197)         s_data_addr    <= (OTHERS => '0');
198)         s_data_wr_data <= (OTHERS => '0');
199)         s_data_wr_en   <= (OTHERS => '0');
200)         s_leds_wr_data <= (OTHERS => '0');
201)         s_leds_wr_en   <= '0';
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

204)         s_switches_addr <= (OTHERS => '0');
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

207)         IF s_dbus_addr(31) = '0' THEN
208)             s_dbus_rd_data <= s_data_rd_data;
209)             s_data_addr    <= s_dbus_addr;
210)             s_data_wr_data <= s_dbus_wr_data;
211)             s_data_wr_en   <= s_dbus_wr_en;
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

212)         ELSIF s_dbus_addr(31 DOWNTO 16) = X"8000" THEN
213)             CASE s_dbus_addr(15 DOWNTO 8) IS
214)                 WHEN X"00" =>
215)                     s_dbus_rd_data <= X"000000" & s_leds_rd_data;
216)                     s_leds_wr_data <= s_dbus_wr_data(7 DOWNTO 0);
217)                     s_leds_wr_en   <= s_dbus_wr_en(0);
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

218)                 WHEN X"01" =>
219)                     s_dbus_rd_data <= s_lcd_rd_data;
220)                     s_lcd_wr_data  <= s_dbus_wr_data;
221)                     s_lcd_wr_en    <= s_dbus_wr_en;
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

222)                 WHEN X"02" =>
223)                     s_dbus_rd_data  <= s_switches_rd_data;
224)                     s_switches_addr <= s_dbus_addr(2 DOWNTO 0);
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

225)                 WHEN X"10" =>
226)                     s_dbus_rd_data    <= s_cyc_cnt_rd_data;
227)                     s_cyc_cnt_wr_data <= s_dbus_wr_data;
228)                     s_cyc_cnt_wr_en   <= v_wr_en_word;
229)                 WHEN OTHERS => NULL;
230)             END CASE;
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

231)         END IF;
232)     END PROCESS p_dbus;
233) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

234)     data_0: e_ram_0
235)         GENERIC MAP (
236)             addr_width => 10
237)         )
238)         PORT MAP (
239)             clk       => clk,
240)             i_addr    => s_data_addr(11 DOWNTO 2),
241)             o_rd_data => s_data_rd_data(7 DOWNTO 0),
242)             i_wr_data => s_data_wr_data(7 DOWNTO 0),
243)             i_wr_en   => s_data_wr_en(0)
244)         );
245) 
246)     data_1: e_ram_1
247)         GENERIC MAP (
248)             addr_width => 10
249)         )
250)         PORT MAP (
251)             clk       => clk,
252)             i_addr    => s_data_addr(11 DOWNTO 2),
253)             o_rd_data => s_data_rd_data(15 DOWNTO 8),
254)             i_wr_data => s_data_wr_data(15 DOWNTO 8),
255)             i_wr_en   => s_data_wr_en(1)
256)         );
257) 
258)     data_2: e_ram_2
259)         GENERIC MAP (
260)             addr_width => 10
261)         )
262)         PORT MAP (
263)             clk       => clk,
264)             i_addr    => s_data_addr(11 DOWNTO 2),
265)             o_rd_data => s_data_rd_data(23 DOWNTO 16),
266)             i_wr_data => s_data_wr_data(23 DOWNTO 16),
267)             i_wr_en   => s_data_wr_en(2)
268)         );
269) 
270)     data_3: e_ram_3
271)         GENERIC MAP (
272)             addr_width => 10
273)         )
274)         PORT MAP (
275)             clk       => clk,
276)             i_addr    => s_data_addr(11 DOWNTO 2),
277)             o_rd_data => s_data_rd_data(31 DOWNTO 24),
278)             i_wr_data => s_data_wr_data(31 DOWNTO 24),
279)             i_wr_en   => s_data_wr_en(3)
280)         );
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

282)     leds: e_io_leds
283)         PORT MAP (
284)             rst        => rst,
285)             clk        => clk,
286)             o_rd_data  => s_leds_rd_data,
287)             i_wr_data  => s_leds_wr_data,
288)             i_wr_en    => s_leds_wr_en,
289)             pin_o_leds => pin_o_leds
290)         );
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

291) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

292)     lcd: e_io_lcd
293)         PORT MAP (
294)             rst       => rst,
295)             clk       => clk,
296)             o_rd_data => s_lcd_rd_data,
297)             i_wr_data => s_lcd_wr_data,
298)             i_wr_en   => s_lcd_wr_en,
299)             pin_o_lcd => pin_o_lcd
300)         );
301) 
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

302)     switches: e_io_switches
303)         PORT MAP (
304)             rst            => rst,
305)             clk            => clk,
306)             i_addr         => s_switches_addr(2 DOWNTO 2),
307)             o_rd_data      => s_switches_rd_data,
308)             pin_i_switches => pin_i_switches
309)         );
310) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

311)     cyc_cnt: e_io_cyc_cnt
312)         PORT MAP (
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

313)             rst       => rst,
314)             clk       => clk,
315)             o_rd_data => s_cyc_cnt_rd_data,
316)             i_wr_data => s_cyc_cnt_wr_data,
317)             i_wr_en   => s_cyc_cnt_wr_en
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

318)         );
319)