Line 51... |
Line 51... |
// It is able to execute up to 40Mips on Spartan XC3S700AN speed grade -4, performances comparable with a 486 CPU.
|
// It is able to execute up to 40Mips on Spartan XC3S700AN speed grade -4, performances comparable with a 486 CPU.
|
// Small size, the CPU + BIU requires ~25% or 1500 slices - on Spartan XC3S700AN
|
// Small size, the CPU + BIU requires ~25% or 1500 slices - on Spartan XC3S700AN
|
//
|
//
|
// 16May2012 - fixed REP CMPS/SCAS bug when interrupted on the <equal> item
|
// 16May2012 - fixed REP CMPS/SCAS bug when interrupted on the <equal> item
|
// 23Dec2012 - fixed DIV bug (exception on sign bit)
|
// 23Dec2012 - fixed DIV bug (exception on sign bit)
|
|
// 27Feb2013 - fixed MUL/IMUL 8bit flags bug
|
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
|
|
module Next186_CPU(
|
module Next186_CPU(
|
output [19:0] ADDR,
|
output [19:0] ADDR,
|
Line 859... |
Line 860... |
end
|
end
|
end
|
end
|
3'b100, 3'b101: begin // MUL, IMUL
|
3'b100, 3'b101: begin // MUL, IMUL
|
ISIZE = ISIZES;
|
ISIZE = ISIZES;
|
ALUOP = {4'b1000, REG[0]}; // BASEL = FETCH[0][1] = 1
|
ALUOP = {4'b1000, REG[0]}; // BASEL = FETCH[0][1] = 1
|
|
WE[4] = 1'b1; // fix MUL/IMUL 8bit flags bug
|
case(STAGE[1:0])
|
case(STAGE[1:0])
|
2'b00: begin // stage1, RA -> TMP16, RB (mem) -> FETCH
|
2'b00: begin // stage1, RA -> TMP16, RB (mem) -> FETCH
|
MREQ = ~&MOD;
|
MREQ = ~&MOD;
|
DISEL = {1'b0, MREQ};
|
DISEL = {1'b0, MREQ};
|
RASEL = 3'b000; // AX
|
RASEL = 3'b000; // AX
|
DOSEL = 2'b11;
|
DOSEL = 2'b11;
|
IFETCH = 1'b0;
|
IFETCH = 1'b0;
|
end
|
end
|
2'b01: begin // stage2, write AX
|
2'b01: begin // stage2, write AX
|
WE[1:0] = 2'b11;
|
WE[1:0] = 2'b11; // flags, RASEL_HI, RASEL_LO
|
RASEL = 3'b000; // AX
|
RASEL = 3'b000; // AX
|
MREQ = 1'b0;
|
MREQ = 1'b0;
|
IFETCH = ~FETCH[0][0];
|
IFETCH = ~FETCH[0][0];
|
end
|
end
|
2'b10: begin // stage 2, write DX
|
2'b10: begin // stage 2, write DX
|
WE = 5'b10011;
|
WE[1:0] = 2'b11; // flags, RASEL_HI, RASEL_LO
|
RASEL = 3'b010; // DX
|
RASEL = 3'b010; // DX
|
MREQ = 1'b0;
|
MREQ = 1'b0;
|
end
|
end
|
endcase
|
endcase
|
end
|
end
|