📄 i8051_ctr.vhd
字号:
when ES_7 => SHUT_DOWN_ALU; cpu_state <= CS_1; exe_state <= ES_0; end case;------------------------------------------------------------------------------- -- -- acc <- acc + #data -- when OPC_ADD_4 => case exe_state is when ES_0 => alu_op_code <= ALU_OPC_ADD; alu_src_1 <= reg_acc; alu_src_2 <= reg_op2; alu_src_cy <= '0'; exe_state <= ES_1; when ES_1 => ram_out_data <= alu_des_1; START_WR_RAM(R_ACC); reg_cy <= alu_des_cy; reg_ac <= alu_des_ac; reg_ov <= alu_des_ov; exe_state <= ES_2; when ES_2 => GET_PSW(v8); ram_out_data <= v8; START_WR_RAM(R_PSW); exe_state <= ES_3; when ES_3 => exe_state <= ES_4; when ES_4 => exe_state <= ES_5; when ES_5 => exe_state <= ES_6; when ES_6 => exe_state <= ES_7; when ES_7 => SHUT_DOWN_ALU; cpu_state <= CS_1; exe_state <= ES_0; end case;------------------------------------------------------------------------------- -- -- acc <- acc + cy + (r) -- when OPC_ADDC_1 => case exe_state is when ES_0 => GET_RAM_ADDR_1(v8); START_RD_RAM(v8); exe_state <= ES_1; when ES_1 => exe_state <= ES_2; when ES_2 => alu_op_code <= ALU_OPC_ADD; alu_src_1 <= reg_acc; alu_src_2 <= ram_in_data; alu_src_cy <= reg_cy; exe_state <= ES_3; when ES_3 => ram_out_data <= alu_des_1; START_WR_RAM(R_ACC); reg_cy <= alu_des_cy; reg_ac <= alu_des_ac; reg_ov <= alu_des_ov; exe_state <= ES_4; when ES_4 => GET_PSW(v8); ram_out_data <= v8; START_WR_RAM(R_PSW); exe_state <= ES_5; when ES_5 => exe_state <= ES_6; when ES_6 => exe_state <= ES_7; when ES_7 => SHUT_DOWN_ALU; cpu_state <= CS_1; exe_state <= ES_0; end case;------------------------------------------------------------------------------- -- -- acc <- acc + cy + (direct) -- when OPC_ADDC_2 => case exe_state is when ES_0 => START_RD_RAM(reg_op2); exe_state <= ES_1; when ES_1 => exe_state <= ES_2; when ES_2 => alu_op_code <= ALU_OPC_ADD; alu_src_1 <= reg_acc; alu_src_2 <= ram_in_data; alu_src_cy <= reg_cy; exe_state <= ES_3; when ES_3 => ram_out_data <= alu_des_1; START_WR_RAM(R_ACC); reg_cy <= alu_des_cy; reg_ac <= alu_des_ac; reg_ov <= alu_des_ov; exe_state <= ES_4; when ES_4 => GET_PSW(v8); ram_out_data <= v8; START_WR_RAM(R_PSW); exe_state <= ES_5; when ES_5 => exe_state <= ES_6; when ES_6 => exe_state <= ES_7; when ES_7 => SHUT_DOWN_ALU; cpu_state <= CS_1; exe_state <= ES_0; end case;------------------------------------------------------------------------------- -- -- acc <- acc + cy + ((r)) -- when OPC_ADDC_3 => case exe_state is when ES_0 => GET_RAM_ADDR_2(v8); START_RD_RAM(v8); exe_state <= ES_1; when ES_1 => exe_state <= ES_2; when ES_2 => START_RD_RAM(ram_in_data); exe_state <= ES_3; when ES_3 => exe_state <= ES_4; when ES_4 => alu_op_code <= ALU_OPC_ADD; alu_src_1 <= reg_acc; alu_src_2 <= ram_in_data; alu_src_cy <= reg_cy; exe_state <= ES_5; when ES_5 => ram_out_data <= alu_des_1; START_WR_RAM(R_ACC); reg_cy <= alu_des_cy; reg_ac <= alu_des_ac; reg_ov <= alu_des_ov; exe_state <= ES_6; when ES_6 => GET_PSW(v8); ram_out_data <= v8; START_WR_RAM(R_PSW); exe_state <= ES_7; when ES_7 => SHUT_DOWN_ALU; cpu_state <= CS_1; exe_state <= ES_0; end case;------------------------------------------------------------------------------- -- -- acc <- acc + cy + #data -- when OPC_ADDC_4 => case exe_state is when ES_0 => alu_op_code <= ALU_OPC_ADD; alu_src_1 <= reg_acc; alu_src_2 <= reg_op2; alu_src_cy <= reg_cy; exe_state <= ES_1; when ES_1 => ram_out_data <= alu_des_1; START_WR_RAM(R_ACC); reg_cy <= alu_des_cy; reg_ac <= alu_des_ac; reg_ov <= alu_des_ov; exe_state <= ES_2; when ES_2 => GET_PSW(v8); ram_out_data <= v8; START_WR_RAM(R_PSW); exe_state <= ES_3; when ES_3 => exe_state <= ES_4; when ES_4 => exe_state <= ES_5; when ES_5 => exe_state <= ES_6; when ES_6 => exe_state <= ES_7; when ES_7 => SHUT_DOWN_ALU; cpu_state <= CS_1; exe_state <= ES_0; end case; ------------------------------------------------------------------------------- -- -- pc(10-0) <- page address -- when OPC_AJMP => case exe_state is when ES_0 => SET_PC_2(reg_op1(7 downto 5), reg_op2); exe_state <= ES_1; when ES_1 => exe_state <= ES_2; when ES_2 => exe_state <= ES_3; when ES_3 => exe_state <= ES_4; when ES_4 => exe_state <= ES_5; when ES_5 => exe_state <= ES_6; when ES_6 => exe_state <= ES_7; when ES_7 => SHUT_DOWN_ALU; cpu_state <= CS_1; exe_state <= ES_0; end case;------------------------------------------------------------------------------- -- -- acc <- acc && (r) -- when OPC_ANL_1 => case exe_state is when ES_0 => GET_RAM_ADDR_1(v8); START_RD_RAM(v8); exe_state <= ES_1; when ES_1 => exe_state <= ES_2; when ES_2 => alu_op_code <= ALU_OPC_AND; alu_src_1 <= reg_acc; alu_src_2 <= ram_in_data; exe_state <= ES_3; when ES_3 => ram_out_data <= alu_des_1; START_WR_RAM(R_ACC); exe_state <= ES_4; when ES_4 => exe_state <= ES_5; when ES_5 => exe_state <= ES_6; when ES_6 => exe_state <= ES_7; when ES_7 => SHUT_DOWN_ALU; cpu_state <= CS_1; exe_state <= ES_0; end case;------------------------------------------------------------------------------- -- -- acc <- acc && (direct) -- when OPC_ANL_2 => case exe_state is when ES_0 => START_RD_RAM(reg_op2); exe_state <= ES_1; when ES_1 => exe_state <= ES_2; when ES_2 => alu_op_code <= ALU_OPC_AND;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -