implement GOSUB (7xxx)

This commit is contained in:
Raphael Jacquot 2019-03-15 10:21:02 +01:00
parent e9e7a6a5f0
commit 7b64f3e297
2 changed files with 5 additions and 4 deletions

View file

@ -266,10 +266,10 @@ always @(posedge i_clk) begin
4'h1: block_1x <= 1'b1;
4'h2: block_2x <= 1'b1;
4'h3: block_3x <= 1'b1;
4'h6:
4'h6, 4'h7:
begin
o_instr_type <= `INSTR_TYPE_JUMP;
// o_push_pc <= i_nibble[1];
o_push_pc <= i_nibble[0];
o_jump_length <= 3'd2;
jump_counter <= 3'd0;
o_instr_execute <= 1'b1;

View file

@ -198,10 +198,11 @@ always @(posedge i_clk) begin
*/
if (i_phases[3] && do_jump_instr && !jump_decode) begin
`ifdef SIM
$display("PC_RSTK %0d: [%d] start decode jump %0d | jump_base %5h", i_phase, i_cycle_ctr, i_jump_length, reg_PC);
$display("PC_RSTK %0d: [%d] start decode jump %0d | jump_base %5h", i_phase, i_cycle_ctr,
i_jump_length, i_push_pc? reg_PC + {{17{1'b0}},(i_jump_length + 3'd1)} : reg_PC);
`endif
jump_counter <= 3'd0;
jump_base <= reg_PC;
jump_base <= i_push_pc? reg_PC + {{17{1'b0}},(i_jump_length + 3'd1)} : reg_PC;
jump_decode <= 1'b1;
rstk_ptr_to_push_at <= (reg_rstk_ptr + 3'o1) & 3'o7;
end