📄 alucontrol.vhd
字号:
LIBRARY IEEE;USE IEEE.std_logic_1164.ALL;ENTITY ALUControl ISPORT (instr_15_0 : IN std_ulogic_vector(15 downto 0);ALUOp : IN std_ulogic_vector(1 downto 0);ALUopcode : OUT std_ulogic_vector(2 downto 0));END ALUControl;ARCHITECTURE behave OF ALUControl ISBEGINAlu_Control : PROCESS(instr_15_0, ALUOp)CONSTANT cADD : std_ulogic_vector(5 downto 0) := "100000";CONSTANT cSUB : std_ulogic_vector(5 downto 0) := "100010";CONSTANT cAND : std_ulogic_vector(5 downto 0) := "100100";CONSTANT cOR : std_ulogic_vector(5 downto 0) := "100101";CONSTANT cSLT : std_ulogic_vector(5 downto 0) := "101010";BEGINcase ALUOp iswhen "00" => ALUopcode <= "010"; -- addwhen "01" => ALUopcode <= "110"; -- subtractwhen "10" => -- operation depends on function fieldcase instr_15_0(5 downto 0) iswhen cADD => ALUopcode <= "010"; -- addwhen cSUB => ALUopcode <= "110"; -- subtractwhen cAND => ALUopcode <= "000"; -- ANDwhen cOR => ALUopcode <= "001"; -- ORwhen cSLT => ALUopcode <= "111"; -- sltwhen others => ALUopcode <= "000";end case;when others => ALUopcode <= "000";end case;END PROCESS;END behave;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -