OpenCores
URL https://opencores.org/ocsvn/rtf65002/rtf65002/trunk

Subversion Repositories rtf65002

[/] [rtf65002/] [trunk/] [rtl/] [verilog/] [decode.v] - Diff between revs 20 and 21

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 20 Rev 21
Line 73... Line 73...
 
 
                `RR:
                `RR:
                        begin
                        begin
                                state <= IFETCH;
                                state <= IFETCH;
                                case(ir[23:20])
                                case(ir[23:20])
                                `ADD_RR:        begin res <= rfoa + rfob; a <= rfoa; b <= rfob; end
                                `ADD_RR:        begin res <= rfoa + rfob + {31'b0,df&cf}; a <= rfoa; b <= rfob; end
                                `SUB_RR:        begin res <= rfoa - rfob; a <= rfoa; b <= rfob; end
                                `SUB_RR:        begin res <= rfoa - rfob - {31'b0,df&~cf&|ir[19:16]}; a <= rfoa; b <= rfob; end
                                `AND_RR:        begin res <= rfoa & rfob; a <= rfoa; b <= rfob; end     // for bit flags
                                `AND_RR:        begin res <= rfoa & rfob; a <= rfoa; b <= rfob; end     // for bit flags
                                `OR_RR:         begin res <= rfoa | rfob; a <= rfoa; b <= rfob; end
                                `OR_RR:         begin res <= rfoa | rfob; a <= rfoa; b <= rfob; end
                                `EOR_RR:        begin res <= rfoa ^ rfob; a <= rfoa; b <= rfob; end
                                `EOR_RR:        begin res <= rfoa ^ rfob; a <= rfoa; b <= rfob; end
                                `MUL_RR:        begin state <= MULDIV1; end
                                `MUL_RR:        begin state <= MULDIV1; end
                                `MULS_RR:       begin state <= MULDIV1; end
                                `MULS_RR:       begin state <= MULDIV1; end
Line 98... Line 98...
                `LSR_RR:        begin res <= {rfoa[0],1'b0,rfoa[31:1]}; pc <= pc + 32'd2; Rt <= ir[15:12]; end
                `LSR_RR:        begin res <= {rfoa[0],1'b0,rfoa[31:1]}; pc <= pc + 32'd2; Rt <= ir[15:12]; end
                `ROR_RR:        begin res <= {rfoa[0],cf,rfoa[31:1]}; pc <= pc + 32'd2; Rt <= ir[15:12]; end
                `ROR_RR:        begin res <= {rfoa[0],cf,rfoa[31:1]}; pc <= pc + 32'd2; Rt <= ir[15:12]; end
                `DEC_RR:        begin res <= rfoa - 32'd1; pc <= pc + 32'd2; Rt <= ir[15:12]; end
                `DEC_RR:        begin res <= rfoa - 32'd1; pc <= pc + 32'd2; Rt <= ir[15:12]; end
                `INC_RR:        begin res <= rfoa + 32'd1; pc <= pc + 32'd2; Rt <= ir[15:12]; end
                `INC_RR:        begin res <= rfoa + 32'd1; pc <= pc + 32'd2; Rt <= ir[15:12]; end
 
 
                `ADD_IMM8:      begin res <= rfoa + {{24{ir[23]}},ir[23:16]}; Rt <= ir[15:12]; pc <= pc + 32'd3; a <= rfoa; b <= {{24{ir[23]}},ir[23:16]}; end
                `ADD_IMM8:      begin res <= rfoa + {{24{ir[23]}},ir[23:16]} + {31'b0,df&cf}; Rt <= ir[15:12]; pc <= pc + 32'd3; a <= rfoa; b <= {{24{ir[23]}},ir[23:16]}; end
                `SUB_IMM8:      begin res <= rfoa - {{24{ir[23]}},ir[23:16]}; Rt <= ir[15:12]; pc <= pc + 32'd3; a <= rfoa; b <= {{24{ir[23]}},ir[23:16]}; end
                `SUB_IMM8:      begin res <= rfoa - {{24{ir[23]}},ir[23:16]} - {31'b0,df&~cf&|ir[15:12]}; Rt <= ir[15:12]; pc <= pc + 32'd3; a <= rfoa; b <= {{24{ir[23]}},ir[23:16]}; end
                `OR_IMM8:       begin res <= rfoa | {{24{ir[23]}},ir[23:16]}; Rt <= ir[15:12]; pc <= pc + 32'd3; b <= {{24{ir[23]}},ir[23:16]}; end
                `OR_IMM8:       begin res <= rfoa | {{24{ir[23]}},ir[23:16]}; Rt <= ir[15:12]; pc <= pc + 32'd3; b <= {{24{ir[23]}},ir[23:16]}; end
                `AND_IMM8:      begin res <= rfoa & {{24{ir[23]}},ir[23:16]}; Rt <= ir[15:12]; pc <= pc + 32'd3; b <= {{24{ir[23]}},ir[23:16]}; end
                `AND_IMM8:      begin res <= rfoa & {{24{ir[23]}},ir[23:16]}; Rt <= ir[15:12]; pc <= pc + 32'd3; b <= {{24{ir[23]}},ir[23:16]}; end
                `EOR_IMM8:      begin res <= rfoa ^ {{24{ir[23]}},ir[23:16]}; Rt <= ir[15:12]; pc <= pc + 32'd3; b <= {{24{ir[23]}},ir[23:16]}; end
                `EOR_IMM8:      begin res <= rfoa ^ {{24{ir[23]}},ir[23:16]}; Rt <= ir[15:12]; pc <= pc + 32'd3; b <= {{24{ir[23]}},ir[23:16]}; end
                `CMP_IMM8:      begin res <= acc - {{24{ir[15]}},ir[15:8]}; Rt <= 4'h0; pc <= pc + 32'd2; b <= {{24{ir[15]}},ir[15:8]}; end
                `CMP_IMM8:      begin res <= acc - {{24{ir[15]}},ir[15:8]}; Rt <= 4'h0; pc <= pc + 32'd2; b <= {{24{ir[15]}},ir[15:8]}; end
                `ASL_IMM8:      begin a <= rfoa; b <= ir[20:16]; Rt <= ir[15:12]; pc <= pc + 32'd3; state <= CALC; end
                `ASL_IMM8:      begin a <= rfoa; b <= ir[20:16]; Rt <= ir[15:12]; pc <= pc + 32'd3; state <= CALC; end
                `LSR_IMM8:      begin a <= rfoa; b <= ir[20:16]; Rt <= ir[15:12]; pc <= pc + 32'd3; state <= CALC; end
                `LSR_IMM8:      begin a <= rfoa; b <= ir[20:16]; Rt <= ir[15:12]; pc <= pc + 32'd3; state <= CALC; end
 
 
                `ADD_IMM16:     begin res <= rfoa + {{16{ir[31]}},ir[31:16]}; Rt <= ir[15:12]; pc <= pc + 32'd4; a <= rfoa; b <= {{16{ir[31]}},ir[31:16]}; end
                `ADD_IMM16:     begin res <= rfoa + {{16{ir[31]}},ir[31:16]} + {31'b0,df&cf}; Rt <= ir[15:12]; pc <= pc + 32'd4; a <= rfoa; b <= {{16{ir[31]}},ir[31:16]}; end
                `SUB_IMM16:     begin res <= rfoa - {{16{ir[31]}},ir[31:16]}; Rt <= ir[15:12]; pc <= pc + 32'd4; a <= rfoa; b <= {{16{ir[31]}},ir[31:16]}; end
                `SUB_IMM16:     begin res <= rfoa - {{16{ir[31]}},ir[31:16]} - {31'b0,df&~cf&|ir[15:12]}; Rt <= ir[15:12]; pc <= pc + 32'd4; a <= rfoa; b <= {{16{ir[31]}},ir[31:16]}; end
                `OR_IMM16:      begin res <= rfoa | {{16{ir[31]}},ir[31:16]}; Rt <= ir[15:12]; pc <= pc + 32'd4; b <= {{16{ir[31]}},ir[31:16]}; end
                `OR_IMM16:      begin res <= rfoa | {{16{ir[31]}},ir[31:16]}; Rt <= ir[15:12]; pc <= pc + 32'd4; b <= {{16{ir[31]}},ir[31:16]}; end
                `AND_IMM16:     begin res <= rfoa & {{16{ir[31]}},ir[31:16]}; Rt <= ir[15:12]; pc <= pc + 32'd4; b <= {{16{ir[31]}},ir[31:16]}; end
                `AND_IMM16:     begin res <= rfoa & {{16{ir[31]}},ir[31:16]}; Rt <= ir[15:12]; pc <= pc + 32'd4; b <= {{16{ir[31]}},ir[31:16]}; end
                `EOR_IMM16:     begin res <= rfoa ^ {{16{ir[31]}},ir[31:16]}; Rt <= ir[15:12]; pc <= pc + 32'd4; b <= {{16{ir[31]}},ir[31:16]}; end
                `EOR_IMM16:     begin res <= rfoa ^ {{16{ir[31]}},ir[31:16]}; Rt <= ir[15:12]; pc <= pc + 32'd4; b <= {{16{ir[31]}},ir[31:16]}; end
 
 
                `ADD_IMM32:     begin res <= rfoa + ir[47:16]; Rt <= ir[15:12]; pc <= pc + 32'd6; a <= rfoa; b <= ir[47:16]; end
                `ADD_IMM32:     begin res <= rfoa + ir[47:16]; Rt <= ir[15:12] + {31'b0,df&cf}; pc <= pc + 32'd6; a <= rfoa; b <= ir[47:16]; end
                `SUB_IMM32:     begin res <= rfoa - ir[47:16]; Rt <= ir[15:12]; pc <= pc + 32'd6; a <= rfoa; b <= ir[47:16]; end
                `SUB_IMM32:     begin res <= rfoa - ir[47:16]; Rt <= ir[15:12] - {31'b0,df&~cf&|ir[15:12]}; pc <= pc + 32'd6; a <= rfoa; b <= ir[47:16]; end
                `OR_IMM32:      begin res <= rfoa | ir[47:16]; Rt <= ir[15:12]; pc <= pc + 32'd6; b <= ir[47:16]; end
                `OR_IMM32:      begin res <= rfoa | ir[47:16]; Rt <= ir[15:12]; pc <= pc + 32'd6; b <= ir[47:16]; end
                `AND_IMM32:     begin res <= rfoa & ir[47:16]; Rt <= ir[15:12]; pc <= pc + 32'd6; b <= ir[47:16]; end
                `AND_IMM32:     begin res <= rfoa & ir[47:16]; Rt <= ir[15:12]; pc <= pc + 32'd6; b <= ir[47:16]; end
                `EOR_IMM32:     begin res <= rfoa ^ ir[47:16]; Rt <= ir[15:12]; pc <= pc + 32'd6; b <= ir[47:16]; end
                `EOR_IMM32:     begin res <= rfoa ^ ir[47:16]; Rt <= ir[15:12]; pc <= pc + 32'd6; b <= ir[47:16]; end
 
 
                `LDX_IMM32,`LDY_IMM32,`LDA_IMM32:       begin res <= ir[39:8]; pc <= pc + 32'd5; end
                `LDX_IMM32,`LDY_IMM32,`LDA_IMM32:       begin res <= ir[39:8]; pc <= pc + 32'd5; end
Line 127... Line 127...
 
 
                `LDX_ZPX,`LDY_ZPX:
                `LDX_ZPX,`LDY_ZPX:
                        begin
                        begin
                                radr <= zpx32xy_address;
                                radr <= zpx32xy_address;
                                pc <= pc + 32'd3;
                                pc <= pc + 32'd3;
                                state <= LOAD1;
                                load_what <= `WORD_311;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `ORB_ZPX:
                `ORB_ZPX:
                        begin
                        begin
                                a <= rfoa;
                                a <= rfoa;
                                Rt <= ir[19:16];
                                Rt <= ir[19:16];
                                radr <= zpx32_address[31:2];
                                radr <= zpx32_address[31:2];
                                radr2LSB <= zpx32_address[1:0];
                                radr2LSB <= zpx32_address[1:0];
                                pc <= pc + 32'd4;
                                pc <= pc + 32'd4;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `LDX_ABS,`LDY_ABS:
                `LDX_ABS,`LDY_ABS:
                        begin
                        begin
                                radr <= ir[39:8];
                                radr <= ir[39:8];
                                pc <= pc + 32'd5;
                                pc <= pc + 32'd5;
                                state <= LOAD1;
                                load_what <= `WORD_311;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `ORB_ABS:
                `ORB_ABS:
                        begin
                        begin
                                a <= rfoa;
                                a <= rfoa;
                                Rt <= ir[15:12];
                                Rt <= ir[15:12];
                                radr <= ir[47:18];
                                radr <= ir[47:18];
                                radr2LSB <= ir[17:16];
                                radr2LSB <= ir[17:16];
                                pc <= pc + 32'd6;
                                pc <= pc + 32'd6;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `LDX_ABSY,`LDY_ABSX:
                `LDX_ABSY,`LDY_ABSX:
                        begin
                        begin
                                radr <= absx32xy_address;
                                radr <= absx32xy_address;
                                pc <= pc + 32'd6;
                                pc <= pc + 32'd6;
                                state <= LOAD1;
                                load_what <= `WORD_311;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `ORB_ABSX:
                `ORB_ABSX:
                        begin
                        begin
                                a <= rfoa;
                                a <= rfoa;
                                Rt <= ir[19:16];
                                Rt <= ir[19:16];
                                radr <= absx32_address[31:2];
                                radr <= absx32_address[31:2];
                                radr2LSB <= absx32_address[1:0];
                                radr2LSB <= absx32_address[1:0];
                                pc <= pc + 32'd7;
                                pc <= pc + 32'd7;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `ST_ZPX:
                `ST_ZPX:
                        begin
                        begin
                                wadr <= zpx32_address;
                                wadr <= zpx32_address;
                                wdat <= rfoa;
                                wdat <= rfoa;
Line 246... Line 252...
                        begin
                        begin
                                a <= rfoa;
                                a <= rfoa;
                                Rt <= ir[19:16];
                                Rt <= ir[19:16];
                                radr <= zpx32_address;
                                radr <= zpx32_address;
                                pc <= pc + 32'd4;
                                pc <= pc + 32'd4;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `ASL_ZPX,`ROL_ZPX,`LSR_ZPX,`ROR_ZPX,`INC_ZPX,`DEC_ZPX:
                `ASL_ZPX,`ROL_ZPX,`LSR_ZPX,`ROR_ZPX,`INC_ZPX,`DEC_ZPX:
                        begin
                        begin
                                radr <= dp + rfoa + ir[23:12];
                                radr <= dp + rfoa + ir[23:12];
                                pc <= pc + 32'd3;
                                pc <= pc + 32'd3;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `ADD_IX,`SUB_IX,`OR_IX,`AND_IX,`EOR_IX,`ST_IX:
                `ADD_IX,`SUB_IX,`OR_IX,`AND_IX,`EOR_IX,`ST_IX:
                        begin
                        begin
                                a <= rfoa;
                                a <= rfoa;
                                if (ir[7:0]==`ST_IX)
                                if (ir[7:0]==`ST_IX)
                                        res <= rfoa;            // for ST_IX, Rt=0
                                        res <= rfoa;            // for ST_IX, Rt=0
                                else
                                else
                                        Rt <= ir[19:16];
                                        Rt <= ir[19:16];
                                pc <= pc + 32'd4;
                                pc <= pc + 32'd4;
                                radr <= dp + ir[31:20] + rfob;
                                radr <= dp + ir[31:20] + rfob;
                                state <= IX1;
                                load_what <= `IA_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `ADD_RIND,`SUB_RIND,`OR_RIND,`AND_RIND,`EOR_RIND,`ST_RIND:
                `ADD_RIND,`SUB_RIND,`OR_RIND,`AND_RIND,`EOR_RIND,`ST_RIND:
                        begin
                        begin
                                radr <= rfob;
                                radr <= rfob;
                                wadr <= rfob;           // for store
                                wadr <= rfob;           // for store
Line 279... Line 288...
                                        state <= STORE1;
                                        state <= STORE1;
                                end
                                end
                                else begin
                                else begin
                                        Rt <= ir[19:16];
                                        Rt <= ir[19:16];
                                        pc <= pc + 32'd3;
                                        pc <= pc + 32'd3;
                                        state <= LOAD1;
                                        load_what <= `WORD_310;
 
                                        state <= LOAD_MAC1;
                                end
                                end
                        end
                        end
                `ADD_IY,`SUB_IY,`OR_IY,`AND_IY,`EOR_IY,`ST_IY:
                `ADD_IY,`SUB_IY,`OR_IY,`AND_IY,`EOR_IY,`ST_IY:
                        begin
                        begin
                                a <= rfoa;
                                a <= rfoa;
                                if (ir[7:0]==`ST_IY)
                                if (ir[7:0]==`ST_IY)
                                        res <= rfoa;            // for ST_IY, Rt=0
                                        res <= rfoa;            // for ST_IY, Rt=0
                                else
                                else
                                        Rt <= ir[19:16];
                                        Rt <= ir[19:16];
                                pc <= pc + 32'd4;
                                pc <= pc + 32'd4;
 
                                isIY <= 1'b1;
                                radr <= dp + ir[31:20];
                                radr <= dp + ir[31:20];
                                state <= IY1;
                                load_what <= `IA_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `ADD_ABS,`SUB_ABS,`OR_ABS,`AND_ABS,`EOR_ABS:
                `ADD_ABS,`SUB_ABS,`OR_ABS,`AND_ABS,`EOR_ABS:
                        begin
                        begin
                                a <= rfoa;
                                a <= rfoa;
                                radr <= ir[47:16];
                                radr <= ir[47:16];
                                Rt <= ir[15:12];
                                Rt <= ir[15:12];
                                pc <= pc + 32'd6;
                                pc <= pc + 32'd6;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `ASL_ABS,`ROL_ABS,`LSR_ABS,`ROR_ABS,`INC_ABS,`DEC_ABS:
                `ASL_ABS,`ROL_ABS,`LSR_ABS,`ROR_ABS,`INC_ABS,`DEC_ABS:
                        begin
                        begin
                                radr <= ir[39:8];
                                radr <= ir[39:8];
                                pc <= pc + 32'd5;
                                pc <= pc + 32'd5;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `ADD_ABSX,`SUB_ABSX,`OR_ABSX,`AND_ABSX,`EOR_ABSX:
                `ADD_ABSX,`SUB_ABSX,`OR_ABSX,`AND_ABSX,`EOR_ABSX:
                        begin
                        begin
                                a <= rfoa;
                                a <= rfoa;
                                radr <= ir[55:24] + rfob;
                                radr <= ir[55:24] + rfob;
                                Rt <= ir[19:16];
                                Rt <= ir[19:16];
                                pc <= pc + 32'd7;
                                pc <= pc + 32'd7;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `ASL_ABSX,`ROL_ABSX,`LSR_ABSX,`ROR_ABSX,`INC_ABSX,`DEC_ABSX:
                `ASL_ABSX,`ROL_ABSX,`LSR_ABSX,`ROR_ABSX,`INC_ABSX,`DEC_ABSX:
                        begin
                        begin
                                radr <= ir[47:16] + rfob;
                                radr <= ir[47:16] + rfob;
                                pc <= pc + 32'd6;
                                pc <= pc + 32'd6;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `CPX_IMM32:
                `CPX_IMM32:
                        begin
                        begin
                                res <= x - ir[39:8];
                                res <= x - ir[39:8];
                                pc <= pc + 32'd5;
                                pc <= pc + 32'd5;
Line 337... Line 353...
                        end
                        end
                `CPX_ZPX:
                `CPX_ZPX:
                        begin
                        begin
                                radr <= dp + ir[23:12] + rfoa;
                                radr <= dp + ir[23:12] + rfoa;
                                pc <= pc + 32'd3;
                                pc <= pc + 32'd3;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `CPY_ZPX:
                `CPY_ZPX:
                        begin
                        begin
                                radr <= dp + ir[23:12] + rfoa;
                                radr <= dp + ir[23:12] + rfoa;
                                pc <= pc + 32'd3;
                                pc <= pc + 32'd3;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `CPX_ABS:
                `CPX_ABS:
                        begin
                        begin
                                radr <= ir[39:8];
                                radr <= ir[39:8];
                                pc <= pc + 32'd5;
                                pc <= pc + 32'd5;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `CPY_ABS:
                `CPY_ABS:
                        begin
                        begin
                                radr <= ir[39:8];
                                radr <= ir[39:8];
                                pc <= pc + 32'd5;
                                pc <= pc + 32'd5;
                                state <= LOAD1;
                                load_what <= `WORD_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `BRK:
                `BRK:
                        begin
                        begin
                                bf <= 1'b1;
                                bf <= 1'b1;
                                radr <= isp_dec;
                                radr <= isp_dec;
Line 372... Line 392...
                                adr_o <= {isp_dec,2'b00};
                                adr_o <= {isp_dec,2'b00};
                                dat_o <= pc + 32'd1;
                                dat_o <= pc + 32'd1;
                                vect <= {vbr[31:9],`BRK_VECTNO,2'b00};
                                vect <= {vbr[31:9],`BRK_VECTNO,2'b00};
                                state <= IRQ1;
                                state <= IRQ1;
                        end
                        end
 
                `INT0,`INT1:
 
                        begin
 
                                radr <= isp_dec;
 
                                wadr <= isp_dec;
 
                                wdat <= pc + 32'd2;
 
                                cyc_o <= 1'b1;
 
                                stb_o <= 1'b1;
 
                                we_o <= 1'b1;
 
                                sel_o <= 4'hF;
 
                                adr_o <= {isp_dec,2'b00};
 
                                dat_o <= pc + 32'd2;
 
                                vect <= {vbr[31:9],ir[15:7],2'b00};
 
                                state <= IRQ1;
 
                        end
                `JMP:
                `JMP:
                        begin
                        begin
                                pc[15:0] <= ir[23:8];
                                pc[15:0] <= ir[23:8];
                                state <= IFETCH;
                                state <= IFETCH;
                        end
                        end
Line 385... Line 419...
                                state <= IFETCH;
                                state <= IFETCH;
                        end
                        end
                `JMP_IND:
                `JMP_IND:
                        begin
                        begin
                                radr <= ir[39:8];
                                radr <= ir[39:8];
                                state <= JMP_IND1;
                                load_what <= `PC_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `JMP_INDX:
                `JMP_INDX:
                        begin
                        begin
                                radr <= ir[39:8] + x;
                                radr <= ir[39:8] + x;
                                state <= JMP_IND1;
                                load_what <= `PC_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `JMP_RIND:
                `JMP_RIND:
                        begin
                        begin
                                pc <= rfoa;
                                pc <= rfoa;
                                res <= pc + 32'd2;
                                res <= pc + 32'd2;
Line 485... Line 521...
//                              state <= JSR161;
//                              state <= JSR161;
//                      end
//                      end
                `RTS,`RTL:
                `RTS,`RTL:
                                begin
                                begin
                                radr <= isp;
                                radr <= isp;
                                state <= RTS1;
                                load_what <= `PC_310;
 
                                state <= LOAD_MAC1;
                                end
                                end
                `RTI:   begin
                `RTI:   begin
                                radr <= isp;
                                radr <= isp;
                                state <= RTI1;
                                load_what <= `SR_310;
 
                                state <= LOAD_MAC1;
                                end
                                end
                `BEQ,`BNE,`BPL,`BMI,`BCC,`BCS,`BVC,`BVS,`BRA:
                `BEQ,`BNE,`BPL,`BMI,`BCC,`BCS,`BVC,`BVS,`BRA:
                        begin
                        begin
                                state <= IFETCH;
                                state <= IFETCH;
                                if (ir[15:8]==8'h00) begin
                                if (ir[15:8]==8'h00) begin
Line 643... Line 681...
                                pc <= pc + 32'd1;
                                pc <= pc + 32'd1;
                        end
                        end
                `PLP:
                `PLP:
                        begin
                        begin
                                radr <= isp;
                                radr <= isp;
                                state <= PLP1;
 
                                pc <= pc + 32'd1;
                                pc <= pc + 32'd1;
 
                                load_what <= `SR_310;
 
                                state <= LOAD_MAC1;
                        end
                        end
                `PLA,`PLX,`PLY:
                `PLA,`PLX,`PLY:
                        begin
                        begin
                                radr <= isp;
                                radr <= isp;
                                isp <= isp_inc;
                                isp <= isp_inc;
                                state <= PLA1;
                                load_what <= `WORD_311;
 
                                state <= LOAD_MAC1;
                                pc <= pc + 32'd1;
                                pc <= pc + 32'd1;
                        end
                        end
                `POP:
                `POP:
                        begin
                        begin
                                Rt <= ir[15:12];
                                Rt <= ir[15:12];
                                radr <= isp;
                                radr <= isp;
                                isp <= isp_inc;
                                isp <= isp_inc;
                                state <= PLA1;
                                load_what <= `WORD_311;
 
                                state <= LOAD_MAC1;
                                pc <= pc + 32'd2;
                                pc <= pc + 32'd2;
                        end
                        end
                default:        // unimplemented opcode
                default:        // unimplemented opcode
                        pc <= pc + 32'd1;
                        begin
 
                                radr <= isp_dec;
 
                                wadr <= isp_dec;
 
                                wdat <= pc + 32'd1;
 
                                cyc_o <= 1'b1;
 
                                stb_o <= 1'b1;
 
                                we_o <= 1'b1;
 
                                sel_o <= 4'hF;
 
                                adr_o <= {isp_dec,2'b00};
 
                                dat_o <= pc + 32'd1;
 
                                vect <= {vbr[31:9],9'd495,2'b00};
 
                                state <= IRQ1;
 
                        end
                endcase
                endcase
        end
        end
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.