Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LIBRARY ieee;
- USE ieee.std_logic_1164.ALL;
- USE ieee.std_logic_unsigned.ALL;
- ENTITY CSCD IS
- PORT (
- SWCBA : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
- IR : IN STD_LOGIC_VECTOR(7 DOWNTO 4);
- C, Z : IN STD_LOGIC;
- W : IN STD_LOGIC_VECTOR(3 DOWNTO 1);
- T3, QD : IN STD_LOGIC;
- CLR : IN STD_LOGIC;
- DRW, MEMW : OUT STD_LOGIC;
- PCINC, ARINC : OUT STD_LOGIC;
- LPC, LAR, LIR : OUT STD_LOGIC;
- PCADD : OUT STD_LOGIC;
- SELCTL : OUT STD_LOGIC;
- STOP : OUT STD_LOGIC;
- LDZ, LDC : OUT STD_LOGIC;
- CIN : OUT STD_LOGIC;
- S : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
- M : OUT STD_LOGIC;
- ABUS, SBUS, MBUS : OUT STD_LOGIC;
- SHORT, LONG : OUT STD_LOGIC;
- SEL : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
- );
- END CSCD;
- ARCHITECTURE struct OF CSCD IS
- SIGNAL ST0, SST0 : STD_LOGIC;
- BEGIN
- PROCESS (W, T3, SWCBA, IR, CLR)
- BEGIN
- S <= "0000";
- SEL <= "0000";
- DRW <= '0';
- MEMW <= '0';
- PCINC <= '0';
- PCADD <= '0';
- LPC <= '0';
- LAR <= '0';
- LIR <= '0';
- LDZ <= '0';
- LDC <= '0';
- ARINC <= '0';
- STOP <= '0';
- SELCTL <= '0';
- CIN <= '0';
- M <= '0';
- MEMW <= '0';
- ABUS <= '0';
- SBUS <= '0';
- MBUS <= '0';
- SHORT <= '0';
- LONG <= '0';
- IF CLR = '0' THEN
- ST0 <= '0';
- SST0 <= '0';
- ELSIF falling_edge(T3) THEN
- IF SST0 = '1' THEN
- ST0 <= '1';
- END IF;
- END IF;
- CASE SWCBA IS
- WHEN "001" =>
- SBUS <= W(1);
- STOP <= W(1);
- SHORT <= W(1);
- SELCTL <= W(1);
- LAR <= W(1) AND NOT ST0;
- SST0 <= W(1) AND NOT ST0;
- MEMW <= W(1) AND ST0;
- ARINC <= W(1) AND ST0;
- WHEN "010" =>
- STOP <= W(1);
- SHORT <= W(1);
- SELCTL <= W(1);
- SST0 <= W(1) AND NOT ST0;
- SBUS <= W(1) AND NOT ST0;
- LAR <= W(1) AND NOT ST0;
- MBUS <= W(1) AND ST0;
- ARINC <= W(1) AND ST0;
- WHEN "011" =>
- SBUS <= W(1) OR W(2);
- SEL(3) <= ST0;
- SEL(2) <= W(2);
- SEL(1) <= (NOT ST0 AND W(1)) OR (ST0 AND W(2));
- SEL(0) <= W(1);
- SST0 <= W(1) AND NOT ST0;
- SELCTL <= W(1) OR W(2);
- DRW <= W(1) OR W(2);
- STOP <= W(1) OR W(2);
- WHEN "100" =>
- SEL(3) <= W(2);
- SEL(2) <= '0';
- SEL(1) <= W(2);
- SEL(0) <= W(1) OR W(2);
- SELCTL <= W(1) OR W(2);
- STOP <= W(1) OR W(2);
- WHEN "000" =>
- IF ST0 = '0' THEN
- SBUS <= W(1);
- LPC <= W(1);
- STOP <= W(1);
- SELCTL <= W(1);
- SHORT <= W(1);
- SST0 <= W(1);
- ELSE
- LIR <= W(1);
- PCINC <= W(1);
- CASE IR IS
- WHEN "0001" => --ADD
- S(3) <= W(2);
- S(0) <= W(2);
- CIN <= W(2);
- ABUS <= W(2);
- DRW <= W(2);
- LDZ <= W(2);
- LDC <= W(2);
- WHEN "0010" => --SUB
- S(2) <= W(2);
- S(1) <= W(2);
- ABUS <= W(2);
- DRW <= W(2);
- LDZ <= W(2);
- LDC <= W(2);
- WHEN "0011" => --AND
- M <= W(2);
- S(3) <= W(2);
- S(1) <= W(2);
- S(0) <= W(2);
- ABUS <= W(2);
- DRW <= W(2);
- LDZ <= W(2);
- WHEN "0100" => --INC
- ABUS <= W(2);
- DRW <= W(2);
- LDZ <= W(2);
- LDC <= W(2);
- WHEN "0101" => --LD
- M <= W(2);
- S(3) <= W(2);
- S(1) <= W(2);
- ABUS <= W(2);
- LAR <= W(2);
- LONG <= W(2);
- DRW <= W(3);
- MBUS <= W(3);
- WHEN "0110" => --ST
- M <= W(2) OR W(3);
- S(3) <= W(2) OR W(3);
- S(2) <= W(2);
- S(1) <= W(2) OR W(3);
- S(0) <= W(2);
- ABUS <= W(2) OR W(3);
- LAR <= W(2);
- LONG <= W(2);
- MEMW <= W(3);
- WHEN "0111" => --JC
- IF C = '1' THEN
- PCADD <= W(2);
- END IF;
- WHEN "1000" => --JZ
- IF Z = '1' THEN
- PCADD <= W(2);
- END IF;
- WHEN "1001" => --JMP
- M <= W(2);
- S(3) <= W(2);
- S(2) <= W(2);
- S(1) <= W(2);
- S(0) <= W(2);
- ABUS <= W(2);
- LPC <= W(2);
- WHEN "1010" => --OUT
- WHEN "1011" => --IRET
- WHEN "1100" => --DI
- WHEN "1101" => --EI
- WHEN "1110" => --STP
- STOP <= W(2);
- WHEN OTHERS => NULL;
- END CASE;
- END IF;
- WHEN OTHERS => NULL;
- END CASE;
- END PROCESS;
- END struct;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement