From d6b59740dd80b9ed1d5cd518b8454f3208965a59 Mon Sep 17 00:00:00 2001 From: Raphael Jacquot Date: Sun, 10 Feb 2019 23:00:20 +0100 Subject: [PATCH] add Dn=(2) --- decstates.v | 4 +++- ...nnnnn_D[01]_EQ_5n.v => 1[9ABDEF]nnnnn_D[01]_EQ_[245]n.v} | 6 ++++-- opcodes/1x.v | 2 ++ saturn_core.v | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) rename opcodes/{1[ABEF]nnnnn_D[01]_EQ_5n.v => 1[9ABDEF]nnnnn_D[01]_EQ_[245]n.v} (86%) diff --git a/decstates.v b/decstates.v index b9a4da0..f90823b 100644 --- a/decstates.v +++ b/decstates.v @@ -12,9 +12,11 @@ `define DEC_MEMAXX 12'h152 // 1[45]x[y] `define DEC_MEMAXX_END 12'h153 `define DEC_PTR_MATH 12'h160 // 1[678C]n D[01]=D[01][+-] (n+1) -`define DEC_D0_EQ_4N 12'h1A0 // 1B +`define DEC_D0_EQ_2N 12'h190 // 19 +`define DEC_D0_EQ_4N 12'h1A0 // 1A `define DEC_D0_EQ_5N 12'h1B0 // 1B `define DEC_D0_EQ_LOOP 12'h1B1 // 1Bxxxxx (exec) +`define DEC_D1_EQ_2N 12'h1D0 // 1D `define DEC_D1_EQ_4N 12'h1E0 // 1E `define DEC_D1_EQ_5N 12'h1F0 // 1F `define DEC_D1_EQ_LOOP 12'h1F1 // 1[EF]xxxxx (exec) diff --git a/opcodes/1[ABEF]nnnnn_D[01]_EQ_5n.v b/opcodes/1[9ABDEF]nnnnn_D[01]_EQ_[245]n.v similarity index 86% rename from opcodes/1[ABEF]nnnnn_D[01]_EQ_5n.v rename to opcodes/1[9ABDEF]nnnnn_D[01]_EQ_[245]n.v index caf3349..ec8ffe9 100644 --- a/opcodes/1[ABEF]nnnnn_D[01]_EQ_5n.v +++ b/opcodes/1[9ABDEF]nnnnn_D[01]_EQ_[245]n.v @@ -6,19 +6,21 @@ `include "decstates.v" +`DEC_D0_EQ_2N, `DEC_D1_EQ_2N, `DEC_D0_EQ_4N, `DEC_D1_EQ_4N, `DEC_D0_EQ_5N, `DEC_D1_EQ_5N: begin case (decstate) + `DEC_D0_EQ_2N, `DEC_D1_EQ_2N: t_cnt <= 1; `DEC_D0_EQ_4N, `DEC_D1_EQ_4N: t_cnt <= 3; `DEC_D0_EQ_5N, `DEC_D1_EQ_5N: t_cnt <= 4; endcase t_ctr <= 1; case (decstate) - `DEC_D0_EQ_4N, `DEC_D0_EQ_5N: begin + `DEC_D0_EQ_2N, `DEC_D0_EQ_4N, `DEC_D0_EQ_5N: begin D0[3:0] <= nb_in; decstate <= `DEC_D0_EQ_LOOP; end - `DEC_D1_EQ_4N, `DEC_D1_EQ_5N: begin + `DEC_D1_EQ_2N, `DEC_D1_EQ_4N, `DEC_D1_EQ_5N: begin D1[3:0] <= nb_in; decstate <= `DEC_D1_EQ_LOOP; end diff --git a/opcodes/1x.v b/opcodes/1x.v index badc800..390725e 100644 --- a/opcodes/1x.v +++ b/opcodes/1x.v @@ -16,8 +16,10 @@ t_add_sub <= nb_in[3]; decstate <= `DEC_PTR_MATH; end + 4'h9: decstate <= `DEC_D0_EQ_2N; 4'hA: decstate <= `DEC_D0_EQ_4N; 4'hB: decstate <= `DEC_D0_EQ_5N; + 4'hD: decstate <= `DEC_D1_EQ_2N; 4'hE: decstate <= `DEC_D1_EQ_4N; 4'hF: decstate <= `DEC_D1_EQ_5N; default: begin diff --git a/saturn_core.v b/saturn_core.v index 0176cd4..f883e73 100644 --- a/saturn_core.v +++ b/saturn_core.v @@ -360,7 +360,7 @@ always @(posedge ph2) begin end always @(posedge ph3) begin - if (cycle_ctr == 260) + if (cycle_ctr == 750) debug_stop <= 1; end @@ -433,7 +433,7 @@ always @(posedge dec_strobe) begin `include "opcodes/13x_ptr_and_AC.v" `include "opcodes/1[45]_memaccess.v" `include "opcodes/1[678C]n_D[01]_math_n.v" -`include "opcodes/1[ABEF]nnnnn_D[01]_EQ_5n.v" +`include "opcodes/1[9ABDEF]nnnnn_D[01]_EQ_[245]n.v" `include "opcodes/2n_P_EQ_n.v" `include "opcodes/3n[x...]_LC.v" `include "opcodes/6xxx_GOTO.v"