1 |
32 |
robfinch |
// ============================================================================
|
2 |
|
|
// __
|
3 |
38 |
robfinch |
// \\__/ o\ (C) 2013, 2014 Robert Finch, Stratford
|
4 |
32 |
robfinch |
// \ __ / All rights reserved.
|
5 |
|
|
// \/_// robfinch<remove>@opencores.org
|
6 |
|
|
// ||
|
7 |
|
|
//
|
8 |
|
|
// This source file is free software: you can redistribute it and/or modify
|
9 |
|
|
// it under the terms of the GNU Lesser General Public License as published
|
10 |
|
|
// by the Free Software Foundation, either version 3 of the License, or
|
11 |
|
|
// (at your option) any later version.
|
12 |
|
|
//
|
13 |
|
|
// This source file is distributed in the hope that it will be useful,
|
14 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
// GNU General Public License for more details.
|
17 |
|
|
//
|
18 |
|
|
// You should have received a copy of the GNU General Public License
|
19 |
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20 |
|
|
//
|
21 |
|
|
// ============================================================================
|
22 |
|
|
//
|
23 |
|
|
`include "rtf65002_defines.v"
|
24 |
|
|
|
25 |
38 |
robfinch |
module rtf65002_pcinc8(opcode,suppress_pcinc,inc,m16,xb16);
|
26 |
32 |
robfinch |
input [7:0] opcode;
|
27 |
|
|
input [3:0] suppress_pcinc;
|
28 |
|
|
output reg [3:0] inc;
|
29 |
38 |
robfinch |
input m16;
|
30 |
|
|
input xb16;
|
31 |
32 |
robfinch |
|
32 |
35 |
robfinch |
always @(opcode,suppress_pcinc)
|
33 |
32 |
robfinch |
if (suppress_pcinc==4'hF)
|
34 |
|
|
case(opcode)
|
35 |
38 |
robfinch |
`SEP,`REP: inc <= 4'd2;
|
36 |
32 |
robfinch |
`BRK: inc <= 4'd0;
|
37 |
|
|
`BPL,`BMI,`BCS,`BCC,`BVS,`BVC,`BEQ,`BNE,`BRA: inc <= 4'd2;
|
38 |
|
|
`BRL: inc <= 4'd3;
|
39 |
|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c <= 4'd3;
|
76 |
|
|
`LDY_ABSX,`BIT_ABSX,`STZ_ABSX: inc <= 4'd3;
|
77 |
|
|
`ASL_ABSX,`ROL_ABSX,`LSR_ABSX,`ROR_ABSX,`INC_ABSX,`DEC_ABSX: inc <= 4'd3;
|
78 |
|
|
|
79 |
|
|
`ADC_ABSY,`SBC_ABSY,`CMP_ABSY,`AND_ABSY,`ORA_ABSY,`EOR_ABSY,`LDA_ABSY,`STA_ABSY: inc <= 4'd3;
|
80 |
|
|
`LDX_ABSY: inc <= 4'd3;
|
81 |
|
|
|
82 |
38 |
robfinch |
`ADC_AL,`SBC_AL,`CMP_AL,`AND_AL,`ORA_AL,`EOR_AL,`LDA_AL,`STA_AL: inc <= 4'd4;
|
83 |
|
|
`ADC_ALX,`SBC_ALX,`CMP_ALX,`AND_ALX,`ORA_ALX,`EOR_ALX,`LDA_ALX,`STA_ALX: inc <= 4'd4;
|
84 |
|
|
|
85 |
|
|
`ADC_DSP,`SBC_DSP,`CMP_DSP,`AND_DSP,`ORA_DSP,`EOR_DSP,`LDA_DSP,`STA_DSP: inc <= 4'd2;
|
86 |
|
|
`ADC_DSPIY,`SBC_DSPIY,`CMP_DSPIY,`AND_DSPIY,`ORA_DSPIY,`EOR_DSPIY,`LDA_DSPIY,`STA_DSPIY: inc <= 4'd2;
|
87 |
|
|
|
88 |
32 |
robfinch |
`ASL_ACC,`LSR_ACC,`ROR_ACC,`ROL_ACC: inc <= 4'd1;
|
89 |
|
|
|
90 |
38 |
robfinch |
`PHP,`PHA,`PHX,`PHY,`PHK,`PHB,`PHD,`PLP,`PLA,`PLX,`PLY,`PLB,`PLD: inc <= 4'd1;
|
91 |
|
|
`PEA,`PER,`MVN,`MVP: inc <= 4'd3;
|
92 |
|
|
`PEI: inc <= 4'd2;
|
93 |
32 |
robfinch |
|
94 |
|
|
default: inc <= 4'd0; // unimplemented instruction
|
95 |
|
|
endcase
|
96 |
|
|
else
|
97 |
|
|
inc <= 4'd0;
|
98 |
|
|
endmodule
|