implement more versions of RTN

This commit is contained in:
Raphael Jacquot 2019-02-09 12:03:43 +01:00
parent 8fa16e6a1e
commit b0b3373e30
4 changed files with 45 additions and 62 deletions

View file

@ -1,19 +0,0 @@
/******************************************************************************
* 03 RTNCC
*
*
*/
`include "decstates.v"
begin
Carry <= 0;
new_PC <= RSTK[rstk_ptr];
RSTK[rstk_ptr] <= 0;
rstk_ptr <= rstk_ptr - 1;
next_cycle <= `BUSCMD_LOAD_PC;
decstate <= `DEC_START;
`ifdef SIM
$display("%05h RTNCC", inst_start_PC);
`endif
end

View file

@ -1,15 +0,0 @@
/******************************************************************************
* 04 SETHEX
*
*
*/
`include "decstates.v"
begin
hex_dec <= `MODE_HEX;
decstate <= `DEC_START;
`ifdef SIM
$display("%05h SETHEX", inst_start_PC);
`endif
end

View file

@ -1,16 +0,0 @@
/******************************************************************************
* 05 SETDEC
*
*
*/
`include "decstates.v"
begin
hex_dec <= `MODE_DEC;
decstate <= `DEC_START;
`ifdef SIM
$display("%05h SETDEC", inst_start_PC);
`endif
end

View file

@ -5,25 +5,58 @@
*/
`DEC_0X: begin
//generic RTN suff
case (nibble)
// RTNSXM
4'h0: begin
HST[0] <= 1;
4'h0, 4'h1, 4'h2, 4'h3: begin
new_PC <= RSTK[rstk_ptr];
RSTK[rstk_ptr] <= 0;
rstk_ptr <= rstk_ptr - 1;
next_cycle <= `BUSCMD_LOAD_PC;
decstate <= `DEC_START;
`ifdef SIM
$display("%05h RTNSXM", inst_start_PC);
`endif
end
4'h3:
`include "opcodes/03_RTNCC.v"
4'h4:
`include "opcodes/04_SETHEX.v"
4'h5:
`include "opcodes/05_SETDEC.v"
default: begin end
endcase
// things specific to the
case (nibble)
4'h0: begin
HST[0] <= 1;
`ifdef SIM
$display("%05h RTNSXM", inst_start_PC);
`endif
end
4'h1: begin
`ifdef SIM
$display("%05h RTN", inst_start_PC);
`endif
end
4'h2: begin
Carry <= 1;
`ifdef SIM
$display("%05h RTNSC", inst_start_PC);
`endif
end
4'h3: begin
Carry <= 0;
`ifdef SIM
$display("%05h RTNCC", inst_start_PC);
`endif
end
4'h4: begin
hex_dec <= `MODE_HEX;
decstate <= `DEC_START;
`ifdef SIM
$display("%05h SETHEX", inst_start_PC);
`endif
end
4'h5: begin
hex_dec <= `MODE_DEC;
decstate <= `DEC_START;
`ifdef SIM
$display("%05h SETDEC", inst_start_PC);
`endif
end
default: begin
$display("ERROR : DEC_0X");
decode_error <= 1;