1 |
32 |
robfinch |
// ============================================================================
|
2 |
|
|
// __
|
3 |
|
|
// \\__/ o\ (C) 2013 Robert Finch, Stratford
|
4 |
|
|
// \ __ / 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 |
|
|
module rtf65002_pcinc8(opcode,suppress_pcinc,inc);
|
26 |
|
|
input [7:0] opcode;
|
27 |
|
|
input [3:0] suppress_pcinc;
|
28 |
|
|
output reg [3:0] inc;
|
29 |
|
|
|
30 |
|
|
always @(opcode)
|
31 |
|
|
if (suppress_pcinc==4'hF)
|
32 |
|
|
case(opcode)
|
33 |
|
|
`BRK: inc <= 4'd0;
|
34 |
|
|
`BPL,`BMI,`BCS,`BCC,`BVS,`BVC,`BEQ,`BNE,`BRA: inc <= 4'd2;
|
35 |
|
|
`BRL: inc <= 4'd3;
|
36 |
|
|
`CLC,`SEC,`CLD,`SED,`CLV,`CLI,`SEI: inc <= 4'd1;
|
37 |
|
|
`TAS,`TSA,`TAY,`TYA,`TAX,`TXA,`TSX,`TXS,`TYX,`TXY: inc <= 4'd1;
|
38 |
|
|
`INY,`DEY,`INX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 |
|
|
|
81 |
|
|
default: inc <= 4'd0; // unimplemented instruction
|
82 |
|
|
endcase
|
83 |
|
|
else
|
84 |
|
|
inc <= 4'd0;
|
85 |
|
|
endmodule
|