5e29ab5c1287f6e59d5a72ce0a91ff355756bcf1
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 added cycle counter peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

192)     BEGIN
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

201)         s_lcd_wr_data <= (OTHERS => '0');
202)         s_lcd_wr_en   <= (OTHERS => '0');
203)         s_cyc_cnt_wr_data <= (OTHERS => '0');
204)         s_cyc_cnt_wr_en   <= '0';
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

229)         END IF;
230)     END PROCESS p_dbus;
231) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

289) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

309)     cyc_cnt: e_io_cyc_cnt
310)         PORT MAP (
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

316)         );
317)