1 |
4 |
Valerio63 |
library IEEE;
|
2 |
|
|
use IEEE.std_logic_1164.all; -- defines std_logic types
|
3 |
|
|
use IEEE.STD_LOGIC_unsigned.all;
|
4 |
|
|
use IEEE.STD_LOGIC_arith.all;
|
5 |
|
|
|
6 |
|
|
-- 8 bit seven-way multiplexer
|
7 |
|
|
entity regmux is
|
8 |
|
|
port( sel: in STD_LOGIC_VECTOR(3 downto 0);
|
9 |
|
|
a: in STD_LOGIC_VECTOR(7 downto 0);
|
10 |
|
|
b: in STD_LOGIC_VECTOR(7 downto 0);
|
11 |
|
|
c: in STD_LOGIC_VECTOR(7 downto 0);
|
12 |
|
|
d: in STD_LOGIC_VECTOR(7 downto 0);
|
13 |
|
|
e: in STD_LOGIC_VECTOR(7 downto 0);
|
14 |
|
|
f: in STD_LOGIC_VECTOR(7 downto 0);
|
15 |
|
|
g: in STD_LOGIC_VECTOR(7 downto 0);
|
16 |
|
|
h: in STD_LOGIC_VECTOR(7 downto 0);
|
17 |
|
|
i: in STD_LOGIC_VECTOR(7 downto 0);
|
18 |
|
|
j: in STD_LOGIC_VECTOR(7 downto 0);
|
19 |
|
|
k: in STD_LOGIC_VECTOR(7 downto 0);
|
20 |
|
|
y: out STD_LOGIC_VECTOR(7 downto 0)
|
21 |
|
|
);
|
22 |
|
|
end regmux;
|
23 |
|
|
|
24 |
|
|
architecture comb of regmux is
|
25 |
|
|
constant EXT_O: STD_LOGIC_VECTOR(3 downto 0) := "0000"; -- external data bus
|
26 |
|
|
constant ARD_O: STD_LOGIC_VECTOR(3 downto 0) := "0001"; -- register A select
|
27 |
|
|
constant XRD_O: STD_LOGIC_VECTOR(3 downto 0) := "0010"; -- register X select
|
28 |
|
|
constant YRD_O: STD_LOGIC_VECTOR(3 downto 0) := "0011"; -- register Y select
|
29 |
|
|
constant SRD_O: STD_LOGIC_VECTOR(3 downto 0) := "0100"; -- register S lsb select
|
30 |
|
|
constant SRM_O: STD_LOGIC_VECTOR(3 downto 0) := "0101"; -- register S msb select
|
31 |
|
|
constant PRD_O: STD_LOGIC_VECTOR(3 downto 0) := "0110"; -- register P select
|
32 |
|
|
constant PLR_O: STD_LOGIC_VECTOR(3 downto 0) := "0111"; -- register PCL select
|
33 |
|
|
constant PHR_O: STD_LOGIC_VECTOR(3 downto 0) := "1000"; -- register PCH select
|
34 |
|
|
constant ORD_O: STD_LOGIC_VECTOR(3 downto 0) := "1001"; -- register O select
|
35 |
|
|
constant Z00_O: STD_LOGIC_VECTOR(3 downto 0) := "1010"; -- select (all zero output)
|
36 |
|
|
constant ZRD_O: STD_LOGIC_VECTOR(3 downto 0) := "1011"; -- register Z select (all zero output)
|
37 |
|
|
|
38 |
|
|
begin
|
39 |
|
|
process(sel,a,b,c,d,e,f,g,h,i,j,k)
|
40 |
|
|
begin
|
41 |
|
|
case sel is
|
42 |
|
|
when EXT_O => y <= a;
|
43 |
|
|
when ARD_O => y <= b;
|
44 |
|
|
when XRD_O => y <= c;
|
45 |
|
|
when YRD_O => y <= d;
|
46 |
|
|
when SRD_O => y <= e;
|
47 |
|
|
when SRM_O => y <= f;
|
48 |
|
|
|
49 |
|
|
when PRD_O => y <= g;
|
50 |
|
|
when PLR_O => y <= h;
|
51 |
|
|
when PHR_O => y <= i;
|
52 |
|
|
when ORD_O => y <= j;
|
53 |
|
|
when Z00_O => y <= (others => '0');
|
54 |
|
|
when ZRD_O => y <= k;
|
55 |
|
|
when others => y <= a;
|
56 |
|
|
end case;
|
57 |
|
|
end process;
|
58 |
|
|
end comb;
|
59 |
|
|
|
60 |
|
|
|