Line 88... |
Line 88... |
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
@(negedge clk);
|
@(negedge clk);
|
alu_result_expected = 8'h00;
|
alu_result_expected = 8'h00;
|
// NV1BDIZC
|
// NV1BDIZC
|
alu_status_expected = 8'b00100010;
|
alu_status_expected = 8'b00100010;
|
check();
|
check;
|
|
|
// ADC
|
// ADC
|
alu_opcode = ADC_IMM;
|
alu_opcode = ADC_IMM;
|
alu_a = 1;
|
alu_a = 1;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 105... |
Line 105... |
sign = alu_result_expected[7];
|
sign = alu_result_expected[7];
|
{alu_status_expected[C], alu_result_expected} = alu_a + alu_result_expected + alu_status_expected[C];
|
{alu_status_expected[C], alu_result_expected} = alu_a + alu_result_expected + alu_status_expected[C];
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[V] = ((alu_a[7] == sign) && (alu_a[7] != alu_result_expected[7]));
|
alu_status_expected[V] = ((alu_a[7] == sign) && (alu_a[7] != alu_result_expected[7]));
|
check();
|
check;
|
end
|
|
|
|
// BCD
|
|
// LDA
|
|
alu_a = 0;
|
|
alu_opcode = LDA_IMM;
|
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
|
@(negedge clk);
|
|
alu_result_expected = 8'h00;
|
|
// NV1BDIZC
|
|
alu_status_expected[N] = 0;
|
|
alu_status_expected[Z] = 1;
|
|
check();
|
|
// SED
|
|
alu_opcode = SED_IMP;
|
|
@(negedge clk);
|
|
alu_status_expected[D] = 1;
|
|
check();
|
|
|
|
// ADC
|
|
alu_opcode = ADC_IMM;
|
|
for (i = 0; i < 1000; i = i + 1)
|
|
begin
|
|
alu_a = $random;
|
|
@(negedge clk);
|
|
$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
|
$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
|
$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], DUT.result);
|
|
sign = alu_result_expected[7];
|
|
AL = alu_a[3:0];
|
|
AH = alu_a[7:4];
|
|
BL = alu_result_expected[3:0];
|
|
BH = alu_result_expected[7:4];
|
|
if ( AL > 9 ) begin
|
|
AL = AL - 10;
|
|
AH = AH + 1;
|
|
end
|
|
if (AH > 9) begin
|
|
AH = AH - 10;
|
|
end
|
|
if ( BL > 9 ) begin
|
|
BL = BL - 10;
|
|
BH = BH + 1;
|
|
end
|
|
if ( BH > 9 ) begin
|
|
BH = BH - 10;
|
|
end
|
|
{C_in,alu_result_expected[3:0]} = AL + BL + alu_status_expected[C];
|
|
{alu_status_expected[C],alu_result_expected[7:4]} = AH + BH + C_in;
|
|
if ( alu_result_expected[3:0] > 9 ) begin
|
|
alu_result_expected[3:0] = alu_result_expected[3:0] - 10;
|
|
alu_result_expected[7:4] = alu_result_expected[7:4] + 1;
|
|
end
|
|
if ( alu_result_expected[7:4] > 9 ) begin
|
|
alu_result_expected[7:4] = alu_result_expected[7:4] - 10;
|
|
alu_status_expected[C] = 1;
|
|
end
|
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
|
alu_status_expected[N] = alu_result_expected[7];
|
|
alu_status_expected[V] = ((alu_a[7] == sign) && (alu_a[7] != alu_result_expected[7]));
|
|
check();
|
|
end
|
end
|
|
|
|
/*
|
|
// BCD
|
|
// LDA
|
|
alu_a = 0;
|
|
alu_opcode = LDA_IMM;
|
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
|
@(negedge clk);
|
|
alu_result_expected = 8'h00;
|
|
// NV1BDIZC
|
|
alu_status_expected[N] = 0;
|
|
alu_status_expected[Z] = 1;
|
|
check;
|
|
// SED
|
|
alu_opcode = SED_IMP;
|
|
@(negedge clk);
|
|
alu_status_expected[D] = 1;
|
|
check;
|
|
|
|
// ADC
|
|
alu_opcode = ADC_IMM;
|
|
for (i = 0; i < 1000; i = i + 1)
|
|
begin
|
|
alu_a = $random;
|
|
@(negedge clk);
|
|
$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
|
$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
|
$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], DUT.result);
|
|
sign = alu_result_expected[7];
|
|
AL = alu_a[3:0];
|
|
AH = alu_a[7:4];
|
|
BL = alu_result_expected[3:0];
|
|
BH = alu_result_expected[7:4];
|
|
if ( AL > 9 ) begin
|
|
AL = AL - 10;
|
|
AH = AH + 1;
|
|
end
|
|
if (AH > 9) begin
|
|
AH = AH - 10;
|
|
end
|
|
if ( BL > 9 ) begin
|
|
BL = BL - 10;
|
|
BH = BH + 1;
|
|
end
|
|
if ( BH > 9 ) begin
|
|
BH = BH - 10;
|
|
end
|
|
{C_in,alu_result_expected[3:0]} = AL + BL + alu_status_expected[C];
|
|
{alu_status_expected[C],alu_result_expected[7:4]} = AH + BH + C_in;
|
|
if ( alu_result_expected[3:0] > 9 ) begin
|
|
alu_result_expected[3:0] = alu_result_expected[3:0] - 10;
|
|
alu_result_expected[7:4] = alu_result_expected[7:4] + 1;
|
|
end
|
|
if ( alu_result_expected[7:4] > 9 ) begin
|
|
alu_result_expected[7:4] = alu_result_expected[7:4] - 10;
|
|
alu_status_expected[C] = 1;
|
|
end
|
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
|
alu_status_expected[N] = alu_result_expected[7];
|
|
alu_status_expected[V] = ((alu_a[7] == sign) && (alu_a[7] != alu_result_expected[7]));
|
|
check;
|
|
end
|
|
*/
|
|
|
// ASL
|
// ASL
|
alu_opcode = ASL_ABS;
|
alu_opcode = ASL_ABS;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
begin
|
begin
|
Line 183... |
Line 184... |
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
{alu_status_expected[C], alu_result_expected} = {alu_a,1'b0};
|
{alu_status_expected[C], alu_result_expected} = {alu_a,1'b0};
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
check();
|
check;
|
end
|
end
|
|
|
// LDA
|
// LDA
|
alu_a = 137;
|
alu_a = 137;
|
alu_opcode = LDA_IMM;
|
alu_opcode = LDA_IMM;
|
Line 196... |
Line 197... |
@(negedge clk);
|
@(negedge clk);
|
alu_result_expected = 8'd137;
|
alu_result_expected = 8'd137;
|
// NV1BDIZC
|
// NV1BDIZC
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
check();
|
check;
|
|
|
// EOR
|
// EOR
|
alu_opcode = EOR_IMM;
|
alu_opcode = EOR_IMM;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
begin
|
begin
|
Line 212... |
Line 213... |
$display("result_expected = %d",alu_result_expected);
|
$display("result_expected = %d",alu_result_expected);
|
alu_result_expected = alu_a ^ alu_result_expected;
|
alu_result_expected = alu_a ^ alu_result_expected;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
$display("result_expected = %d", alu_result_expected);
|
$display("result_expected = %d", alu_result_expected);
|
check();
|
check;
|
end
|
end
|
|
|
// LDA
|
// LDA
|
alu_a = 0;
|
alu_a = 0;
|
alu_opcode = LDA_IMM;
|
alu_opcode = LDA_IMM;
|
Line 225... |
Line 226... |
@(negedge clk);
|
@(negedge clk);
|
alu_result_expected = 8'h00;
|
alu_result_expected = 8'h00;
|
// NV1BDIZC
|
// NV1BDIZC
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
check();
|
check;
|
|
|
// SBC
|
// SBC
|
alu_opcode = SBC_IMM;
|
alu_opcode = SBC_IMM;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
begin
|
begin
|
alu_a = 1;
|
alu_a = 1;
|
@(negedge clk);
|
@(negedge clk);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
sign = alu_result_expected[7];
|
sign = alu_result_expected[7];
|
{alu_status_expected[C], alu_result_expected} = alu_result_expected - alu_a - ( 1 - alu_status_expected[C]);
|
{alu_status_expected[C], alu_result_expected} = alu_result_expected - alu_a - ( 1 - alu_status_expected[C]);
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
|
$display("alu_a[7] = %b == sign = %b && alu_a[7] = %b != alu_result_expected[7] = %b", alu_a[7], sign, alu_a[7], alu_result_expected[7]);
|
alu_status_expected[V] = ((alu_a[7] == sign) && (alu_a[7] != alu_result_expected[7]));
|
alu_status_expected[V] = ((alu_a[7] == sign) && (alu_a[7] != alu_result_expected[7]));
|
check();
|
check;
|
end
|
end
|
|
|
// LDA
|
// LDA
|
alu_opcode = LDA_IMM;
|
alu_opcode = LDA_IMM;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 256... |
Line 258... |
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
check();
|
check;
|
end
|
end
|
|
|
// LDX
|
// LDX
|
alu_opcode = LDX_IMM;
|
alu_opcode = LDX_IMM;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 272... |
Line 274... |
alu_status_expected[Z] = (alu_x_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_x_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_x_expected[7];
|
alu_status_expected[N] = alu_x_expected[7];
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
check();
|
check;
|
end
|
end
|
|
|
// LDY
|
// LDY
|
alu_opcode = LDY_IMM;
|
alu_opcode = LDY_IMM;
|
for (i = 0; i < 1001; i = i + 1)
|
for (i = 0; i < 1001; i = i + 1)
|
Line 288... |
Line 290... |
alu_status_expected[Z] = (alu_y_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_y_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_y_expected[7];
|
alu_status_expected[N] = alu_y_expected[7];
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
check();
|
check;
|
end
|
end
|
|
|
// STA
|
// STA
|
alu_opcode = STA_ABS;
|
alu_opcode = STA_ABS;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 300... |
Line 302... |
alu_a = i;
|
alu_a = i;
|
@(negedge clk);
|
@(negedge clk);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
check();
|
check;
|
end
|
end
|
|
|
// STX
|
// STX
|
alu_opcode = STX_ABS;
|
alu_opcode = STX_ABS;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 314... |
Line 316... |
//alu_result_expected = i;
|
//alu_result_expected = i;
|
//alu_x_expected = i;
|
//alu_x_expected = i;
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
check();
|
check;
|
end
|
end
|
|
|
// STY
|
// STY
|
alu_opcode = STY_ABS;
|
alu_opcode = STY_ABS;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 328... |
Line 330... |
//alu_result_expected = i;
|
//alu_result_expected = i;
|
//alu_y_expected = i;
|
//alu_y_expected = i;
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
check();
|
check;
|
end
|
end
|
|
|
// CMP
|
// CMP
|
alu_opcode = CMP_IMM;
|
alu_opcode = CMP_IMM;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 346... |
Line 348... |
//alu_result_expected = i;
|
//alu_result_expected = i;
|
//alu_y_expected = i;
|
//alu_y_expected = i;
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
check();
|
check;
|
end
|
end
|
|
|
// CPX
|
// CPX
|
alu_opcode = CPX_IMM;
|
alu_opcode = CPX_IMM;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 364... |
Line 366... |
//alu_result_expected = i;
|
//alu_result_expected = i;
|
//alu_y_expected = i;
|
//alu_y_expected = i;
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
check();
|
check;
|
end
|
end
|
|
|
// CPY
|
// CPY
|
alu_opcode = CPY_IMM;
|
alu_opcode = CPY_IMM;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 382... |
Line 384... |
//alu_result_expected = i;
|
//alu_result_expected = i;
|
//alu_y_expected = i;
|
//alu_y_expected = i;
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
check();
|
check;
|
end
|
end
|
|
|
|
|
// AND
|
// AND
|
alu_opcode = AND_IMM;
|
alu_opcode = AND_IMM;
|
Line 398... |
Line 400... |
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
check();
|
check;
|
end
|
end
|
|
|
// ASL
|
// ASL
|
alu_opcode = ASL_ACC;
|
alu_opcode = ASL_ACC;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 414... |
Line 416... |
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
check();
|
check;
|
end
|
end
|
|
|
// INC
|
// INC
|
alu_opcode = INC_ZPG;
|
alu_opcode = INC_ZPG;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 429... |
Line 431... |
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
alu_result_expected = alu_a + 1;
|
alu_result_expected = alu_a + 1;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
check();
|
check;
|
end
|
end
|
|
|
// INX
|
// INX
|
alu_opcode = INX_IMP;
|
alu_opcode = INX_IMP;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 444... |
Line 446... |
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
alu_x_expected = alu_x_expected + 1;
|
alu_x_expected = alu_x_expected + 1;
|
alu_status_expected[Z] = (alu_x_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_x_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_x_expected[7];
|
alu_status_expected[N] = alu_x_expected[7];
|
check();
|
check;
|
end
|
end
|
|
|
// INY
|
// INY
|
alu_opcode = INY_IMP;
|
alu_opcode = INY_IMP;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 459... |
Line 461... |
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
alu_y_expected = alu_y_expected + 1;
|
alu_y_expected = alu_y_expected + 1;
|
alu_status_expected[Z] = (alu_y_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_y_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_y_expected[7];
|
alu_status_expected[N] = alu_y_expected[7];
|
check();
|
check;
|
end
|
end
|
|
|
// DEC
|
// DEC
|
alu_opcode = DEC_ZPG;
|
alu_opcode = DEC_ZPG;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 474... |
Line 476... |
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
alu_result_expected = alu_a - 1;
|
alu_result_expected = alu_a - 1;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
check();
|
check;
|
end
|
end
|
|
|
// DEX
|
// DEX
|
alu_opcode = DEX_IMP;
|
alu_opcode = DEX_IMP;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 489... |
Line 491... |
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
alu_x_expected = alu_x_expected - 1;
|
alu_x_expected = alu_x_expected - 1;
|
alu_status_expected[Z] = (alu_x_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_x_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_x_expected[7];
|
alu_status_expected[N] = alu_x_expected[7];
|
check();
|
check;
|
end
|
end
|
|
|
// DEY
|
// DEY
|
alu_opcode = DEY_IMP;
|
alu_opcode = DEY_IMP;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
Line 504... |
Line 506... |
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
alu_y_expected = alu_y_expected - 1;
|
alu_y_expected = alu_y_expected - 1;
|
alu_status_expected[Z] = (alu_y_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_y_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_y_expected[7];
|
alu_status_expected[N] = alu_y_expected[7];
|
check();
|
check;
|
end
|
end
|
|
|
|
|
// LDA
|
// LDA
|
alu_a = 0;
|
alu_a = 0;
|
Line 517... |
Line 519... |
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
@(negedge clk);
|
@(negedge clk);
|
alu_result_expected = 8'h00;
|
alu_result_expected = 8'h00;
|
// NV1BDIZC
|
// NV1BDIZC
|
alu_status_expected = 8'b00100010;
|
alu_status_expected = 8'b00100010;
|
check();
|
check;
|
|
|
// BIT
|
// BIT
|
alu_opcode = BIT_ZPG;
|
alu_opcode = BIT_ZPG;
|
for (i = 0; i < 1000; i = i + 1)
|
for (i = 0; i < 1000; i = i + 1)
|
begin
|
begin
|
Line 531... |
Line 533... |
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
alu_status_expected[Z] = ((alu_a & alu_result_expected) == 0) ? 1 : 0;
|
alu_status_expected[Z] = ((alu_a & alu_result_expected) == 0) ? 1 : 0;
|
alu_status_expected[V] = alu_a[6];
|
alu_status_expected[V] = alu_a[6];
|
alu_status_expected[N] = alu_a[7];
|
alu_status_expected[N] = alu_a[7];
|
check();
|
check;
|
end
|
end
|
|
|
// PHA
|
// PHA
|
alu_opcode = PHA_IMP;
|
alu_opcode = PHA_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
alu_result_expected = DUT.A;
|
alu_result_expected = DUT.A;
|
check();
|
check;
|
|
|
// PHP
|
// PHP
|
alu_opcode = PHP_IMP;
|
alu_opcode = PHP_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("i = %d alu_opcode = %h alu_enable = %d", i, alu_opcode, alu_enable);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("DUT.A = %h DUT.X = %h DUT.Y = %h", DUT.A, DUT.X, DUT.Y);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
//$display("op1 = %d op2 = %d c = %d d = %d n = %d v = %d result = %d", alu_a, DUT.A, alu_status[C], alu_status[D], alu_status[N], alu_status[V], alu_result);
|
alu_status_expected = DUT.STATUS;
|
//alu_status_expected = DUT.STATUS;
|
check();
|
check;
|
|
|
// BRK
|
// BRK
|
alu_opcode = BRK_IMP;
|
alu_opcode = BRK_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_status_expected[B] = 1;
|
alu_status_expected[B] = 1;
|
check();
|
check;
|
|
|
// SEC
|
// SEC
|
alu_opcode = SEC_IMP;
|
alu_opcode = SEC_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_status_expected[C] = 1;
|
alu_status_expected[C] = 1;
|
check();
|
check;
|
|
|
// SED
|
// SED
|
alu_opcode = SED_IMP;
|
alu_opcode = SED_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_status_expected[D] = 1;
|
alu_status_expected[D] = 1;
|
check();
|
check;
|
|
|
// SEI
|
// SEI
|
alu_opcode = SEI_IMP;
|
alu_opcode = SEI_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_status_expected[I] = 1;
|
alu_status_expected[I] = 1;
|
check();
|
check;
|
|
|
// CLC
|
// CLC
|
alu_opcode = CLC_IMP;
|
alu_opcode = CLC_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_status_expected[C] = 0;
|
alu_status_expected[C] = 0;
|
check();
|
check;
|
|
|
// CLD
|
// CLD
|
alu_opcode = CLD_IMP;
|
alu_opcode = CLD_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_status_expected[D] = 0;
|
alu_status_expected[D] = 0;
|
check();
|
check;
|
|
|
// CLI
|
// CLI
|
alu_opcode = CLI_IMP;
|
alu_opcode = CLI_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_status_expected[I] = 0;
|
alu_status_expected[I] = 0;
|
check();
|
check;
|
|
|
// CLV
|
// CLV
|
alu_opcode = CLV_IMP;
|
alu_opcode = CLV_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_status_expected[V] = 0;
|
alu_status_expected[V] = 0;
|
check();
|
check;
|
|
|
// LDA
|
// LDA
|
alu_opcode = LDA_IMM;
|
alu_opcode = LDA_IMM;
|
alu_a = 8'h76;
|
alu_a = 8'h76;
|
@(negedge clk);
|
@(negedge clk);
|
alu_result_expected = alu_a;
|
alu_result_expected = alu_a;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
check();
|
check;
|
|
|
// TAX
|
// TAX
|
alu_opcode = TAX_IMP;
|
alu_opcode = TAX_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_x_expected = alu_result_expected;
|
alu_x_expected = alu_result_expected;
|
alu_status_expected[Z] = (alu_x_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_x_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_x_expected[7];
|
alu_status_expected[N] = alu_x_expected[7];
|
check();
|
check;
|
|
|
// TAY
|
// TAY
|
alu_opcode = TAY_IMP;
|
alu_opcode = TAY_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_y_expected = alu_result_expected;
|
alu_y_expected = alu_result_expected;
|
alu_status_expected[Z] = (alu_y_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_y_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_y_expected[7];
|
alu_status_expected[N] = alu_y_expected[7];
|
check();
|
check;
|
|
|
// TSX
|
// TSX
|
alu_opcode = TSX_IMP;
|
alu_opcode = TSX_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_x_expected = alu_a;
|
alu_x_expected = alu_a;
|
//alu_result_expected = alu_a;
|
//alu_result_expected = alu_a;
|
alu_status_expected[Z] = (alu_x_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_x_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_x_expected[7];
|
alu_status_expected[N] = alu_x_expected[7];
|
check();
|
check;
|
|
|
// TXA
|
// TXA
|
alu_opcode = TXA_IMP;
|
alu_opcode = TXA_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_result_expected = alu_x_expected;
|
alu_result_expected = alu_x_expected;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
check();
|
check;
|
|
|
// TXS
|
// TXS
|
alu_opcode = TXS_IMP;
|
alu_opcode = TXS_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_result_expected = alu_x_expected;
|
alu_result_expected = alu_x_expected;
|
check();
|
check;
|
|
|
// TYA
|
// TYA
|
alu_opcode = TYA_IMP;
|
alu_opcode = TYA_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
alu_result_expected = alu_y_expected;
|
alu_result_expected = alu_y_expected;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[Z] = (alu_result_expected == 0) ? 1 : 0;
|
alu_status_expected[N] = alu_result_expected[7];
|
alu_status_expected[N] = alu_result_expected[7];
|
check();
|
check;
|
|
|
// Nothing should happen
|
// Nothing should happen
|
// BCC
|
// BCC
|
alu_opcode = BCC_REL;
|
alu_opcode = BCC_REL;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// BCS
|
// BCS
|
alu_opcode = BCS_REL;
|
alu_opcode = BCS_REL;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// BEQ
|
// BEQ
|
alu_opcode = BEQ_REL;
|
alu_opcode = BEQ_REL;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// BMI
|
// BMI
|
alu_opcode = BMI_REL;
|
alu_opcode = BMI_REL;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// BNE
|
// BNE
|
alu_opcode = BNE_REL;
|
alu_opcode = BNE_REL;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// BPL
|
// BPL
|
alu_opcode = BPL_REL;
|
alu_opcode = BPL_REL;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// BVC
|
// BVC
|
alu_opcode = BVC_REL;
|
alu_opcode = BVC_REL;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// BVS
|
// BVS
|
alu_opcode = BVS_REL;
|
alu_opcode = BVS_REL;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// JMP
|
// JMP
|
alu_opcode = JMP_ABS;
|
alu_opcode = JMP_ABS;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// JMP
|
// JMP
|
alu_opcode = JMP_IND;
|
alu_opcode = JMP_IND;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// JSR
|
// JSR
|
alu_opcode = JSR_ABS;
|
alu_opcode = JSR_ABS;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// NOP
|
// NOP
|
alu_opcode = NOP_IMP;
|
alu_opcode = NOP_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
// RTS
|
// RTS
|
alu_opcode = RTS_IMP;
|
alu_opcode = RTS_IMP;
|
@(negedge clk);
|
@(negedge clk);
|
check();
|
check;
|
|
|
$display("TEST PASSED");
|
$display("TEST PASSED");
|
$finish;
|
$finish;
|
end
|
end
|
|
|