📄 oc8051_decoder.v
字号:
bit_addr = 1'b0; end `OC8051_SETB_B : begin ram_rd_sel = `OC8051_RRS_D; pc_wr = `OC8051_PCW_N; pc_sel = `OC8051_PIS_DC; comp_sel = `OC8051_CSS_DC; rmw = `OC8051_RMW_Y; stb_i = 1'b1; bit_addr = 1'b1; end/* `OC8051_SJMP : begin ram_rd_sel = `OC8051_RRS_DC; pc_wr = `OC8051_PCW_Y; pc_sel = `OC8051_PIS_SO1; comp_sel = `OC8051_CSS_DC; rmw = `OC8051_RMW_N; stb_i = 1'b0; bit_addr = 1'b0; end*/ `OC8051_SUBB_D : begin ram_rd_sel = `OC8051_RRS_D; pc_wr = `OC8051_PCW_N; pc_sel = `OC8051_PIS_DC; comp_sel = `OC8051_CSS_DC; rmw = `OC8051_RMW_N; stb_i = 1'b1; bit_addr = 1'b0; end `OC8051_XCH_D : begin ram_rd_sel = `OC8051_RRS_D; pc_wr = `OC8051_PCW_N; pc_sel = `OC8051_PIS_DC; comp_sel = `OC8051_CSS_DC; rmw = `OC8051_RMW_N; stb_i = 1'b1; bit_addr = 1'b0; end `OC8051_XRL_D : begin ram_rd_sel = `OC8051_RRS_D; pc_wr = `OC8051_PCW_N; pc_sel = `OC8051_PIS_DC; comp_sel = `OC8051_CSS_DC; rmw = `OC8051_RMW_Y; stb_i = 1'b1; bit_addr = 1'b0; end `OC8051_XRL_AD : begin ram_rd_sel = `OC8051_RRS_D; pc_wr = `OC8051_PCW_N; pc_sel = `OC8051_PIS_DC; comp_sel = `OC8051_CSS_DC; rmw = `OC8051_RMW_Y; stb_i = 1'b1; bit_addr = 1'b0; end `OC8051_XRL_CD : begin ram_rd_sel = `OC8051_RRS_D; pc_wr = `OC8051_PCW_N; pc_sel = `OC8051_PIS_DC; comp_sel = `OC8051_CSS_DC; rmw = `OC8051_RMW_Y; stb_i = 1'b1; bit_addr = 1'b0; end default: begin ram_rd_sel = `OC8051_RRS_DC; pc_wr = `OC8051_PCW_N; pc_sel = `OC8051_PIS_DC; comp_sel = `OC8051_CSS_DC; rmw = `OC8051_RMW_N; stb_i = 1'b1; bit_addr = 1'b0; end endcase end endcaseend////// registerd outputsalways @(posedge clk or posedge rst)begin if (rst) begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_DC; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_NOT; cy_sel <= #1 `OC8051_CY_0; src_sel3 <= #1 `OC8051_AS3_DC; wr_sfr <= #1 `OC8051_WRS_N; end else if (!wait_data) begin case (state_dec) /* synopsys parallel_case */ 2'b01: begin casex (op_cur) /* synopsys parallel_case */ `OC8051_MOVC_DP :begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_OP1; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_NOT; wr_sfr <= #1 `OC8051_WRS_ACC1; end `OC8051_MOVC_PC :begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_OP1; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_NOT; wr_sfr <= #1 `OC8051_WRS_ACC1; end `OC8051_MOVX_PA : begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_OP1; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_NOT; wr_sfr <= #1 `OC8051_WRS_ACC1; end `OC8051_MOVX_IA : begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_OP1; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_NOT; wr_sfr <= #1 `OC8051_WRS_ACC1; end/* `OC8051_ACALL :begin ram_wr_sel <= #1 `OC8051_RWS_SP; src_sel1 <= #1 `OC8051_AS1_PCH; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b1; psw_set <= #1 `OC8051_PS_NOT; wr_sfr <= #1 `OC8051_WRS_N; end `OC8051_AJMP : begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_DC; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_NOT; wr_sfr <= #1 `OC8051_WRS_N; end `OC8051_LCALL :begin ram_wr_sel <= #1 `OC8051_RWS_SP; src_sel1 <= #1 `OC8051_AS1_PCH; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b1; psw_set <= #1 `OC8051_PS_NOT; wr_sfr <= #1 `OC8051_WRS_N; end*/ `OC8051_DIV : begin ram_wr_sel <= #1 `OC8051_RWS_B; src_sel1 <= #1 `OC8051_AS1_ACC; src_sel2 <= #1 `OC8051_AS2_RAM; alu_op <= #1 `OC8051_ALU_DIV; wr <= #1 1'b1; psw_set <= #1 `OC8051_PS_OV; wr_sfr <= #1 `OC8051_WRS_ACC2; end `OC8051_MUL : begin ram_wr_sel <= #1 `OC8051_RWS_B; src_sel1 <= #1 `OC8051_AS1_ACC; src_sel2 <= #1 `OC8051_AS2_RAM; alu_op <= #1 `OC8051_ALU_MUL; wr <= #1 1'b1; psw_set <= #1 `OC8051_PS_OV; wr_sfr <= #1 `OC8051_WRS_ACC2; end default begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_DC; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_NOT; wr_sfr <= #1 `OC8051_WRS_N; end endcase cy_sel <= #1 `OC8051_CY_0; src_sel3 <= #1 `OC8051_AS3_DC; end 2'b10: begin casex (op_cur) /* synopsys parallel_case */ `OC8051_ACALL :begin ram_wr_sel <= #1 `OC8051_RWS_SP; src_sel1 <= #1 `OC8051_AS1_PCH; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b1; psw_set <= #1 `OC8051_PS_NOT; end `OC8051_LCALL :begin ram_wr_sel <= #1 `OC8051_RWS_SP; src_sel1 <= #1 `OC8051_AS1_PCH; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b1; psw_set <= #1 `OC8051_PS_NOT; end `OC8051_JBC : begin ram_wr_sel <= #1 `OC8051_RWS_D; src_sel1 <= #1 `OC8051_AS1_DC; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b1; psw_set <= #1 `OC8051_PS_NOT; end `OC8051_DIV : begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_ACC; src_sel2 <= #1 `OC8051_AS2_RAM; alu_op <= #1 `OC8051_ALU_DIV; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_OV; end `OC8051_MUL : begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_ACC; src_sel2 <= #1 `OC8051_AS2_RAM; alu_op <= #1 `OC8051_ALU_MUL; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_OV; end default begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_DC; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_NOT; end endcase cy_sel <= #1 `OC8051_CY_0; src_sel3 <= #1 `OC8051_AS3_DC; wr_sfr <= #1 `OC8051_WRS_N; end 2'b11: begin casex (op_cur) /* synopsys parallel_case */ `OC8051_RET : begin src_sel1 <= #1 `OC8051_AS1_RAM; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; psw_set <= #1 `OC8051_PS_NOT; end `OC8051_RETI : begin src_sel1 <= #1 `OC8051_AS1_RAM; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; psw_set <= #1 `OC8051_PS_NOT; end `OC8051_DIV : begin src_sel1 <= #1 `OC8051_AS1_ACC; src_sel2 <= #1 `OC8051_AS2_RAM; alu_op <= #1 `OC8051_ALU_DIV; psw_set <= #1 `OC8051_PS_OV; end `OC8051_MUL : begin src_sel1 <= #1 `OC8051_AS1_ACC; src_sel2 <= #1 `OC8051_AS2_RAM; alu_op <= #1 `OC8051_ALU_MUL; psw_set <= #1 `OC8051_PS_OV; end default begin src_sel1 <= #1 `OC8051_AS1_DC; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; psw_set <= #1 `OC8051_PS_NOT; end endcase ram_wr_sel <= #1 `OC8051_RWS_DC; wr <= #1 1'b0; cy_sel <= #1 `OC8051_CY_0; src_sel3 <= #1 `OC8051_AS3_DC; wr_sfr <= #1 `OC8051_WRS_N; end default: begin casex (op_cur) /* synopsys parallel_case */ `OC8051_ACALL :begin ram_wr_sel <= #1 `OC8051_RWS_SP; src_sel1 <= #1 `OC8051_AS1_PCL; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b1; psw_set <= #1 `OC8051_PS_NOT; cy_sel <= #1 `OC8051_CY_0; src_sel3 <= #1 `OC8051_AS3_DC; wr_sfr <= #1 `OC8051_WRS_N; end `OC8051_AJMP : begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_DC; src_sel2 <= #1 `OC8051_AS2_DC; alu_op <= #1 `OC8051_ALU_NOP; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_NOT; cy_sel <= #1 `OC8051_CY_0; src_sel3 <= #1 `OC8051_AS3_DC; wr_sfr <= #1 `OC8051_WRS_N; end `OC8051_ADD_R : begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_ACC; src_sel2 <= #1 `OC8051_AS2_RAM; alu_op <= #1 `OC8051_ALU_ADD; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_AC; cy_sel <= #1 `OC8051_CY_0; src_sel3 <= #1 `OC8051_AS3_DC; wr_sfr <= #1 `OC8051_WRS_ACC1; end `OC8051_ADDC_R : begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_ACC; src_sel2 <= #1 `OC8051_AS2_RAM; alu_op <= #1 `OC8051_ALU_ADD; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_AC; cy_sel <= #1 `OC8051_CY_PSW; src_sel3 <= #1 `OC8051_AS3_DC; wr_sfr <= #1 `OC8051_WRS_ACC1; end `OC8051_ANL_R : begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_ACC; src_sel2 <= #1 `OC8051_AS2_RAM; alu_op <= #1 `OC8051_ALU_AND; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_NOT; cy_sel <= #1 `OC8051_CY_0; src_sel3 <= #1 `OC8051_AS3_DC; wr_sfr <= #1 `OC8051_WRS_ACC1; end `OC8051_CJNE_R : begin ram_wr_sel <= #1 `OC8051_RWS_DC; src_sel1 <= #1 `OC8051_AS1_RAM; src_sel2 <= #1 `OC8051_AS2_OP2; alu_op <= #1 `OC8051_ALU_SUB; wr <= #1 1'b0; psw_set <= #1 `OC8051_PS_CY; cy_sel <= #1 `OC8051_CY_0; src_sel3 <= #1 `OC8051_AS3_DC; wr_sfr <= #1 `OC8051_WRS_N; end `OC8051_DEC_R : begin ram_wr_sel <= #1 `OC8051_RWS_RN;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -