More PLD toward final version

This commit is contained in:
Zane Kaminski 2024-10-20 19:51:05 -04:00
parent 5721821571
commit a94a40b13a
7 changed files with 172 additions and 52 deletions

30
cpld/CFG_A.v Normal file
View File

@ -0,0 +1,30 @@
module CFG(
input [23:20] A,
inout GA23,
inout GA22,
inout GA21,
inout GA20,
output SlowdownIOWriteGate,
input DBG0_ROMWS,
input DBG1_RAMWS,
input DBG4_IOWS,
output ROMWS,
output RAMWS,
output IOWS);
assign GA23 = 1'bZ;
wire GA23Gate =
(A[23:20]==4'h6) ||
(A[23:20]==4'h7 && A[19:16]!=4'hF) ||
(A[23:20]==4'h5 && !A[19]);
assign GA22 = ) ? 1'b0 : A[23];
assign GA21 = 1'bZ;
assign GA20 = 1'bZ;
assign SlowdownIOWriteGate = 1;
assign ROMWS = DBG0_ROMWS;
assign RAMWS = DBG1_RAMWS;
assign IOWS = DBG4_IOWS;
endmodule

26
cpld/CFG_Prototype.v Normal file
View File

@ -0,0 +1,26 @@
module CFG(
input [23:20] A,
inout GA23,
inout GA22,
inout GA21,
inout GA20,
output SlowdownIOWriteGate,
input DBG0_ROMWS,
input DBG1_RAMWS,
input DBG4_IOWS,
output ROMWS,
output RAMWS,
output IOWS);
assign GA23 = A_FSB[23];
assign GA22 = A_FSB[22];
assign GA21 = 1'bZ;
assign GA20 = 1'bZ;
assign SlowdownIOWriteGate = 0;
assign ROMWS = 0;
assign RAMWS = 0;
assign IOWS = 0;
endmodule

View File

@ -6,7 +6,7 @@ module CS(
/* QoS enable input */
input QoSEN,
/* Device select outputs */
output IOCS, output IORealCS, output IOPWCS, output IACS,
output IOCS, output IORealCS, output IOPWCS,
output ROMCS, output ROMCS4X,
output RAMCS, output RAMCS0X,
output IACKCS, output IACK0CS, output IACK1CS,
@ -22,7 +22,7 @@ module CS(
end
/* I/O select signals */
assign IACKCS = A[23:20]==4'hF;
assign IACKCS = A[23:20]==4'hF && A[19];
assign IACK0CS = IACKCS && A[1];
assign IACK1CS = IACKCS && A[2];
assign VIACS = A[23:20]==4'hE;
@ -32,7 +32,8 @@ module CS(
/* ROM select signals */
assign ROMCS4X = A[23:20]==4'h4;
assign ROMCS = Overlay || ROMCS4X;
wire ROMCSF0X = A[23:16]==8'hF0;
assign ROMCS = Overlay || ROMCS4X || ROMCSF0X;
/* RAM select signals */
assign RAMCS0X = A[23:22]==2'b00;
@ -58,19 +59,18 @@ module CS(
assign SetCSWR = A[23:20]==4'hF && A[19:16]==4'h0 && !nWE;
/* Select signals - IOB domain */
assign IACS = A[23:20]==4'hF; // IACK
assign IORealCS =
A[23:20]==4'hF || // IACK
A[23:20]==4'hE || // VIA
A[23:20]==4'hD || // IWM
A[23:20]==4'hC || // empty / fast ROM
A[23:20]==4'hB || // SCC write
A[23:20]==4'hA || // empty
A[23:20]==4'h9 || // SCC read/reset
A[23:20]==4'h8 || // empty (expansion RAM)
A[23:20]==4'h7 || // empty (expansion RAM)
A[23:20]==4'h6 || // empty (expansion RAM)
A[23:20]==4'h5; // SCSI
(A[23:20]==4'hF && A[19]) || // IACK
A[23:20]==4'hE || // VIA
A[23:20]==4'hD || // IWM
A[23:20]==4'hC || // empty / fast ROM
A[23:20]==4'hB || // SCC write
A[23:20]==4'hA || // empty
A[23:20]==4'h9 || // SCC read/reset
A[23:20]==4'h8 || // empty
A[23:20]==4'h7 || // empty (expansion RAM on final rev. A except last 64 kB)
A[23:20]==4'h6 || // empty (expansion RAM on final rev. A)
A[23:20]==4'h5; // SCSI
assign IOCS = IORealCS || VidRAMCSWR || QoSEN;
assign IOPWCS = IACKCS || (VidRAMCSWR64k && !QoSEN); // Posted write to video RAM only when QoS disabled
endmodule

View File

@ -4,7 +4,7 @@ module FSB(
/* AS cycle detection */
output reg ASrf, output BACT, output reg BACTr,
/* Ready inputs */
input ROMCS,
input ROMCS, input ROMReady,
input RAMCS, input RAMReady,
input IOPWCS, input IOPWReady, input IONPReady,
input QoSEN,
@ -17,9 +17,9 @@ module FSB(
always @(posedge FCLK) BACTr <= BACT;
/* DTACK/VPA control */
wire Ready = (RAMCS && !QoSEN && RAMReady && !IOPWCS) ||
(RAMCS && !QoSEN && RAMReady && IOPWCS && IOPWReady) ||
(ROMCS && !QoSEN) || (IONPReady);
wire Ready = (RAMCS && RAMReady && !QoSEN && !IOPWCS) ||
(RAMCS && RAMReady && !QoSEN && IOPWCS && IOPWReady) ||
(ROMCS && ROMReady && !QoSEN) || (IONPReady);
always @(posedge FCLK, posedge nAS) begin
if (nAS) nDTACK <= 1;
else if (!IACKCS && Ready) nDTACK <= 0;

View File

@ -5,6 +5,10 @@ module IOBS(
input BACT, input BACTr,
/* Select signals */
input IOCS, input IORealCS, input IOPWCS,
/* I/O wait state input */
input IOWS,
/* Slowdown write gate configutation */
input SlowdownIOWriteGate,
/* FSB cycle termination outputs */
output reg IONPReady, output IOPWReady, output reg nBERR_FSB,
/* Read data OE control */
@ -20,11 +24,13 @@ module IOBS(
/* IOACT input synchronization */
reg IOACTr = 0; always @(posedge CLK) IOACTr <= IOACT;
/* IODTACK input synchronization */
/* IODONE input synchronization */
reg IODONErf; always @(negedge CLK) IODONErf <= IODONEin;
reg IODONErr; always @(posedge CLK) IODONErr <= IODONErf;
reg [1:0] IODONEr;
always @(posedge CLK) IODONEr[1:0] <= {IODONEr[0], IODONErf};
wire IODONE = !IODONEr[1] && IODONEr[0];
always @(posedge CLK) IODONEr[1:0] <= !IOWS ?
{ IODONEr[0], IODONErf } : // 0 I/O wait states
{ IODONEr[0], IODONErr }; // 1 I/O wait state
/* Read data OE control */
assign nDinOE = !(!nAS && BACTr && IORealCS && nWE);
@ -51,7 +57,7 @@ module IOBS(
// I/O selected, and FIFO secondary level empty
if (BACT && IOPWCS && !ALE1 && !Sent && TS!=0) begin
// Latch R/W now but latch address and LDS/UDS next cycle
IORW1 <= nWE;// || !IORealCS;
IORW1 <= SlowdownIOWriteGate ? (!IORealCS ? 1 : nWE) : nWE;
Load1 <= 1;
end else Load1 <= 0;
end
@ -87,7 +93,7 @@ module IOBS(
IOL0 <= IOL1;
IOU0 <= IOU1;
end else begin // FSB request
IORW <= nWE;// || !IORealCS;
IORW <= SlowdownIOWriteGate ? (!IORealCS ? 1 : nWE) : nWE;
IOL0 <= !nLDS;
IOU0 <= !nUDS;
end

View File

@ -6,8 +6,10 @@ module RAM(
input BACT, input BACTr,
/* Select and ready signals */
input RAMCS, input RAMCS0X, input ROMCS, input ROMCS4X,
/* RAM ready output */
output RAMReady,
/* RAM/ROM wait state inputs */
input RAMWS, input ROMWS,
/* RAM/ROM ready output */
output reg RAMReady, output reg ROMReady,
/* Refresh Counter Interface */
input RefReqIn, input RefUrgIn,
/* DRAM interface */
@ -33,11 +35,6 @@ module RAM(
wire RefReq = RefReqIn && !RefDone;
wire RefUrg = RefUrgIn && !RefDone;
/* RAM ready control */
//reg RAMReadyReg;
//assign RAMReady = RAMReadyReg;
assign RAMReady = !RS[2];
/* RAM /RAS control */
assign nRAS = !((!nAS && RAMCS && RASEN) || RASrf);
@ -57,6 +54,13 @@ module RAM(
assign nROMOE = !(!nAS && ROMCS && nWE);
assign nROMWE = !(!nAS && ROMCS4X && !nWE);
/* ROM ready control */
wire ROMReadyClear = ROMWS && nAS;
always @(posedge CLK, posedge ROMReadyClear) begin
if (ROMReadyClear) ROMReady <= 0;
else ROMReady <= 1;
end
/* RAM address mux (and ROM address on RA8) */
// RA11 doesn't do anything so both should be identical.
assign RA[11] = !RASEL ? A[19] : A[20]; // ROM address 19
@ -80,68 +84,88 @@ module RAM(
(RefUrg && !BACT) ||
// Urgent refresh during non-RAM access
(RefUrg && BACT && !RAMCS0X);
wire RS0toRAM = BACT && RAMCS && RASEN;
wire RS0toRAM = BACT && RAMCS;
always @(posedge CLK) begin
case (RS[2:0])
0: begin // Idle/ready
if (RS0toRAM) RS <= 1; // Access RAM
else if (RS0toRef) RS <= 4; // To refresh
else RS <= 0; // Stay in idle/ready
RASEL <= BACT && RAMCS;
RefCAS <= RS0toRef;
RASEN <= !RS0toRef;
//RAMReadyReg <= !RS0toRef;
if (RAMReady) begin // Continue accessing RAM
RS <= 1; // Continue accessing RAM
RAMReady <= 1;
RASEL <= 1;
RefCAS <= 0;
RASEN <= 1;
end else if (RS0toRAM) begin // Wait state
RS <= 0;
RAMReady <= 1;
RASEL <= 0;
RefCAS <= 0;
RASEN <= 1;
RefCAS <= 0;
RASEN <= 1;
end else if (RS0toRef) begin // Refresh
RS <= 4;
RAMReady <= 0;
RASEL <= 0;
RefCAS <= 1;
RASEN <= 0;
end else begin // Stay in idle
RS <= 0;
RAMReady <= RAMWS ? 0 : 1;
RASEL <= 0;
RefCAS <= 0;
RASEN <= 1;
end
end 1: begin // RAM access
if (!nDTACK || !BACT) RS <= 2; // Cycle ending
else RS <= 1; // Cycle not ending yet
RAMReady <= 1;
RASEL <= 1;
RefCAS <= 0;
RASEN <= nDTACK;
//RAMReadyReg <= 1;
end 2: begin // finish RAM access
RS <= 3;
RAMReady <= 1;
RASEL <= 0;
RefCAS <= 0;
RASEN <= 0;
//RAMReadyReg <= 1;
end 3: begin //AS cycle complete
if (RefUrg) begin // Refresh RAS
RS <= 4;
RAMReady <= 0;
RefCAS <= 1;
RASEN <= 0;
//RAMReadyReg <= 0;
end else begin // Cycle ended so go back to idle/ready
RS <= 0;
RAMReady <= RAMWS ? 0 : 1;
RefCAS <= 0;
RASEN <= 1;
//RAMReadyReg <= 1;
end
RASEL <= 0;
end 4: begin // Refresh RAS I
RS <= 5;
RAMReady <= 0;
RASEL <= 0;
RefCAS <= 0;
RASEN <= 0;
//RAMReadyReg <= 0;
end 5: begin // Refresh RAS II
RS <= 6;
RASEL <= 0;
RefCAS <= 0;
RASEN <= 0;
//RAMReadyReg <= 0;
RAMReady <= 0;
end 6: begin // Refresh precharge I
RS <= 7;
RAMReady <= 0;
RASEL <= 0;
RefCAS <= 0;
RASEN <= 0;
//RAMReadyReg <= 0;
end 7: begin // Reenable RAM and go to idle/ready
RS <= 0;
RAMReady <= RAMWS ? 0 : 1;
RASEL <= 0;
RefCAS <= 0;
RASEN <= 1;
//RAMReadyReg <= 1;
end
endcase
end

View File

@ -1,6 +1,7 @@
module WarpSE(
input [23:1] A_FSB,
output [23:22] GA,
inout GA23,
inout GA22,
input nAS_FSB,
input nLDS_FSB,
input nUDS_FSB,
@ -39,7 +40,33 @@ module WarpSE(
output nDinOE,
output nDinLE,
output MCKE,
input [5:0] DBG);
input DBG0_ROMWS,
input DBG1_RAMWS,
inout DBG2_GA20,
inout DBG3_GA21,
input DBG4_IOWS,
input DBG5_GTS,
input DBG5_GSR);
wire SlowdownIOWriteGate;
wire ROMWS, RAMWS, IOWS;
CFG cfg(
/* FSB address input */
.A(A_FSB[23:20]),
/* Gated address output */
.GA23(GA23),
.GA22(GA22),
.GA21(DBG3_GA21),
.GA20(DBG2_GA20),
/* Wait state jumper inputs */
.DBG0_ROMWS(DBG0_ROMWS),
.DBG1_RAMWS(DBG1_RAMWS),
.DBG4_IOWS(DBG4_IOWS),
/* Wait state jumper outputs */
.ROMWS(ROMWS),
.RAMWS(RAMWS),
.IOWS(IOWS),
.SlowdownIOWriteGate(SlowdownIOWriteGate));
/* GA gated (translated) address output */
assign GA[23:22] = A_FSB[23:22];
@ -103,7 +130,7 @@ module WarpSE(
/* Settings register select output */
.SetCSWR(SetCSWR));
wire RAMReady;
wire RAMReady, ROMReady,
RAM ram(
/* MC68HC000 interface */
.CLK(FCLK),
@ -121,8 +148,12 @@ module WarpSE(
.RAMCS0X(RAMCS0X),
.ROMCS(ROMCS),
.ROMCS4X(ROMCS4X),
/* RAM ready output */
.RAMReady(RAMReady),
/* RAM/ROM wait state inputs */
.RAMWS(RAMWS),
.ROMWS(ROMWS),
/* RAM/ROM ready outputs */
.RAMReady(DBG1_RAMWS),
.ROMReady(DBG1_ROMWS),
/* Refresh Counter Interface */
.RefReqIn(RefReq),
.RefUrgIn(RefUrg),
@ -156,6 +187,8 @@ module WarpSE(
.IOCS(IOCS),
.IORealCS(IORealCS),
.IOPWCS(IOPWCS),
/* I/O wait state input */
.IOWS(IOWS),
/* FSB cycle termination outputs */
.IONPReady(IONPReady),
.IOPWReady(IOPWReady),
@ -272,6 +305,7 @@ module WarpSE(
.ROMCS(ROMCS4X),
.RAMCS(RAMCS0X),
.RAMReady(RAMReady),
.ROMReady(ROMReady),
.IOPWCS(IOPWCS),
.IOPWReady(IOPWReady),
.IONPReady(IONPReady),