3bee72bd74ac9da4521e5618715bafda31c0ff05
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;
4) 
5) ENTITY e_system IS
6)     PORT (
Stefan Schuermans whitespace fix

Stefan Schuermans authored 12 years ago

7)         rst:        IN  std_logic;
8)         clk:        IN  std_logic;
9)         pin_o_leds: OUT std_logic_vector(7 DOWNTO 0)
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

25)     SIGNAL s_leds_rd_data: std_logic_vector( 7 DOWNTO 0);
26)     SIGNAL s_leds_wr_data: std_logic_vector( 7 DOWNTO 0);
27)     SIGNAL s_leds_wr_en:   std_logic;
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

28)     SIGNAL s_cyc_cnt_rd_data: std_logic_vector(31 DOWNTO 0);
29)     SIGNAL s_cyc_cnt_wr_data: std_logic_vector(31 DOWNTO 0);
30)     SIGNAL s_cyc_cnt_wr_en:   std_logic;
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

46)     COMPONENT e_rom IS
47)         GENERIC (
48)             addr_width: INTEGER
49)         );
50)         PORT (
51)             clk:    IN  std_logic;
52)             i_addr: IN  std_logic_vector(addr_width - 1 DOWNTO 0);
53)             o_data: OUT std_logic_vector(            31 DOWNTO 0)
54)         );
55)     END COMPONENT e_rom;
56) 
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

73)             rst:        IN  std_logic;
74)             clk:        IN  std_logic;
75)             o_rd_data:  OUT std_logic_vector(7 DOWNTO 0);
76)             i_wr_data:  IN  std_logic_vector(7 DOWNTO 0);
77)             i_wr_en:    IN  std_logic;
78)             pin_o_leds: OUT std_logic_vector(7 DOWNTO 0)
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

81) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

82)     COMPONENT e_io_cyc_cnt IS
83)         PORT (
84)             rst:        IN  std_logic;
85)             clk:        IN  std_logic;
86)             o_rd_data:  OUT std_logic_vector(31 DOWNTO 0);
87)             i_wr_data:  IN  std_logic_vector(31 DOWNTO 0);
88)             i_wr_en:    IN  std_logic
89)         );
90)     END COMPONENT e_io_cyc_cnt;
91) 
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

92) BEGIN
93) 
94)     core: e_mips_core
95)         PORT MAP (
96)             rst            => rst,
97)             clk            => clk,
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

101)             o_data_addr    => s_dbus_addr,
102)             i_data_rd_data => s_dbus_rd_data,
103)             o_data_wr_data => s_dbus_wr_data,
104)             o_data_wr_en   => s_dbus_wr_en
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

110)         )
111)         PORT MAP (
112)             clk    => clk,
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

119)                     s_leds_rd_data,
120)                     s_cyc_cnt_rd_data)
121)         VARIABLE v_wr_en_word: std_logic;
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

122)     BEGIN
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

125)         s_dbus_rd_data <= (OTHERS => '0');
126)         s_data_addr    <= (OTHERS => '0');
127)         s_data_wr_data <= (OTHERS => '0');
128)         s_data_wr_en   <= (OTHERS => '0');
129)         s_leds_wr_data <= (OTHERS => '0');
130)         s_leds_wr_en   <= '0';
131)         IF s_dbus_addr(31) = '0' THEN
132)             s_dbus_rd_data <= s_data_rd_data;
133)             s_data_addr    <= s_dbus_addr;
134)             s_data_wr_data <= s_dbus_wr_data;
135)             s_data_wr_en   <= s_dbus_wr_en;
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

136)         ELSIF s_dbus_addr(31 DOWNTO 16) = X"8000" THEN
137)             CASE s_dbus_addr(15 DOWNTO 8) IS
138)                 WHEN X"00" =>
139)                     s_dbus_rd_data <= X"000000" & s_leds_rd_data;
140)                     s_leds_wr_data <= s_dbus_wr_data(7 DOWNTO 0);
141)                     s_leds_wr_en   <= s_dbus_wr_en(0);
142)                 WHEN X"10" =>
143)                     s_dbus_rd_data    <= s_cyc_cnt_rd_data;
144)                     s_cyc_cnt_wr_data <= s_dbus_wr_data;
145)                     s_cyc_cnt_wr_en   <= v_wr_en_word;
146)                 WHEN OTHERS => NULL;
147)             END CASE;
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

148)         END IF;
149)     END PROCESS p_dbus;
150) 
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

151)     data: FOR i IN 0 TO 3 GENERATE
152)         databank: e_ram
153)             GENERIC MAP (
154)                 addr_width => 10,
155)                 data_width => 8
156)             )
157)             PORT MAP (
158)                 clk       => clk,
159)                 i_addr    => s_data_addr(11 DOWNTO 2),
160)                 o_rd_data => s_data_rd_data(i*8+7 DOWNTO i*8),
161)                 i_wr_data => s_data_wr_data(i*8+7 DOWNTO i*8),
162)                 i_wr_en   => s_data_wr_en(i)
163)             );
164)     END GENERATE data;
165) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

166)     leds: e_io_leds
167)         PORT MAP (
168)             rst        => rst,
169)             clk        => clk,
170)             o_rd_data  => s_leds_rd_data,
171)             i_wr_data  => s_leds_wr_data,
172)             i_wr_en    => s_leds_wr_en,
173)             pin_o_leds => pin_o_leds
174)         );
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

175) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

176)     cyc_cnt: e_io_cyc_cnt
177)         PORT MAP (
178)             rst        => rst,
179)             clk        => clk,
180)             o_rd_data  => s_cyc_cnt_rd_data,
181)             i_wr_data  => s_cyc_cnt_wr_data,
182)             i_wr_en    => s_cyc_cnt_wr_en
183)         );
184)