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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

78) 
79) BEGIN
80) 
81)     core: e_mips_core
82)         PORT MAP (
83)             rst            => rst,
84)             clk            => clk,
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

88)             o_data_addr    => s_dbus_addr,
89)             i_data_rd_data => s_dbus_rd_data,
90)             o_data_wr_data => s_dbus_wr_data,
91)             o_data_wr_en   => s_dbus_wr_en
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

97)         )
98)         PORT MAP (
99)             clk    => clk,
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

104)     p_dbus: PROCESS(s_dbus_addr, s_dbus_wr_data, s_dbus_wr_en,
105)                     s_data_rd_data,
106)                     s_leds_rd_data)
107)     BEGIN
108)         s_dbus_rd_data <= (OTHERS => '0');
109)         s_data_addr    <= (OTHERS => '0');
110)         s_data_wr_data <= (OTHERS => '0');
111)         s_data_wr_en   <= (OTHERS => '0');
112)         s_leds_wr_data <= (OTHERS => '0');
113)         s_leds_wr_en   <= '0';
114)         IF s_dbus_addr(31) = '0' THEN
115)             s_dbus_rd_data <= s_data_rd_data;
116)             s_data_addr    <= s_dbus_addr;
117)             s_data_wr_data <= s_dbus_wr_data;
118)             s_data_wr_en   <= s_dbus_wr_en;
119)         ELSIF s_dbus_addr(31 DOWNTO 0) = X"80000000" THEN
120)             s_dbus_rd_data <= X"000000" & s_leds_rd_data;
121)             s_leds_wr_data <= s_dbus_wr_data(7 DOWNTO 0);
122)             s_leds_wr_en   <= s_dbus_wr_en(0);
123)         END IF;
124)     END PROCESS p_dbus;
125) 
Stefan Schuermans implented basic system with...

Stefan Schuermans authored 12 years ago

126)     data: FOR i IN 0 TO 3 GENERATE
127)         databank: e_ram
128)             GENERIC MAP (
129)                 addr_width => 10,
130)                 data_width => 8
131)             )
132)             PORT MAP (
133)                 clk       => clk,
134)                 i_addr    => s_data_addr(11 DOWNTO 2),
135)                 o_rd_data => s_data_rd_data(i*8+7 DOWNTO i*8),
136)                 i_wr_data => s_data_wr_data(i*8+7 DOWNTO i*8),
137)                 i_wr_en   => s_data_wr_en(i)
138)             );
139)     END GENERATE data;
140) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

141)     leds: e_io_leds
142)         PORT MAP (
143)             rst        => rst,
144)             clk        => clk,
145)             o_rd_data  => s_leds_rd_data,
146)             i_wr_data  => s_leds_wr_data,
147)             i_wr_en    => s_leds_wr_en,
148)             pin_o_leds => pin_o_leds
149)         );