1 |
2 |
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 |
|
|
-- register operation decode
|
7 |
|
|
entity decreg is
|
8 |
|
|
port( r: in STD_LOGIC_VECTOR(5 downto 0);
|
9 |
|
|
y: out STD_LOGIC_VECTOR(29 downto 0)
|
10 |
|
|
);
|
11 |
|
|
end decreg;
|
12 |
|
|
|
13 |
|
|
architecture comb of decreg is
|
14 |
|
|
constant NOP_R: STD_LOGIC_VECTOR(5 downto 0) := "000000"; -- no operation
|
15 |
|
|
constant ALL_R: STD_LOGIC_VECTOR(5 downto 0) := "000001"; -- register A load lsb
|
16 |
|
|
constant ALM_R: STD_LOGIC_VECTOR(5 downto 0) := "000010"; -- register A load msb
|
17 |
|
|
constant A16_R: STD_LOGIC_VECTOR(5 downto 0) := "000011"; -- register A load msb & lsb
|
18 |
|
|
constant XLL_R: STD_LOGIC_VECTOR(5 downto 0) := "000100"; -- register X load lsb
|
19 |
|
|
constant XLM_R: STD_LOGIC_VECTOR(5 downto 0) := "000101"; -- register X load msb
|
20 |
|
|
constant X16_R: STD_LOGIC_VECTOR(5 downto 0) := "000110"; -- register X load msb & lsb
|
21 |
|
|
constant YLL_R: STD_LOGIC_VECTOR(5 downto 0) := "000111"; -- register Y load lsb
|
22 |
|
|
constant YLM_R: STD_LOGIC_VECTOR(5 downto 0) := "001000"; -- register Y load msb
|
23 |
|
|
constant Y16_R: STD_LOGIC_VECTOR(5 downto 0) := "001001"; -- register Y load msb & lsb
|
24 |
|
|
constant DLL_R: STD_LOGIC_VECTOR(5 downto 0) := "001010"; -- register D load lsb
|
25 |
|
|
constant DLM_R: STD_LOGIC_VECTOR(5 downto 0) := "001011"; -- register D load msb
|
26 |
|
|
constant D16_R: STD_LOGIC_VECTOR(5 downto 0) := "001100"; -- register D load msb & lsb
|
27 |
|
|
constant OLD_R: STD_LOGIC_VECTOR(5 downto 0) := "001101"; -- register O load lsb
|
28 |
|
|
constant OMD_R: STD_LOGIC_VECTOR(5 downto 0) := "001110"; -- register O load msb
|
29 |
|
|
constant SLD_R: STD_LOGIC_VECTOR(5 downto 0) := "001111"; -- register S load lsb
|
30 |
|
|
constant SLM_R: STD_LOGIC_VECTOR(5 downto 0) := "010000"; -- register S load msb
|
31 |
|
|
constant S16_R: STD_LOGIC_VECTOR(5 downto 0) := "010001"; -- register S load msb & lsb
|
32 |
|
|
constant SUP_R: STD_LOGIC_VECTOR(5 downto 0) := "010010"; -- register S increment by 1
|
33 |
|
|
constant SDW_R: STD_LOGIC_VECTOR(5 downto 0) := "010011"; -- register S decrement by 1
|
34 |
|
|
constant SAU_R: STD_LOGIC_VECTOR(5 downto 0) := "010100"; -- register A (lsb) load/register S increment by 1
|
35 |
|
|
constant SXU_R: STD_LOGIC_VECTOR(5 downto 0) := "010101"; -- register X (lsb) load/register S increment by 1
|
36 |
|
|
constant SXM_R: STD_LOGIC_VECTOR(5 downto 0) := "010110"; -- register X (msb) load/register S increment by 1
|
37 |
|
|
constant SYU_R: STD_LOGIC_VECTOR(5 downto 0) := "010111"; -- register Y (lsb) load/register S increment by 1
|
38 |
|
|
constant SYM_R: STD_LOGIC_VECTOR(5 downto 0) := "011000"; -- register Y (msb) load/register S increment by 1
|
39 |
|
|
constant KLD_R: STD_LOGIC_VECTOR(5 downto 0) := "011001"; -- register K (PBR) load
|
40 |
|
|
constant BLD_R: STD_LOGIC_VECTOR(5 downto 0) := "011010"; -- register B (DBR) load
|
41 |
|
|
constant KCL_R: STD_LOGIC_VECTOR(5 downto 0) := "011011"; -- register K (PBR) clear and register S decrement by 1
|
42 |
|
|
constant BCL_R: STD_LOGIC_VECTOR(5 downto 0) := "011100"; -- register B (DBR) clear
|
43 |
|
|
constant SKC_R: STD_LOGIC_VECTOR(5 downto 0) := "011101"; -- register B (DBR) clear and register S decrement by 1
|
44 |
|
|
constant DEA_R: STD_LOGIC_VECTOR(5 downto 0) := "011110"; -- register A decrement (MVN/MVP)
|
45 |
|
|
constant O16_R: STD_LOGIC_VECTOR(5 downto 0) := "011111"; -- register O load msb & lsb
|
46 |
|
|
constant OSU_R: STD_LOGIC_VECTOR(5 downto 0) := "100000"; -- register O load lsb/register S increment by 1
|
47 |
|
|
constant MVN_R: STD_LOGIC_VECTOR(5 downto 0) := "100001"; -- register XY increment by 1, A decremented by 1
|
48 |
|
|
constant MVP_R: STD_LOGIC_VECTOR(5 downto 0) := "100010"; -- register XY decrement by 1, A decremented by 1
|
49 |
|
|
constant MUL_R: STD_LOGIC_VECTOR(5 downto 0) := "100011"; -- register A/B load multiplication lsb result, register X load multiplication msb result
|
50 |
|
|
constant MUI_R: STD_LOGIC_VECTOR(5 downto 0) := "100100"; -- multiplication init
|
51 |
|
|
constant MUS_R: STD_LOGIC_VECTOR(5 downto 0) := "100101"; -- multiplication (unsigned) start
|
52 |
|
|
constant MSS_R: STD_LOGIC_VECTOR(5 downto 0) := "100110"; -- multiplication (signed) start
|
53 |
|
|
constant WAI_R: STD_LOGIC_VECTOR(5 downto 0) := "100111"; -- WAI set flipflop
|
54 |
|
|
constant STP_R: STD_LOGIC_VECTOR(5 downto 0) := "101000"; -- STP set flipflop
|
55 |
|
|
constant BLS_R: STD_LOGIC_VECTOR(5 downto 0) := "101001"; -- register B (DBR) load/register S incremented by 1
|
56 |
|
|
constant DLS_R: STD_LOGIC_VECTOR(5 downto 0) := "101010"; -- register D load msb & lsb/register S incremented by 1
|
57 |
|
|
|
58 |
|
|
begin
|
59 |
|
|
process(r)
|
60 |
|
|
begin
|
61 |
|
|
case r is
|
62 |
|
|
when NOP_R => y <= "000000000000000000000000000000";
|
63 |
|
|
when ALL_R => y <= "000000000000000000000000000001";
|
64 |
|
|
when ALM_R => y <= "000000000000000000000000000010";
|
65 |
|
|
when A16_R => y <= "000000000000000000000000000011";
|
66 |
|
|
when DEA_R => y <= "000000000000000000000000000100";
|
67 |
|
|
when XLL_R => y <= "000000000000000000000000001000";
|
68 |
|
|
when XLM_R => y <= "000000000000000000000000010000";
|
69 |
|
|
when X16_R => y <= "000000000000000000000000011000";
|
70 |
|
|
when YLL_R => y <= "000000000000000000000010000000";
|
71 |
|
|
when YLM_R => y <= "000000000000000000000100000000";
|
72 |
|
|
when Y16_R => y <= "000000000000000000000110000000";
|
73 |
|
|
when DLL_R => y <= "000000000000000000100000000000";
|
74 |
|
|
when DLM_R => y <= "000000000000000001000000000000";
|
75 |
|
|
when D16_R => y <= "000000000000000001100000000000";
|
76 |
|
|
when OLD_R => y <= "000000000000000100000000000000";
|
77 |
|
|
when OMD_R => y <= "000000000000001000000000000000";
|
78 |
|
|
when SLD_R => y <= "000000000000010000000000000000";
|
79 |
|
|
when SLM_R => y <= "000000000000100000000000000000";
|
80 |
|
|
when S16_R => y <= "000000000000110000000000000000";
|
81 |
|
|
when SUP_R => y <= "000000000001000000000000000000";
|
82 |
|
|
when SDW_R => y <= "000000000010000000000000000000";
|
83 |
|
|
when SAU_R => y <= "000000000001000000000000000001";
|
84 |
|
|
when SXU_R => y <= "000000000001000000000000001000";
|
85 |
|
|
when SXM_R => y <= "000000000001000000000000010000";
|
86 |
|
|
when SYU_R => y <= "000000000001000000000010000000";
|
87 |
|
|
when SYM_R => y <= "000000000001000000000100000000";
|
88 |
|
|
when KLD_R => y <= "000000000100000000000000000000";
|
89 |
|
|
when BLD_R => y <= "000000001000000000000000000000";
|
90 |
|
|
when KCL_R => y <= "000000010010000000000000000000";
|
91 |
|
|
when BCL_R => y <= "000000100000000000000000000000";
|
92 |
|
|
when SKC_R => y <= "000000100010000000000000000000";
|
93 |
|
|
when O16_R => y <= "000000000000000010000000000000";
|
94 |
|
|
when OSU_R => y <= "000000000001000100000000000000";
|
95 |
|
|
when MVN_R => y <= "000000000000000000010001000100";
|
96 |
|
|
when MVP_R => y <= "000000000000000000001000100100";
|
97 |
|
|
when MUL_R => y <= "000001000000000000000000000000";
|
98 |
|
|
when MUI_R => y <= "000010000000000000000000000000";
|
99 |
|
|
when MUS_R => y <= "000100000000000000000000000000";
|
100 |
|
|
when MSS_R => y <= "001000000000000000000000000000";
|
101 |
|
|
when WAI_R => y <= "010000000000000000000000000000";
|
102 |
|
|
when STP_R => y <= "100000000000000000000000000000";
|
103 |
|
|
when BLS_R => y <= "000000001001000000000000000000";
|
104 |
|
|
when DLS_R => y <= "000000000001000001100000000000";
|
105 |
|
|
when others => y <= "000000000000000000000000000000";
|
106 |
|
|
end case;
|
107 |
|
|
end process;
|
108 |
|
|
end comb;
|
109 |
|
|
|
110 |
|
|
|