fe7741d0413ae2c6f68dd81c74afe140b9aa7e59
Stefan Schuermans added "LEDs" I/O peripheral...

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_io_leds IS
6)     PORT (
7)         rst:        IN  std_logic;
8)         clk:        IN  std_logic;
9)         o_rd_data:  OUT std_logic_vector(7 DOWNTO 0);
10)         i_wr_data:  IN  std_logic_vector(7 DOWNTO 0);
11)         i_wr_en:    IN  std_logic;
12)         pin_o_leds: OUT std_logic_vector(7 DOWNTO 0)
13)     );
14) END ENTITY e_io_leds;
15) 
16) ARCHITECTURE a_io_leds OF e_io_leds IS
17) 
18)     SIGNAL n_leds: std_logic_vector(7 DOWNTO 0);
Stefan Schuermans add initial values for regi...

Stefan Schuermans authored 12 years ago

19)     SIGNAL r_leds: std_logic_vector(7 DOWNTO 0) := (OTHERS => '0');
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

20) 
21) BEGIN
22) 
Stefan Schuermans read peripherals with one c...

Stefan Schuermans authored 12 years ago

23)     p_next: PROCESS(r_leds, i_wr_data, i_wr_en)
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

24)     BEGIN
25)         IF i_wr_en = '1' THEN
26)             n_leds <= i_wr_data;
27)         ELSE
28)             n_leds <= r_leds;
29)         END IF;
Stefan Schuermans read peripherals with one c...

Stefan Schuermans authored 12 years ago

30)     END PROCESS p_next;
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

31) 
32)     p_sync: PROCESS(rst, clk)
33)     BEGIN
34)         IF rst = '1' THEN
35)             r_leds <= (OTHERS => '0');
36)         ELSIF rising_edge(clk) THEN
37)             r_leds <= n_leds;
38)         END IF;
39)     END PROCESS p_sync;
40) 
Stefan Schuermans read peripherals with one c...

Stefan Schuermans authored 12 years ago

41)     p_read: PROCESS(rst, clk)
42)     BEGIN
43)         IF rst = '1' THEN
44)             o_rd_data <= (OTHERS => '0');
45)         ELSIF rising_edge(clk) THEN
46)             o_rd_data <= r_leds;
47)         END IF;
48)     END PROCESS p_read;
49) 
50)     pin_o_leds <= r_leds;
51)