mirror of
https://github.com/sxpert/hp-saturn
synced 2025-02-12 08:48:27 +01:00
implement loading into D1 too
This commit is contained in:
parent
8ae31087eb
commit
de5bfe83cc
6 changed files with 46 additions and 104 deletions
|
@ -13,6 +13,8 @@
|
||||||
`define DEC_MEMACCESS 13 // 1[45]x[y]
|
`define DEC_MEMACCESS 13 // 1[45]x[y]
|
||||||
`define DEC_D0_EQ_5N 14 // 1B
|
`define DEC_D0_EQ_5N 14 // 1B
|
||||||
`define DEC_D0_EQ_5N_LOOP 15 // 1Bxxxxx (exec)
|
`define DEC_D0_EQ_5N_LOOP 15 // 1Bxxxxx (exec)
|
||||||
|
`define DEC_D1_EQ_5N 16 // 1F
|
||||||
|
`define DEC_D1_EQ_5N_LOOP 17 // 1Fxxxxx (exec)
|
||||||
`define DEC_P_EQ_N 20 // 2n
|
`define DEC_P_EQ_N 20 // 2n
|
||||||
`define DEC_LC_LEN 21 // 3n...
|
`define DEC_LC_LEN 21 // 3n...
|
||||||
`define DEC_LC 22 // 3n[x]
|
`define DEC_LC 22 // 3n[x]
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
/******************************************************************************
|
|
||||||
*1bnnnnn DO=(5) nnnnn
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
`include "decstates.v"
|
|
||||||
|
|
||||||
`DEC_D0_EQ_5N: begin
|
|
||||||
t_cnt <= 4;
|
|
||||||
t_ctr <= 1;
|
|
||||||
D0[3:0] <= nibble;
|
|
||||||
decstate <= `DEC_D0_EQ_5N_LOOP;
|
|
||||||
end
|
|
||||||
`DEC_D0_EQ_5N_LOOP: begin
|
|
||||||
D0[t_ctr*4+:4] <= nibble;
|
|
||||||
if (t_ctr == t_cnt) begin
|
|
||||||
decstate <= `DEC_START;
|
|
||||||
`ifdef SIM
|
|
||||||
$write("%5h D0=(5)\t%1h", inst_start_PC, nibble);
|
|
||||||
for(t_ctr = 0; t_ctr != t_cnt; t_ctr ++)
|
|
||||||
$write("%1h", D0[(t_cnt - t_ctr - 4'h1)*4+:4]);
|
|
||||||
$write("\n");
|
|
||||||
`endif
|
|
||||||
end else
|
|
||||||
t_ctr <= t_ctr + 1;
|
|
||||||
end
|
|
|
@ -1,75 +0,0 @@
|
||||||
|
|
||||||
DECODE_MEMACCESS:
|
|
||||||
begin
|
|
||||||
if (runstate == `RUN_EXEC)
|
|
||||||
begin
|
|
||||||
t_ctr <= 0;
|
|
||||||
case (t_field)
|
|
||||||
T_FIELD_B:
|
|
||||||
begin
|
|
||||||
t_offset <= 0;
|
|
||||||
t_cnt <= 1;
|
|
||||||
end
|
|
||||||
endcase
|
|
||||||
case (t_dir)
|
|
||||||
T_DIR_OUT: runstate <= `WRITE_START;
|
|
||||||
T_DIR_IN: runstate <= `READ_START;
|
|
||||||
endcase
|
|
||||||
`ifdef SIM
|
|
||||||
$write("%5h ", saved_PC);
|
|
||||||
case (t_dir)
|
|
||||||
T_DIR_OUT: $write("%s=%s\t", t_ptr?"DAT1":"DAT0", t_reg?"C":"A");
|
|
||||||
T_DIR_IN: $write("%s=%s\t", t_reg?"C":"A", t_ptr?"DAT1":"DAT0");
|
|
||||||
endcase
|
|
||||||
case (t_field)
|
|
||||||
T_FIELD_P: $display("P");
|
|
||||||
T_FIELD_WP: $display("WP");
|
|
||||||
T_FIELD_XS: $display("XS");
|
|
||||||
T_FIELD_X: $display("X");
|
|
||||||
T_FIELD_S: $display("S");
|
|
||||||
T_FIELD_M: $display("M");
|
|
||||||
T_FIELD_B: $display("B");
|
|
||||||
T_FIELD_W: $display("W");
|
|
||||||
T_FIELD_LEN: $display("%d", t_cnt);
|
|
||||||
T_FIELD_A: $display("A");
|
|
||||||
endcase
|
|
||||||
`endif
|
|
||||||
end
|
|
||||||
|
|
||||||
// should be in the runstate case
|
|
||||||
|
|
||||||
if (runstate == `WRITE_START)
|
|
||||||
begin
|
|
||||||
`ifdef SIM
|
|
||||||
$display("`WRITE_START | ptr %s | dir %s | reg %s | field %h | off %h | ctr %h | cnt %h",
|
|
||||||
t_ptr?"D1":"D0", t_dir?"IN":"OUT", t_reg?"C":"A", t_field, t_field, t_offset, t_ctr, t_cnt);
|
|
||||||
`endif
|
|
||||||
bus_command <= `BUSCMD_LOAD_DP;
|
|
||||||
bus_address <= (~t_ptr)?D0:D1;
|
|
||||||
runstate <= `WRITE_STROBE;
|
|
||||||
end
|
|
||||||
if (runstate == `WRITE_STROBE)
|
|
||||||
begin
|
|
||||||
`ifdef SIM
|
|
||||||
$display("`WRITE_STROBE | ptr %s | dir %s | reg %s | field %h | off %h | ctr %h | cnt %h",
|
|
||||||
t_ptr?"D1":"D0", t_dir?"IN":"OUT", t_reg?"C":"A", t_field, t_offset, t_ctr, t_cnt);
|
|
||||||
`endif
|
|
||||||
bus_command <= `BUSCMD_DP_WRITE;
|
|
||||||
bus_nibble_in <= (~t_reg)?A[t_offset*4+:4]:C[t_offset*4+:4];
|
|
||||||
t_offset <= t_offset + 1;
|
|
||||||
t_ctr <= t_ctr + 1;
|
|
||||||
if (t_ctr == t_cnt)
|
|
||||||
begin
|
|
||||||
runstate <= `WRITE_DONE;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if (runstate == `WRITE_DONE)
|
|
||||||
begin
|
|
||||||
`ifdef SIM
|
|
||||||
$display("`WRITE_DONE | ptr %s | dir %s | reg %s | field %h | off %h | ctr %h | cnt %h",
|
|
||||||
t_ptr?"D1":"D0", t_dir?"IN":"OUT", t_reg?"C":"A", t_field, t_offset, t_ctr, t_cnt);
|
|
||||||
`endif
|
|
||||||
bus_command <= `BUSCMD_NOP;
|
|
||||||
runstate <= `NEXT_INSTR;
|
|
||||||
end
|
|
||||||
end
|
|
41
opcodes/1[BF]nnnnn_D[01]_EQ_5n.v
Normal file
41
opcodes/1[BF]nnnnn_D[01]_EQ_5n.v
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/******************************************************************************
|
||||||
|
*1bnnnnn DO=(5) nnnnn
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
`include "decstates.v"
|
||||||
|
|
||||||
|
`DEC_D0_EQ_5N, `DEC_D1_EQ_5N: begin
|
||||||
|
t_cnt <= 4;
|
||||||
|
t_ctr <= 1;
|
||||||
|
if (decstate == `DEC_D0_EQ_5N) begin
|
||||||
|
D0[3:0] <= nibble;
|
||||||
|
decstate <= `DEC_D0_EQ_5N_LOOP;
|
||||||
|
end else begin
|
||||||
|
D1[3:0] <= nibble;
|
||||||
|
decstate <= `DEC_D1_EQ_5N_LOOP;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
`DEC_D0_EQ_5N_LOOP, `DEC_D1_EQ_5N_LOOP: begin
|
||||||
|
|
||||||
|
if (decstate == `DEC_D0_EQ_5N_LOOP)
|
||||||
|
D0[t_ctr*4+:4] <= nibble;
|
||||||
|
else
|
||||||
|
D1[t_ctr*4+:4] <= nibble;
|
||||||
|
|
||||||
|
if (t_ctr == t_cnt) begin
|
||||||
|
decstate <= `DEC_START;
|
||||||
|
`ifdef SIM
|
||||||
|
$write("%5h D%b=(5)\t%1h", inst_start_PC, (decstate == `DEC_D0_EQ_5N_LOOP), nibble);
|
||||||
|
for(t_ctr = 0; t_ctr != t_cnt; t_ctr ++)
|
||||||
|
$write("%1h",
|
||||||
|
(decstate == `DEC_D0_EQ_5N_LOOP)?
|
||||||
|
D0[(t_cnt - t_ctr - 4'h1)*4+:4]:
|
||||||
|
D1[(t_cnt - t_ctr - 4'h1)*4+:4]
|
||||||
|
);
|
||||||
|
$write("\n");
|
||||||
|
`endif
|
||||||
|
end else
|
||||||
|
t_ctr <= t_ctr + 1;
|
||||||
|
end
|
|
@ -9,7 +9,8 @@
|
||||||
`DEC_1X: begin
|
`DEC_1X: begin
|
||||||
case (nibble)
|
case (nibble)
|
||||||
4'h4: decstate <= `DEC_14X;
|
4'h4: decstate <= `DEC_14X;
|
||||||
4'hb: decstate <= `DEC_D0_EQ_5N;
|
4'hB: decstate <= `DEC_D0_EQ_5N;
|
||||||
|
4'hF: decstate <= `DEC_D1_EQ_5N;
|
||||||
default: begin
|
default: begin
|
||||||
$display("ERROR : DEC_1X");
|
$display("ERROR : DEC_1X");
|
||||||
decode_error <= 1;
|
decode_error <= 1;
|
||||||
|
|
|
@ -379,7 +379,7 @@ always @(posedge dec_strobe) begin
|
||||||
`include "opcodes/0x.v"
|
`include "opcodes/0x.v"
|
||||||
`include "opcodes/1x.v"
|
`include "opcodes/1x.v"
|
||||||
`include "opcodes/1[45]_memaccess.v"
|
`include "opcodes/1[45]_memaccess.v"
|
||||||
`include "opcodes/1Bnnnnn_D0_EQ_5n.v"
|
`include "opcodes/1[BF]nnnnn_D[01]_EQ_5n.v"
|
||||||
`include "opcodes/2n_P_EQ_n.v"
|
`include "opcodes/2n_P_EQ_n.v"
|
||||||
`include "opcodes/3n[x...]_LC.v"
|
`include "opcodes/3n[x...]_LC.v"
|
||||||
`include "opcodes/6xxx_GOTO.v"
|
`include "opcodes/6xxx_GOTO.v"
|
||||||
|
|
Loading…
Add table
Reference in a new issue