Line 323... |
Line 323... |
|
|
// ADC - Add with carry
|
// ADC - Add with carry
|
// TODO: verify synthesis for % operand
|
// TODO: verify synthesis for % operand
|
ADC_IMM, ADC_ZPG, ADC_ZPX, ADC_ABS, ADC_ABX, ADC_ABY, ADC_IDX, ADC_IDY : begin
|
ADC_IMM, ADC_ZPG, ADC_ZPX, ADC_ABS, ADC_ABX, ADC_ABY, ADC_IDX, ADC_IDY : begin
|
if (alu_status[D] == 1) begin
|
if (alu_status[D] == 1) begin
|
|
<<<<<<< .mine
|
|
<<<<<<< .mine
|
|
bcdl = A[3:0] + alu_a[3:0] + alu_status[C];
|
|
bcdh = A[7:4] + alu_a[7:4];
|
|
|
|
$write("1: bcdl %d bcdh %d\n", bcdl, bcdh);
|
|
|
|
if (bcdl > 9) begin
|
|
//$write("\n %d \n", bcdl[6:4]);
|
|
bcdh = bcdh + bcdl[5:4];
|
|
bcdl = bcdl % 10;
|
|
=======
|
|
=======
|
$display("MODO DECIMAL");
|
$display("MODO DECIMAL");
|
|
>>>>>>> .r165
|
AL = A[3:0] + alu_a[3:0] + alu_status[C];
|
AL = A[3:0] + alu_a[3:0] + alu_status[C];
|
AH = A[7:4] + alu_a[7:4];
|
AH = A[7:4] + alu_a[7:4];
|
$display("AL = %h", AL);
|
$display("AL = %h", AL);
|
$display("AH = %h", AH);
|
$display("AH = %h", AH);
|
if (AL > 9) begin
|
if (AL > 9) begin
|
bcdh = AH + (AL / 10);
|
bcdh = AH + (AL / 10);
|
bcdl = AL % 10;
|
bcdl = AL % 10;
|
|
>>>>>>> .r164
|
end
|
end
|
if (AH > 9) begin
|
if (AH > 9) begin
|
STATUS[C] = 1;
|
STATUS[C] = 1;
|
bcdh2 = bcdh % 10;
|
bcdh2 = bcdh % 10;
|
end
|
end
|
|
<<<<<<< .mine
|
|
<<<<<<< .mine
|
|
|
|
//$write("bcdl %d bcdh %d\n", bcdl, bcdh);
|
|
|
|
|
|
result = {bcdh[3:0],bcdl[3:0]};
|
|
=======
|
|
=======
|
$display("bcdh = %h", bcdh);
|
$display("bcdh = %h", bcdh);
|
$display("bcdl = %h", bcdl);
|
$display("bcdl = %h", bcdl);
|
|
>>>>>>> .r165
|
result = {bcdh2[3:0],bcdl[3:0]};
|
result = {bcdh2[3:0],bcdl[3:0]};
|
|
<<<<<<< .mine
|
|
>>>>>>> .r164
|
|
=======
|
$display("result = %h", result);
|
$display("result = %h", result);
|
|
>>>>>>> .r165
|
end
|
end
|
else begin
|
else begin
|
$display("MODO NORMAL");
|
$display("MODO NORMAL");
|
{STATUS[C],result} = op1 + op2 + alu_status[C];
|
{STATUS[C],result} = op1 + op2 + alu_status[C];
|
end
|
end
|