df6d296fa87770ec1eae3a2f61c48230aa26bdcd
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 implented basic system with...

Stefan Schuermans authored 12 years ago

5) 
6) ENTITY e_system IS
7)     PORT (
Stefan Schuermans whitespace fix

Stefan Schuermans authored 12 years ago

8)         rst:        IN  std_logic;
9)         clk:        IN  std_logic;
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

10)         pin_o_leds: OUT std_logic_vector(7 DOWNTO 0);
11)         pin_o_lcd:  OUT t_io_lcd_pins
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

12)     );
13) END ENTITY e_system;
14) 
15) ARCHITECTURE a_system OF e_system IS
16) 
17)     SIGNAL s_instr_addr:   std_logic_vector(31 DOWNTO 0);
18)     SIGNAL s_instr_data:   std_logic_vector(31 DOWNTO 0);
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

19)     SIGNAL s_dbus_addr:    std_logic_vector(31 DOWNTO 0);
20)     SIGNAL s_dbus_rd_data: std_logic_vector(31 DOWNTO 0);
21)     SIGNAL s_dbus_wr_data: std_logic_vector(31 DOWNTO 0);
22)     SIGNAL s_dbus_wr_en:   std_logic_vector( 3 DOWNTO 0);
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

27)     SIGNAL s_leds_rd_data: std_logic_vector( 7 DOWNTO 0);
28)     SIGNAL s_leds_wr_data: std_logic_vector( 7 DOWNTO 0);
29)     SIGNAL s_leds_wr_en:   std_logic;
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

30)     SIGNAL s_lcd_rd_data: std_logic_vector(31 DOWNTO 0);
31)     SIGNAL s_lcd_wr_data: std_logic_vector(31 DOWNTO 0);
32)     SIGNAL s_lcd_wr_en:   std_logic_vector( 3 DOWNTO 0);
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

33)     SIGNAL s_cyc_cnt_rd_data: std_logic_vector(31 DOWNTO 0);
34)     SIGNAL s_cyc_cnt_wr_data: std_logic_vector(31 DOWNTO 0);
35)     SIGNAL s_cyc_cnt_wr_en:   std_logic;
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

51)     COMPONENT e_rom IS
52)         GENERIC (
53)             addr_width: INTEGER
54)         );
55)         PORT (
56)             clk:    IN  std_logic;
57)             i_addr: IN  std_logic_vector(addr_width - 1 DOWNTO 0);
58)             o_data: OUT std_logic_vector(            31 DOWNTO 0)
59)         );
60)     END COMPONENT e_rom;
61) 
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

62)     COMPONENT e_ram IS
63)         GENERIC (
64)             addr_width: natural;
65)             data_width: natural
66)         );
67)         PORT (
68)             clk:       IN  std_logic;
69)             i_addr:    IN  std_logic_vector(addr_width - 1 DOWNTO 0);
70)             o_rd_data: OUT std_logic_vector(data_width - 1 DOWNTO 0);
71)             i_wr_data: IN  std_logic_vector(data_width - 1 DOWNTO 0);
72)             i_wr_en:   IN  std_logic
73)         );
74)     END COMPONENT e_ram;
75) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

78)             rst:        IN  std_logic;
79)             clk:        IN  std_logic;
80)             o_rd_data:  OUT std_logic_vector(7 DOWNTO 0);
81)             i_wr_data:  IN  std_logic_vector(7 DOWNTO 0);
82)             i_wr_en:    IN  std_logic;
83)             pin_o_leds: OUT std_logic_vector(7 DOWNTO 0)
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

86) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

87)     COMPONENT e_io_lcd IS
88)         PORT (
89)             rst:       IN  std_logic;
90)             clk:       IN  std_logic;
91)             o_rd_data: OUT std_logic_vector(31 DOWNTO 0);
92)             i_wr_data: IN  std_logic_vector(31 DOWNTO 0);
93)             i_wr_en:   IN  std_logic_vector( 3 DOWNTO 0);
94)             pin_o_lcd: OUT t_io_lcd_pins
95)         );
96)     END COMPONENT e_io_lcd;
97) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

98)     COMPONENT e_io_cyc_cnt IS
99)         PORT (
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

100)             rst:       IN  std_logic;
101)             clk:       IN  std_logic;
102)             o_rd_data: OUT std_logic_vector(31 DOWNTO 0);
103)             i_wr_data: IN  std_logic_vector(31 DOWNTO 0);
104)             i_wr_en:   IN  std_logic
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

105)         );
106)     END COMPONENT e_io_cyc_cnt;
107) 
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

108) BEGIN
109) 
110)     core: e_mips_core
111)         PORT MAP (
112)             rst            => rst,
113)             clk            => clk,
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

117)             o_data_addr    => s_dbus_addr,
118)             i_data_rd_data => s_dbus_rd_data,
119)             o_data_wr_data => s_dbus_wr_data,
120)             o_data_wr_en   => s_dbus_wr_en
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

126)         )
127)         PORT MAP (
128)             clk    => clk,
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

135)                     s_leds_rd_data,
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

136)                     s_lcd_rd_data,
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

139)     BEGIN
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

142)         s_dbus_rd_data <= (OTHERS => '0');
143)         s_data_addr    <= (OTHERS => '0');
144)         s_data_wr_data <= (OTHERS => '0');
145)         s_data_wr_en   <= (OTHERS => '0');
146)         s_leds_wr_data <= (OTHERS => '0');
147)         s_leds_wr_en   <= '0';
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

148)         s_lcd_wr_data <= (OTHERS => '0');
149)         s_lcd_wr_en   <= (OTHERS => '0');
150)         s_cyc_cnt_wr_data <= (OTHERS => '0');
151)         s_cyc_cnt_wr_en   <= '0';
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

152)         IF s_dbus_addr(31) = '0' THEN
153)             s_dbus_rd_data <= s_data_rd_data;
154)             s_data_addr    <= s_dbus_addr;
155)             s_data_wr_data <= s_dbus_wr_data;
156)             s_data_wr_en   <= s_dbus_wr_en;
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

157)         ELSIF s_dbus_addr(31 DOWNTO 16) = X"8000" THEN
158)             CASE s_dbus_addr(15 DOWNTO 8) IS
159)                 WHEN X"00" =>
160)                     s_dbus_rd_data <= X"000000" & s_leds_rd_data;
161)                     s_leds_wr_data <= s_dbus_wr_data(7 DOWNTO 0);
162)                     s_leds_wr_en   <= s_dbus_wr_en(0);
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

163)                 WHEN X"01" =>
164)                     s_dbus_rd_data <= s_lcd_rd_data;
165)                     s_lcd_wr_data  <= s_dbus_wr_data;
166)                     s_lcd_wr_en    <= s_dbus_wr_en;
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

167)                 WHEN X"10" =>
168)                     s_dbus_rd_data    <= s_cyc_cnt_rd_data;
169)                     s_cyc_cnt_wr_data <= s_dbus_wr_data;
170)                     s_cyc_cnt_wr_en   <= v_wr_en_word;
171)                 WHEN OTHERS => NULL;
172)             END CASE;
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

173)         END IF;
174)     END PROCESS p_dbus;
175) 
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

176)     data: FOR i IN 0 TO 3 GENERATE
177)         databank: e_ram
178)             GENERIC MAP (
179)                 addr_width => 10,
180)                 data_width => 8
181)             )
182)             PORT MAP (
183)                 clk       => clk,
184)                 i_addr    => s_data_addr(11 DOWNTO 2),
185)                 o_rd_data => s_data_rd_data(i*8+7 DOWNTO i*8),
186)                 i_wr_data => s_data_wr_data(i*8+7 DOWNTO i*8),
187)                 i_wr_en   => s_data_wr_en(i)
188)             );
189)     END GENERATE data;
190) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

191)     leds: e_io_leds
192)         PORT MAP (
193)             rst        => rst,
194)             clk        => clk,
195)             o_rd_data  => s_leds_rd_data,
196)             i_wr_data  => s_leds_wr_data,
197)             i_wr_en    => s_leds_wr_en,
198)             pin_o_leds => pin_o_leds
199)         );
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

200) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

201)     lcd: e_io_lcd
202)         PORT MAP (
203)             rst       => rst,
204)             clk       => clk,
205)             o_rd_data => s_lcd_rd_data,
206)             i_wr_data => s_lcd_wr_data,
207)             i_wr_en   => s_lcd_wr_en,
208)             pin_o_lcd => pin_o_lcd
209)         );
210) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

211)     cyc_cnt: e_io_cyc_cnt
212)         PORT MAP (
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

213)             rst       => rst,
214)             clk       => clk,
215)             o_rd_data => s_cyc_cnt_rd_data,
216)             i_wr_data => s_cyc_cnt_wr_data,
217)             i_wr_en   => s_cyc_cnt_wr_en
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

218)         );
219)