Skip to content

Commit

Permalink
Update Next186_CPU.v
Browse files Browse the repository at this point in the history
Mismo comportamiento que un 8086/80186 con PUSH SP
  • Loading branch information
spark2k06 committed Jan 11, 2022
1 parent f6ab40b commit 4e926a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion HW/Next186/Next186_CPU.v
Expand Up @@ -180,6 +180,7 @@ module Next186_CPU(
wire [2:0]ISIZES = DISP16 ? 4 : AEXT ? 3 : 2;
reg [2:0]ISIZEW;
reg [2:0]ISIZEI; // ise imm
reg PUSH_SP;
wire [1:0]WRBIT = WR ? 2'b00 : WBIT;
wire RCXZ = CPUStatus[4] && ~|CXZ;
wire NRORCXLE1 = ~CPUStatus[4] || ~CXZ[1];
Expand Down Expand Up @@ -243,7 +244,7 @@ module Next186_CPU(

Next186_ALU ALU16 (
.RA(DOSEL == 2'b01 ? IPADD : RA),
.RB(RB),
.RB(PUSH_SP ? RB - 2 : RB), // Same behavior as an 8086/80186 with PUSH SP
.TMP16(TMP16),
.FETCH23({FETCH[3], FETCH[2]}),
.FIN(FLAGS),
Expand Down Expand Up @@ -398,6 +399,7 @@ module Next186_CPU(
DIVOP = 1'b0;

FFLUSH_REQ = 0;
PUSH_SP = 1'b0;

case(ICODE1) // one hot synthesis
// -------------------------------- mov R/M to/from R/SR --------------------------------
Expand Down Expand Up @@ -598,6 +600,7 @@ module Next186_CPU(
ALUOP = 31; // PASS B
WR = 1'b1;
ISIZE = 1;
PUSH_SP = (FETCH[0][6] && (FETCH[0][2:0] == 3'b100)) ? 1 : 0;
end
// -------------------------------- push Imm --------------------------------
9: begin
Expand Down

0 comments on commit 4e926a6

Please sign in to comment.