OpenCores
URL https://opencores.org/ocsvn/next186/next186/trunk

Subversion Repositories next186

[/] [next186/] [trunk/] [Next186_CPU.v] - Diff between revs 10 and 11

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 10 Rev 11
Line 52... Line 52...
//              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
// 27Feb2013 - fixed MUL/IMUL 8bit flags bug
 
// 03Apr2013 - fix RET n alignment bug
 
// 04Apr2013 - fix TRAP interrupt acknowledge
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
`timescale 1ns / 1ps
`timescale 1ns / 1ps
 
 
module Next186_CPU(
module Next186_CPU(
    output [19:0] ADDR,
    output [19:0] ADDR,
Line 178... Line 180...
        wire QSGN = (WORD ? DX[15] : AX[15]) & IDIV;
        wire QSGN = (WORD ? DX[15] : AX[15]) & IDIV;
// interrupts
// interrupts
        wire SAMPLEINT = ~(WE[2] & RASEL[1:0] == 2'b10) & ~status[2] & ~status[4] & ~status[5]; // not load SS, no prefix
        wire SAMPLEINT = ~(WE[2] & RASEL[1:0] == 2'b10) & ~status[2] & ~status[4] & ~status[5]; // not load SS, no prefix
        wire NMIACK = SNMI & ~FNMI;     // NMI acknowledged
        wire NMIACK = SNMI & ~FNMI;     // NMI acknowledged
        wire INTRACK = FLAGS[9] & (~WE[4] | FIN[9]) & SINTR;                    // INTR acknowledged (IF and not CLI in progress)
        wire INTRACK = FLAGS[9] & (~WE[4] | FIN[9]) & SINTR;                    // INTR acknowledged (IF and not CLI in progress)
        wire IACK = IRQ | (SAMPLEINT & (NMIACK | INTRACK)) | (~WE[2] & ~HALT & FLAGS[8]); // interrupt acknowledged
        wire IACK = IRQ | (SAMPLEINT & (NMIACK | INTRACK | (~HALT & FLAGS[8]))); // interrupt acknowledged (fixed 04Apr2013)
        reg CMPS;       // early EQ test for CMPS
        reg CMPS;       // early EQ test for CMPS
        reg SCAS;   // early EQ test for SCAS
        reg SCAS;   // early EQ test for SCAS
 
 
        Next186_Regs REGS (
        Next186_Regs REGS (
    .RASEL(RASEL),
    .RASEL(RASEL),
Line 339... Line 341...
                        default: ISIZEI = 5;
                        default: ISIZEI = 5;
                endcase
                endcase
        end
        end
 
 
         always @(FETCH[0], FETCH[1], FETCH[2], FETCH[3], FETCH[4], FETCH[5], MOD, REG, RM, CPUStatus, USEBP, NOBP, RASEL, ISIZEI, TLF, EAC, COUT, DIVEND, DIVC, QSGN, CMPS, SCAS,
         always @(FETCH[0], FETCH[1], FETCH[2], FETCH[3], FETCH[4], FETCH[5], MOD, REG, RM, CPUStatus, USEBP, NOBP, RASEL, ISIZEI, TLF, EAC, COUT, DIVEND, DIVC, QSGN, CMPS, SCAS,
                                 WBIT, ISIZES, ISELS, WRBIT, ISIZEW, STAGE, NULLSHIFT, ALUCONT, FLAGS, CXZ, RCXZ, NRORCXLE1, TZF, JMPC, LOOPC, ICODE1, DIVQSGN, DIVSGN, DIVRSGN, SOUT) begin
                                 WBIT, ISIZES, ISELS, WRBIT, ISIZEW, STAGE, NULLSHIFT, ALUCONT, FLAGS, CXZ, RCXZ, NRORCXLE1, TZF, JMPC, LOOPC, ICODE1, DIVQSGN, DIVSGN, DIVRSGN, SOUT, IDIV) begin
                WORD = FETCH[0][0];
                WORD = FETCH[0][0];
                BASEL = FETCH[0][1] | &MOD;
                BASEL = FETCH[0][1] | &MOD;
                RASEL = FETCH[0][1] ? REG : RM; // destination
                RASEL = FETCH[0][1] ? REG : RM; // destination
                BBSEL = {1'b0, !FETCH[0][1] | &MOD};
                BBSEL = {1'b0, !FETCH[0][1] | &MOD};
                RBSEL = FETCH[0][1] ? RM : REG; // source
                RBSEL = FETCH[0][1] ? RM : REG; // source
Line 1285... Line 1287...
                                        end
                                        end
                                endcase
                                endcase
                        end
                        end
// --------------------------------  ret near --------------------------------
// --------------------------------  ret near --------------------------------
                        41: begin
                        41: begin
 
                                WORD = 1'b1;            // fix RET n alignment bug - 03Apr2013
                                ISIZE = FETCH[0][0] ? 1 : 3;
                                ISIZE = FETCH[0][0] ? 1 : 3;
                                IFETCH = STAGE[0];
                                IFETCH = STAGE[0];
                                ALUOP = 31;                     // PASS B
                                ALUOP = 31;                     // PASS B
                                if(!STAGE[0]) begin      // stage1, pop TMP16
                                if(!STAGE[0]) begin      // stage1, pop TMP16
                                        RSSEL = 2'b10;                  // SS
                                        RSSEL = 2'b10;                  // SS
Line 1304... Line 1307...
                                        MREQ = 1'b0;
                                        MREQ = 1'b0;
                                end
                                end
                        end
                        end
// --------------------------------  ret far --------------------------------
// --------------------------------  ret far --------------------------------
                        42: begin
                        42: begin
 
                                WORD = 1'b1;            // fix RET n alignment bug - 03Apr2013
                                ALUOP = 31;                     // PASS B
                                ALUOP = 31;                     // PASS B
                                RSSEL = 2'b10;                  // SS
                                RSSEL = 2'b10;                  // SS
                                IFETCH = STAGE[1];
                                IFETCH = STAGE[1];
                                DISEL = 2'b00;                  // DIN
                                DISEL = 2'b00;                  // DIN
                                case(STAGE[1:0])
                                case(STAGE[1:0])

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.