Line 1... |
Line 1... |
// ============================================================================
|
// ============================================================================
|
// __
|
// __
|
// \\__/ o\ (C) 2013 Robert Finch, Stratford
|
// \\__/ o\ (C) 2013, 2014 Robert Finch, Stratford
|
// \ __ / All rights reserved.
|
// \ __ / All rights reserved.
|
// \/_// robfinch<remove>@opencores.org
|
// \/_// robfinch<remove>@opencores.org
|
// ||
|
// ||
|
//
|
//
|
// This source file is free software: you can redistribute it and/or modify
|
// This source file is free software: you can redistribute it and/or modify
|
Line 20... |
Line 20... |
//
|
//
|
// ============================================================================
|
// ============================================================================
|
//
|
//
|
`include "rtf65002_defines.v"
|
`include "rtf65002_defines.v"
|
|
|
module rtf65002_pcinc8(opcode,suppress_pcinc,inc);
|
module rtf65002_pcinc8(opcode,suppress_pcinc,inc,m16,xb16);
|
input [7:0] opcode;
|
input [7:0] opcode;
|
input [3:0] suppress_pcinc;
|
input [3:0] suppress_pcinc;
|
output reg [3:0] inc;
|
output reg [3:0] inc;
|
|
input m16;
|
|
input xb16;
|
|
|
always @(opcode,suppress_pcinc)
|
always @(opcode,suppress_pcinc)
|
if (suppress_pcinc==4'hF)
|
if (suppress_pcinc==4'hF)
|
case(opcode)
|
case(opcode)
|
|
`SEP,`REP: inc <= 4'd2;
|
`BRK: inc <= 4'd0;
|
`BRK: inc <= 4'd0;
|
`BPL,`BMI,`BCS,`BCC,`BVS,`BVC,`BEQ,`BNE,`BRA: inc <= 4'd2;
|
`BPL,`BMI,`BCS,`BCC,`BVS,`BVC,`BEQ,`BNE,`BRA: inc <= 4'd2;
|
`BRL: inc <= 4'd3;
|
`BRL: inc <= 4'd3;
|
`CLC,`SEC,`CLD,`SED,`CLV,`CLI,`SEI: inc <= 4'd1;
|
`CLC,`SEC,`CLD,`SED,`CLV,`CLI,`SEI: inc <= 4'd1;
|
`TAS,`TSA,`TAY,`TYA,`TAX,`TXA,`TSX,`TXS,`TYX,`TXY: inc <= 4'd1;
|
`TAS,`TSA,`TAY,`TYA,`TAX,`TXA,`TSX,`T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AL,`AND_AL,`ORA_AL,`EOR_AL,`LDA_AL,`STA_AL: inc <= 4'd4;
|
|
`ADC_ALX,`SBC_ALX,`CMP_ALX,`AND_ALX,`ORA_ALX,`EOR_ALX,`LDA_ALX,`STA_ALX: inc <= 4'd4;
|
|
|
|
`ADC_DSP,`SBC_DSP,`CMP_DSP,`AND_DSP,`ORA_DSP,`EOR_DSP,`LDA_DSP,`STA_DSP: inc <= 4'd2;
|
|
`ADC_DSPIY,`SBC_DSPIY,`CMP_DSPIY,`AND_DSPIY,`ORA_DSPIY,`EOR_DSPIY,`LDA_DSPIY,`STA_DSPIY: inc <= 4'd2;
|
|
|
`ASL_ACC,`LSR_ACC,`ROR_ACC,`ROL_ACC: inc <= 4'd1;
|
`ASL_ACC,`LSR_ACC,`ROR_ACC,`ROL_ACC: inc <= 4'd1;
|
|
|
`PHP,`PHA,`PHX,`PHY,`PLP,`PLA,`PLX,`PLY: inc <= 4'd1;
|
`PHP,`PHA,`PHX,`PHY,`PHK,`PHB,`PHD,`PLP,`PLA,`PLX,`PLY,`PLB,`PLD: inc <= 4'd1;
|
|
`PEA,`PER,`MVN,`MVP: inc <= 4'd3;
|
|
`PEI: inc <= 4'd2;
|
|
|
default: inc <= 4'd0; // unimplemented instruction
|
default: inc <= 4'd0; // unimplemented instruction
|
endcase
|
endcase
|
else
|
else
|
inc <= 4'd0;
|
inc <= 4'd0;
|