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

Subversion Repositories t6507lp

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 158 to Rev 159
    Reverse comparison

Rev 158 → Rev 159

/t6507lp/trunk/fv/alu_opcodes.e
5,16 → 5,16
AND_IMM = 8'h29, AND_ZPG = 8'h25, AND_ZPX = 8'h35, AND_ABS = 8'h2D, AND_ABX = 8'h3D, AND_ABY = 8'h39, AND_IDX = 8'h21, AND_IDY = 8'h31,
ASL_ACC = 8'h0A, ASL_ZPG = 8'h06, ASL_ZPX = 8'h16, ASL_ABS = 8'h0E, ASL_ABX = 8'h1E, BCC_REL = 8'h90, BCS_REL = 8'hB0, BEQ_REL = 8'hF0,
BIT_ZPG = 8'h24, BIT_ABS = 8'h2C, BMI_REL = 8'h30, BNE_REL = 8'hD0, BPL_REL = 8'h10, BRK_IMP = 8'h00, BVC_REL = 8'h50, BVS_REL = 8'h70,
CLC_IMP = 8'h18, CLD_IMP = 8'hD8, CLI_IMP = 8'h58, CLV_IMP = 8'hB8];// CMP_IMM = 8'hC9, CMP_ZPG = 8'hC5, CMP_ZPX = 8'hD5, CMP_ABS = 8'hCD,
// CMP_ABX = 8'hDD, CMP_ABY = 8'hD9, CMP_IDX = 8'hC1, CMP_IDY = 8'hD1, CPX_IMM = 8'hE0, CPX_ZPG = 8'hE4, CPX_ABS = 8'hEC, CPY_IMM = 8'hC0,
// CPY_ZPG = 8'hC4, CPY_ABS = 8'hCC, DEC_ZPG = 8'hC6, DEC_ZPX = 8'hD6, DEC_ABS = 8'hCE, DEC_ABX = 8'hDE, DEX_IMP = 8'hCA, DEY_IMP = 8'h88,
// EOR_IMM = 8'h49, EOR_ZPG = 8'h45, EOR_ZPX = 8'h55, EOR_ABS = 8'h4D, EOR_ABX = 8'h5D, EOR_ABY = 8'h59, EOR_IDX = 8'h41, EOR_IDY = 8'h51,
// INC_ZPG = 8'hE6, INC_ZPX = 8'hF6, INC_ABS = 8'hEE, INC_ABX = 8'hFE, INX_IMP = 8'hE8, INY_IMP = 8'hC8, JMP_ABS = 8'h4C, JMP_IND = 8'h6C,
// JSR_ABS = 8'h20, LDA_IMM = 8'hA9, LDA_ZPG = 8'hA5, LDA_ZPX = 8'hB5, LDA_ABS = 8'hAD, LDA_ABX = 8'hBD, LDA_ABY = 8'hB9, LDA_IDX = 8'hA1,
// LDA_IDY = 8'hB1, LDX_IMM = 8'hA2, LDX_ZPG = 8'hA6, LDX_ZPY = 8'hB6, LDX_ABS = 8'hAE, LDX_ABY = 8'hBE, LDY_IMM = 8'hA0, LDY_ZPG = 8'hA4,
// LDY_ZPX = 8'hB4, LDY_ABS = 8'hAC, LDY_ABX = 8'hBC, LSR_ACC = 8'h4A, LSR_ZPG = 8'h46, LSR_ZPX = 8'h56, LSR_ABS = 8'h4E, LSR_ABX = 8'h5E,
// NOP_IMP = 8'hEA, ORA_IMM = 8'h09, ORA_ZPG = 8'h05, ORA_ZPX = 8'h15, ORA_ABS = 8'h0D, ORA_ABX = 8'h1D, ORA_ABY = 8'h19, ORA_IDX = 8'h01,
// ORA_IDY = 8'h11, PHA_IMP = 8'h48, PHP_IMP = 8'h08, PLA_IMP = 8'h68, PLP_IMP = 8'h28, ROL_ACC = 8'h2A, ROL_ZPG = 8'h26, ROL_ZPX = 8'h36,
CLC_IMP = 8'h18, CLD_IMP = 8'hD8, CLI_IMP = 8'h58, CLV_IMP = 8'hB8, CMP_IMM = 8'hC9, CMP_ZPG = 8'hC5, CMP_ZPX = 8'hD5, CMP_ABS = 8'hCD,
CMP_ABX = 8'hDD, CMP_ABY = 8'hD9, CMP_IDX = 8'hC1, CMP_IDY = 8'hD1, CPX_IMM = 8'hE0, CPX_ZPG = 8'hE4, CPX_ABS = 8'hEC, CPY_IMM = 8'hC0,
CPY_ZPG = 8'hC4, CPY_ABS = 8'hCC, DEC_ZPG = 8'hC6, DEC_ZPX = 8'hD6, DEC_ABS = 8'hCE, DEC_ABX = 8'hDE, DEX_IMP = 8'hCA, DEY_IMP = 8'h88,
EOR_IMM = 8'h49, EOR_ZPG = 8'h45, EOR_ZPX = 8'h55, EOR_ABS = 8'h4D, EOR_ABX = 8'h5D, EOR_ABY = 8'h59, EOR_IDX = 8'h41, EOR_IDY = 8'h51,
INC_ZPG = 8'hE6, INC_ZPX = 8'hF6, INC_ABS = 8'hEE, INC_ABX = 8'hFE, INX_IMP = 8'hE8, INY_IMP = 8'hC8, JMP_ABS = 8'h4C, JMP_IND = 8'h6C,
JSR_ABS = 8'h20, LDA_IMM = 8'hA9, LDA_ZPG = 8'hA5, LDA_ZPX = 8'hB5, LDA_ABS = 8'hAD, LDA_ABX = 8'hBD, LDA_ABY = 8'hB9, LDA_IDX = 8'hA1,
LDA_IDY = 8'hB1, LDX_IMM = 8'hA2, LDX_ZPG = 8'hA6, LDX_ZPY = 8'hB6, LDX_ABS = 8'hAE, LDX_ABY = 8'hBE, LDY_IMM = 8'hA0, LDY_ZPG = 8'hA4,
LDY_ZPX = 8'hB4, LDY_ABS = 8'hAC, LDY_ABX = 8'hBC, LSR_ACC = 8'h4A, LSR_ZPG = 8'h46, LSR_ZPX = 8'h56, LSR_ABS = 8'h4E, LSR_ABX = 8'h5E,
NOP_IMP = 8'hEA, ORA_IMM = 8'h09, ORA_ZPG = 8'h05, ORA_ZPX = 8'h15, ORA_ABS = 8'h0D, ORA_ABX = 8'h1D, ORA_ABY = 8'h19, ORA_IDX = 8'h01,
ORA_IDY = 8'h11, PHA_IMP = 8'h48, PHP_IMP = 8'h08, PLA_IMP = 8'h68, PLP_IMP = 8'h28];//, ROL_ACC = 8'h2A, ROL_ZPG = 8'h26, ROL_ZPX = 8'h36,
// ROL_ABS = 8'h2E, ROL_ABX = 8'h3E, ROR_ACC = 8'h6A, ROR_ZPG = 8'h66, ROR_ZPX = 8'h76, ROR_ABS = 8'h6E, ROR_ABX = 8'h7E, RTI_IMP = 8'h40,
// RTS_IMP = 8'h60, SBC_IMM = 8'hE9, SBC_ZPG = 8'hE5, SBC_ZPX = 8'hF5, SBC_ABS = 8'hED, SBC_ABX = 8'hFD, SBC_ABY = 8'hF9, SBC_IDX = 8'hE1,
// SBC_IDY = 8'hF1, SEC_IMP = 8'h38, SED_IMP = 8'hF8, SEI_IMP = 8'h78, STA_ZPG = 8'h85, STA_ZPX = 8'h95, STA_ABS = 8'h8D, STA_ABX = 8'h9D,
/t6507lp/trunk/fv/alu_chk.e
9,11 → 9,14
reg_status : byte;
reg_result : byte;
 
inst : alu_input_s;
next_inst : alu_input_s;
!inst : alu_input_s;
!next_inst : alu_input_s;
 
count_cycles : int;
first_cycle : bool;
last_a : byte;
last_status : byte;
last_result : byte;
 
keep first_cycle == TRUE;
keep count_cycles == 0;
24,6 → 27,10
//out ("CYCLE ", count_cycles, " STORE:");
//print input;
 
last_a = reg_a;
last_status = reg_status;
last_result = reg_result;
 
if (first_cycle) {
inst = input;
next_inst = input;
48,6 → 55,11
//out ("CYCLE ", count_cycles, " COMPARE:");
//print inst;
 
if (count_cycles == 99999) {
out("ENOUGH!");
stop_run();
};
 
case inst.input_kind {
ENABLED_VALID: {
//out("CYCLE ", count_cycles, ": executing and comparing");
133,6 → 145,103
CLI_IMP: { reg_status[2:2] = 0; };
CLV_IMP: { reg_status[6:6] = 0; };
 
CMP_IMM: { exec_cmp(reg_a); }; // Z,C,N = A-M
CMP_ZPG: { exec_cmp(reg_a); };
CMP_ZPX: { exec_cmp(reg_a); };
CMP_ABS: { exec_cmp(reg_a); };
CMP_ABX: { exec_cmp(reg_a); };
CMP_ABY: { exec_cmp(reg_a); };
CMP_IDX: { exec_cmp(reg_a); };
CMP_IDY: { exec_cmp(reg_a); };
 
CPX_IMM: { exec_cmp(reg_x); }; // Z,C,N = X-M
CPX_ZPG: { exec_cmp(reg_x); };
CPX_ABS: { exec_cmp(reg_x); };
 
CPY_IMM: { exec_cmp(reg_y); }; //Z,C,N = Y-M
CPY_ZPG: { exec_cmp(reg_y); };
CPY_ABS: { exec_cmp(reg_y); };
 
DEC_ZPG: { exec_dec(inst.alu_a, TRUE); }; // M,Z,N = M-1
DEC_ZPX: { exec_dec(inst.alu_a, TRUE); };
DEC_ABS: { exec_dec(inst.alu_a, TRUE); };
DEC_ABX: { exec_dec(inst.alu_a, TRUE); };
 
DEX_IMP: { exec_dec(reg_x, FALSE); }; // X,Z,N = X-1
DEY_IMP: { exec_dec(reg_y, FALSE); }; // Y,Z,N = Y-1
 
EOR_IMM: { exec_eor(); }; // A,Z,N = A^M
EOR_ZPG: { exec_eor(); };
EOR_ZPX: { exec_eor(); };
EOR_ABS: { exec_eor(); };
EOR_ABX: { exec_eor(); };
EOR_ABY: { exec_eor(); };
EOR_IDX: { exec_eor(); };
EOR_IDY: { exec_eor(); };
 
INC_ZPG: { exec_inc(inst.alu_a, TRUE); };
INC_ZPX: { exec_inc(inst.alu_a, TRUE); };
INC_ABS: { exec_inc(inst.alu_a, TRUE); };
INC_ABX: { exec_inc(inst.alu_a, TRUE); };
 
INX_IMP: { exec_inc(reg_x, FALSE); };
INY_IMP: { exec_inc(reg_y, FALSE); };
 
JMP_ABS: {};
JMP_IND: {};
JSR_ABS: {};
 
LDA_IMM: { exec_load(reg_a, TRUE); }; // A,Z,N = M
LDA_ZPG: { exec_load(reg_a, TRUE); };
LDA_ZPX: { exec_load(reg_a, TRUE); };
LDA_ABS: { exec_load(reg_a, TRUE); };
LDA_ABX: { exec_load(reg_a, TRUE); };
LDA_ABY: { exec_load(reg_a, TRUE); };
LDA_IDX: { exec_load(reg_a, TRUE); };
LDA_IDY: { exec_load(reg_a, TRUE); };
 
LDX_IMM: { exec_load(reg_x, FALSE); };
LDX_ZPG: { exec_load(reg_x, FALSE); };
LDX_ZPY: { exec_load(reg_x, FALSE); };
LDX_ABS: { exec_load(reg_x, FALSE); };
LDX_ABY: { exec_load(reg_x, FALSE); };
 
LDY_IMM: { exec_load(reg_y, FALSE); };
LDY_ZPG: { exec_load(reg_y, FALSE); };
LDY_ZPX: { exec_load(reg_y, FALSE); };
LDY_ABS: { exec_load(reg_y, FALSE); };
LDY_ABX: { exec_load(reg_y, FALSE); };
 
LSR_ACC: { exec_lsr(reg_a); }; // A,C,Z,N = A/2 or M,C,Z,N = M/2
LSR_ZPG: { exec_lsr(inst.alu_a); };
LSR_ZPX: { exec_lsr(inst.alu_a); };
LSR_ABS: { exec_lsr(inst.alu_a); };
LSR_ABX: { exec_lsr(inst.alu_a); };
 
NOP_IMP: {};
 
ORA_IMM: { exec_or(); }; // A,Z,N = A|M
ORA_ZPG: { exec_or(); };
ORA_ZPX: { exec_or(); };
ORA_ABS: { exec_or(); };
ORA_ABX: { exec_or(); };
ORA_ABY: { exec_or(); };
ORA_IDX: { exec_or(); };
ORA_IDY: { exec_or(); };
 
PHA_IMP: { reg_result = reg_a; };
PHP_IMP: {}; // P is always connected and the result is not updated
PLA_IMP: {
reg_a = inst.alu_a;
reg_result = inst.alu_a;
update_z(reg_a);
update_n(reg_a);
};
PLP_IMP: {
reg_status = inst.alu_a;
reg_status[5:5] = 1; // this is always one
};
 
default: {
out(inst.alu_opcode);
dut_error("unknown opcode");
140,6 → 249,70
};
};
 
exec_or() is {
reg_a = reg_a | inst.alu_a;
reg_result = reg_a;
update_z(reg_a);
update_n(reg_a);
};
 
exec_lsr(arg1 : *byte) is {
reg_status[0:0] = arg1[0:0];
arg1 = arg1 >> 1;
update_z(arg1);
update_n(arg1);
reg_result = arg1;
};
 
exec_load(arg1 : *byte, update_result : bool) is {
arg1 = inst.alu_a;
if (update_result) { //
reg_result = inst.alu_a; // no need for this but...
};
update_z(arg1);
update_n(arg1);
};
 
exec_inc(arg1 : *byte, update_result : bool) is {
arg1 = arg1 + 1;
update_z(arg1);
update_n(arg1);
 
if (update_result) { //
reg_result = arg1;
};
};
 
exec_eor() is {
reg_a = reg_a ^ inst.alu_a;
reg_result = reg_a;
update_z(reg_a);
update_n(reg_a);
};
 
exec_dec(arg1 : *byte, update_result : bool) is {
arg1 = arg1 - 1;
update_z(arg1);
update_n(arg1);
 
if (update_result) { // DEX and DEY do not output the result
reg_result = arg1;
};
};
 
exec_cmp(arg1 : byte) is {
update_z(arg1 - inst.alu_a);
update_n(arg1 - inst.alu_a);
if (arg1 >= inst.alu_a) {
reg_status[0:0] = 1;
}
else {
reg_status[0:0] = 0;
};
};
 
exec_bit() is {
update_z(reg_a & inst.alu_a);
reg_status[7:7] = inst.alu_a[7:7];

powered by: WebSVN 2.1.0

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