implement RTN

This commit is contained in:
Raphael Jacquot 2019-03-15 21:38:28 +01:00
parent 1771536ca0
commit c48944623d
4 changed files with 20 additions and 5 deletions

View file

@ -237,7 +237,7 @@ always @(posedge i_clk) begin
end
`ifdef SIM
if (cycle_ctr == 293) begin
if (cycle_ctr == 320) begin
bus_halt <= 1'b1;
$display("BUS %0d: [%d] enough cycles for now", phase, cycle_ctr);
end

View file

@ -574,6 +574,7 @@ always @(posedge i_clk) begin
if (inst_rtn) begin
$display("CTRL %0d: [%d] RTN", i_phase, i_cycle_ctr);
case (dec_alu_opcode)
`ALU_OP_NOP: begin end
`ALU_OP_SET_CRY: reg_CARRY <= o_alu_imm_value[0];
default:
begin

View file

@ -307,12 +307,25 @@ always @(posedge i_clk) begin
if (block_0x) begin
case (i_nibble)
4'h2, 4'h3:
4'h0, 4'h1, 4'h2, 4'h3:
begin
$display("DECODER %0d: [%d] RTN%cC", i_phase, i_cycle_ctr, i_nibble[0]?"C":"S");
$write("DECODER %0d: [%d] RTN", i_phase, i_cycle_ctr);
case (i_nibble[1:0])
2'h0: $display("SXM");
2'h1: $display("");
2'h2: $display("SC");
2'h3: $display("CC");
endcase
o_instr_type <= `INSTR_TYPE_RTN;
o_alu_imm_value <= {3'b000, !i_nibble[0]};
o_alu_opcode <= `ALU_OP_SET_CRY;
case (i_nibble[1:0])
2'h0: begin end
2'h1: o_alu_opcode <= `ALU_OP_NOP;
2'h2, 2'h3:
begin
o_alu_opcode <= `ALU_OP_SET_CRY;
o_alu_imm_value <= {3'b000, !i_nibble[0]};
end
endcase
o_instr_decoded <= 1'b1;
o_instr_execute <= 1'b1;
decode_started <= 1'b0;

View file

@ -244,6 +244,7 @@ always @(posedge i_clk) begin
$write("PC_RSTK %0d: [%d] RTN", i_phase, i_cycle_ctr);
case (i_nibble)
4'h0: $display("SXM");
4'h1: $write("\n");
4'h2: $display("SC");
4'h3: $display("CC");
default: begin end