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 |
|
|
-- register operation decode
|
7 |
|
|
entity decreg is
|
8 |
|
|
port( r: in STD_LOGIC_VECTOR(3 downto 0);
|
9 |
|
|
y: out STD_LOGIC_VECTOR(8 downto 0)
|
10 |
|
|
);
|
11 |
|
|
end decreg;
|
12 |
|
|
|
13 |
|
|
architecture comb of decreg is
|
14 |
|
|
constant NOP_R: STD_LOGIC_VECTOR(3 downto 0) := "0000"; -- no operation
|
15 |
|
|
constant ALD_R: STD_LOGIC_VECTOR(3 downto 0) := "0001"; -- register A load
|
16 |
|
|
constant XLD_R: STD_LOGIC_VECTOR(3 downto 0) := "0010"; -- register X load
|
17 |
|
|
constant YLD_R: STD_LOGIC_VECTOR(3 downto 0) := "0011"; -- register Y load
|
18 |
|
|
constant ZLD_R: STD_LOGIC_VECTOR(3 downto 0) := "0100"; -- register Z load
|
19 |
|
|
constant OLD_R: STD_LOGIC_VECTOR(3 downto 0) := "0101"; -- register O load
|
20 |
|
|
constant SLD_R: STD_LOGIC_VECTOR(3 downto 0) := "0110"; -- register S load lsb
|
21 |
|
|
constant SLM_R: STD_LOGIC_VECTOR(3 downto 0) := "0111"; -- register S load msb
|
22 |
|
|
constant SUP_R: STD_LOGIC_VECTOR(3 downto 0) := "1000"; -- register S increment by 1
|
23 |
|
|
constant SDW_R: STD_LOGIC_VECTOR(3 downto 0) := "1001"; -- register S decrement by 1
|
24 |
|
|
constant SAU_R: STD_LOGIC_VECTOR(3 downto 0) := "1010"; -- register A load/register S increment by 1
|
25 |
|
|
constant SXU_R: STD_LOGIC_VECTOR(3 downto 0) := "1011"; -- register X load/register S increment by 1
|
26 |
|
|
constant SYU_R: STD_LOGIC_VECTOR(3 downto 0) := "1100"; -- register Y load/register S increment by 1
|
27 |
|
|
constant SZU_R: STD_LOGIC_VECTOR(3 downto 0) := "1101"; -- register Z load/register S increment by 1
|
28 |
|
|
|
29 |
|
|
begin
|
30 |
|
|
process(r)
|
31 |
|
|
begin
|
32 |
|
|
case r is
|
33 |
|
|
when NOP_R => y <= "000000000";
|
34 |
|
|
when ALD_R => y <= "000000001";
|
35 |
|
|
when XLD_R => y <= "000000010";
|
36 |
|
|
when YLD_R => y <= "000000100";
|
37 |
|
|
when ZLD_R => y <= "000001000";
|
38 |
|
|
when OLD_R => y <= "000010000";
|
39 |
|
|
when SLD_R => y <= "000100000";
|
40 |
|
|
when SLM_R => y <= "001000000";
|
41 |
|
|
when SUP_R => y <= "010000000";
|
42 |
|
|
when SDW_R => y <= "100000000";
|
43 |
|
|
when SAU_R => y <= "010000001";
|
44 |
|
|
when SXU_R => y <= "010000010";
|
45 |
|
|
when SYU_R => y <= "010000100";
|
46 |
|
|
when SZU_R => y <= "010001000";
|
47 |
|
|
when others => y <= "000000000";
|
48 |
|
|
end case;
|
49 |
|
|
end process;
|
50 |
|
|
end comb;
|
51 |
|
|
|
52 |
|
|
|