-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIO_DECODER.vhd
52 lines (42 loc) · 1.89 KB
/
IO_DECODER.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
-- IO DECODER for SCOMP
-- This eliminates the need for a lot of AND decoders or Comparators
-- that would otherwise be spread around the top-level BDF
LIBRARY IEEE;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
ENTITY IO_DECODER IS
PORT
(
IO_ADDR : IN STD_LOGIC_VECTOR(10 downto 0);
IO_CYCLE : IN STD_LOGIC;
SWITCH_EN : OUT STD_LOGIC;
LED_EN : OUT STD_LOGIC;
TIMER_EN : OUT STD_LOGIC;
HEX0_EN : OUT STD_LOGIC;
HEX1_EN : OUT STD_LOGIC;
PXL_A_EN : OUT STD_LOGIC;
PXL_RGB_EN : OUT STD_LOGIC;
PXL_ALL_EN : OUT STD_LOGIC;
PXL_R_EN : OUT STD_LOGIC;
PXL_G_EN : OUT STD_LOGIC;
PXL_B_EN : OUT STD_LOGIC;
CC_EN : OUT STD_LOGIC
);
END ENTITY;
ARCHITECTURE a OF IO_DECODER IS
SIGNAL ADDR_INT : INTEGER RANGE 0 TO 2047;
begin
ADDR_INT <= TO_INTEGER(UNSIGNED(IO_ADDR));
SWITCH_EN <= '1' WHEN (ADDR_INT = 16#000#) and (IO_CYCLE = '1') ELSE '0';
LED_EN <= '1' WHEN (ADDR_INT = 16#001#) and (IO_CYCLE = '1') ELSE '0';
TIMER_EN <= '1' WHEN (ADDR_INT = 16#002#) and (IO_CYCLE = '1') ELSE '0';
HEX0_EN <= '1' WHEN (ADDR_INT = 16#004#) and (IO_CYCLE = '1') ELSE '0';
HEX1_EN <= '1' WHEN (ADDR_INT = 16#005#) and (IO_CYCLE = '1') ELSE '0';
PXL_A_EN <= '1' WHEN (ADDR_INT = 16#0B0#) and (IO_CYCLE = '1') ELSE '0';
PXL_RGB_EN <= '1' WHEN (ADDR_INT = 16#0B1#) and (IO_CYCLE = '1') ELSE '0';
PXL_ALL_EN <= '1' WHEN (ADDR_INT = 16#0B2#) and (IO_CYCLE = '1') ELSE '0';
PXL_R_EN <= '1' WHEN (ADDR_INT = 16#0B3#) and (IO_CYCLE = '1') ELSE '0';
PXL_G_EN <= '1' WHEN (ADDR_INT = 16#0B4#) and (IO_CYCLE = '1') ELSE '0';
PXL_B_EN <= '1' WHEN (ADDR_INT = 16#0B5#) and (IO_CYCLE = '1') ELSE '0';
CC_EN <= '1' WHEN (ADDR_INT = 16#0B6#) and (IO_CYCLE = '1') ELSE '0';
END a;