Warp-SE/cpld/WarpSE.v

292 lines
6.0 KiB
Coq
Raw Normal View History

2022-03-29 08:23:54 +00:00
module WarpSE(
2021-10-29 10:04:59 +00:00
input [23:1] A_FSB,
2024-09-06 10:05:06 +00:00
output [23:22] GA,
2021-10-29 10:04:59 +00:00
input nAS_FSB,
input nLDS_FSB,
input nUDS_FSB,
input nWE_FSB,
output nDTACK_FSB,
output nVPA_FSB,
output nBERR_FSB,
2023-03-22 01:11:58 +00:00
input FCLK,
input C16M,
input C8M,
input E,
2021-10-29 10:04:59 +00:00
input nDTACK_IOB,
input nVPA_IOB,
output nVMA_IOB,
output nAS_IOB,
2024-10-08 11:18:59 +00:00
output RnW_IOB,
2021-10-29 10:04:59 +00:00
output nUDS_IOB,
output nLDS_IOB,
2022-03-28 03:45:53 +00:00
output nBR_IOB,
input nBG_IOB,
2021-10-29 10:04:59 +00:00
input nBERR_IOB,
2022-09-04 01:32:05 +00:00
inout nRES,
2022-03-28 03:45:53 +00:00
input nIPL2,
2024-03-29 08:02:32 +00:00
output nROMOE,
2021-10-29 10:04:59 +00:00
output nRAMLWE,
output nRAMUWE,
output nROMWE,
output nRAS,
output nCAS,
output [11:0] RA,
output nOE,
output nADoutLE0,
output nADoutLE1,
output nAoutOE,
output nDoutOE,
output nDinOE,
2022-03-28 03:45:53 +00:00
output nDinLE,
2024-09-06 10:05:06 +00:00
output MCKE,
2024-09-22 01:52:03 +00:00
input [5:0] DBG);
2023-03-26 08:33:59 +00:00
2024-09-06 10:05:06 +00:00
/* GA gated (translated) address output */
2024-10-03 11:59:29 +00:00
assign GA[23:22] = A_FSB[23:22];
/*assign GA[23:22] = (
2024-09-06 10:05:06 +00:00
// $800000-$8FFFFF to $000000-$0FFFFF (1 MB)
(A_FSB[23:20]==4'h8) ||
// $700000-$7EFFFF to $300000-$3EFFFF (960 kB)
(A_FSB[23:20]==4'h7 && A_FSB[19:16]!=4'hF) ||
// $600000-$6FFFFF to $200000-$2FFFFF (1 MB)
2024-10-03 11:59:29 +00:00
(A_FSB[23:20]==4'h6)) ? 2'b00 : A_FSB[23:22];*/
2022-03-28 03:45:53 +00:00
2022-09-04 01:32:05 +00:00
/* Reset input and open-drain output */
wire nRESin = nRES;
wire nRESout;
assign nRES = !nRESout ? 1'b0 : 1'bZ;
2024-10-11 21:28:08 +00:00
/* Power-on reset */
wire nPOR;
2021-10-29 10:04:59 +00:00
/* AS cycle detection */
2024-10-09 11:59:55 +00:00
wire ASrf, BACT, BACTr;
2021-10-29 10:04:59 +00:00
/* Refresh request/ack signals */
wire RefReq, RefUrg;
2021-10-29 10:04:59 +00:00
2023-03-22 01:11:58 +00:00
/* FSB chip select signals */
2024-10-11 20:41:31 +00:00
wire IOCS, IORealCS, IOPWCS;
2024-09-06 10:05:06 +00:00
wire ROMCS, ROMCS4X;
2024-10-03 11:59:29 +00:00
wire RAMCS, RAMCS0X;
2024-10-11 20:41:31 +00:00
wire QoSEN;
wire IACKCS, VIACS, IWMCS, SCCCS, SCSICS, SndCSWR;
wire SetCSWR;
2021-10-29 10:04:59 +00:00
CS cs(
/* MC68HC000 interface */
2024-10-03 11:59:29 +00:00
.A(A_FSB[23:08]),
.CLK(FCLK),
.nRES(nRESin),
.nWE(nWE_FSB),
/* /AS cycle detection */
2024-10-03 11:59:29 +00:00
.BACT(BACT),
/* QoS enable input */
2024-10-03 11:59:29 +00:00
.QoSEN(QoSEN),
2021-10-29 10:04:59 +00:00
/* Device select outputs */
2024-10-03 11:59:29 +00:00
.IOCS(IOCS),
.IORealCS(IORealCS),
.IOPWCS(IOPWCS),
.ROMCS(ROMCS),
.ROMCS4X(ROMCS4X),
.RAMCS(RAMCS),
.RAMCS0X(RAMCS0X),
2024-10-11 20:41:31 +00:00
/* Motherboard I/O device select outputs */
.IACKCS(IACKCS),
.VIACS(VIACS),
.IWMCS(IWMCS),
.SCCCS(SCCCS),
.SCSICS(SCSICS),
.SndCSWR(SndCSWR),
/* Settings register select output */
.SetCSWR(SetCSWR));
2021-10-29 10:04:59 +00:00
wire RAMReady;
2021-10-29 10:04:59 +00:00
RAM ram(
/* MC68HC000 interface */
2024-10-03 11:59:29 +00:00
.CLK(FCLK),
.A(A_FSB[21:1]),
.nWE(nWE_FSB),
.nAS(nAS_FSB),
.nLDS(nLDS_FSB),
.nUDS(nUDS_FSB),
.nDTACK(nDTACK_FSB),
2024-09-22 01:52:46 +00:00
/* AS cycle detection inputs */
2024-10-03 11:59:29 +00:00
.BACT(BACT),
.BACTr(BACTr),
2024-09-22 01:52:46 +00:00
/* RAM and ROM select inputs */
2024-10-03 11:59:29 +00:00
.RAMCS(RAMCS),
.RAMCS0X(RAMCS0X),
.ROMCS(ROMCS),
.ROMCS4X(ROMCS4X),
2024-09-22 01:52:46 +00:00
/* RAM ready output */
2024-10-03 11:59:29 +00:00
.RAMReady(RAMReady),
2021-10-29 10:04:59 +00:00
/* Refresh Counter Interface */
2024-10-03 11:59:29 +00:00
.RefReqIn(RefReq),
.RefUrgIn(RefUrg),
2021-10-29 10:04:59 +00:00
/* DRAM and NOR flash interface */
2024-10-03 11:59:29 +00:00
.RA(RA[11:0]),
.nRAS(nRAS),
.nCAS(nCAS),
.nLWE(nRAMLWE),
.nUWE(nRAMUWE),
.nOE(nOE),
.nROMOE(nROMOE),
.nROMWE(nROMWE));
2021-10-29 10:04:59 +00:00
wire IONPReady, IOPWReady;
2024-10-03 15:48:59 +00:00
wire IOREQ, IORW;
wire IOL0, IOU0;
2021-10-29 10:04:59 +00:00
wire ALE0S, ALE0M, ALE1;
assign nADoutLE0 = ~(ALE0S || ALE0M);
assign nADoutLE1 = ~ALE1;
2024-10-07 05:37:58 +00:00
wire IOACT, IODONE;
2021-10-29 10:04:59 +00:00
IOBS iobs(
/* MC68HC000 interface */
2024-10-03 11:59:29 +00:00
.CLK(FCLK),
.nWE(nWE_FSB),
.nAS(nAS_FSB),
.nLDS(nLDS_FSB),
.nUDS(nUDS_FSB),
/* AS cycle detection */
2024-10-03 15:31:14 +00:00
.BACT(BACT), .BACTr(BACTr),
2023-03-30 15:50:05 +00:00
/* Select signals */
2024-10-03 11:59:29 +00:00
.IOCS(IOCS),
.IORealCS(IORealCS),
.IOPWCS(IOPWCS),
2023-03-30 15:50:05 +00:00
/* FSB cycle termination outputs */
2024-10-03 11:59:29 +00:00
.IONPReady(IONPReady),
.IOPWReady(IOPWReady),
.nBERR_FSB(nBERR_FSB),
2021-10-29 10:04:59 +00:00
/* Read data OE control */
2024-10-03 11:59:29 +00:00
.nDinOE(nDinOE),
2021-10-29 10:04:59 +00:00
/* IOB Master Controller Interface */
2024-10-03 15:48:59 +00:00
.IOREQ(IOREQ),
.IORW(IORW),
2024-10-03 11:59:29 +00:00
.IOACT(IOACT),
.IODONEin(IODONE),
2024-10-07 05:37:58 +00:00
.nBERR_IOB(!nBERR_IOB),
2021-10-29 10:04:59 +00:00
/* FIFO primary level control */
2024-10-03 11:59:29 +00:00
.ALE0(ALE0S),
.IOL0(IOL0),
.IOU0(IOU0),
2021-10-29 10:04:59 +00:00
/* FIFO secondary level control */
2024-10-03 11:59:29 +00:00
.ALE1(ALE1));
2023-03-20 05:13:11 +00:00
wire AoutOE;
2023-03-25 07:49:44 +00:00
assign nAoutOE = !AoutOE;
2024-10-03 15:48:59 +00:00
wire nAS_IOBout, RnW_IOBout, nLDS_IOBout, nUDS_IOBout, nVMA_IOBout;
2023-03-25 07:49:44 +00:00
assign nAS_IOB = AoutOE ? nAS_IOBout : 1'bZ;
assign RnW_IOB = AoutOE ? RnW_IOBout : 1'bZ;
2023-03-25 07:49:44 +00:00
assign nLDS_IOB = AoutOE ? nLDS_IOBout : 1'bZ;
assign nUDS_IOB = AoutOE ? nUDS_IOBout : 1'bZ;
assign nVMA_IOB = AoutOE ? nVMA_IOBout : 1'bZ;
2021-10-29 10:04:59 +00:00
IOBM iobm(
/* PDS interface */
2024-10-03 11:59:29 +00:00
.C16M(C16M),
.C8M(C8M),
.E(E),
2024-10-03 15:48:59 +00:00
.nAS(nAS_IOBout),
.RnW(RnW_IOBout),
2024-10-03 11:59:29 +00:00
.nLDS(nLDS_IOBout),
.nUDS(nUDS_IOBout),
.nVMA(nVMA_IOBout),
.nDTACK(nDTACK_IOB),
.nVPA(nVPA_IOB),
.nBERR(nBERR_IOB),
.nRES(nRESin),
2021-10-29 10:04:59 +00:00
/* PDS address and data latch control */
2024-10-03 11:59:29 +00:00
.AoutOE(AoutOE),
.nDoutOE(nDoutOE),
.ALE0(ALE0M),
.nDinLE(nDinLE),
2021-10-29 10:04:59 +00:00
/* IO bus slave port interface */
2024-10-03 15:48:59 +00:00
.IOREQ(IOREQ),
.IORW(IORW),
2024-10-03 11:59:29 +00:00
.IOLDS(IOL0),
.IOUDS(IOU0),
.IOACT(IOACT),
2024-10-07 05:37:58 +00:00
.IODONE(IODONE));
2021-10-29 10:04:59 +00:00
2024-10-11 20:41:31 +00:00
wire SlowIACK, SlowVIA, SlowIWM, SlowSCC, SlowSCSI, SlowSnd, SlowClockGate;
wire [3:0] SlowTimeout;
SET set(
.CLK(FCLK),
2024-10-11 21:28:08 +00:00
.nPOR(nPOR),
2024-10-11 20:41:31 +00:00
.BACT(BACT),
.A(A_FSB[11:1]),
.SetCSWR(SetCSWR),
.SlowIACK(SlowIACK),
.SlowVIA(SlowVIA),
.SlowIWM(SlowIWM),
.SlowSCC(SlowSCC),
.SlowSCSI(SlowSCSI),
.SlowSnd(SlowSnd),
.SlowClockGate(SlowClockGate),
.SlowTimeout(SlowTimeout));
2024-10-09 08:17:31 +00:00
wire nBR_IOBout;
assign nBR_IOB = nBR_IOBout ? 1'bZ : 1'b0;
2021-10-29 10:04:59 +00:00
CNT cnt(
2024-10-03 11:59:29 +00:00
/* FSB clock, 7.8336 MHz clock, and E clock inputs */
.CLK(FCLK),
.C8M(C8M),
.E(E),
2024-10-11 21:28:08 +00:00
/* Power-on reset */
.nPOR(nPOR),
2021-10-29 10:04:59 +00:00
/* Refresh request */
2024-10-03 11:59:29 +00:00
.RefReq(RefReq),
.RefUrg(RefUrg),
2023-03-26 08:33:59 +00:00
/* Reset, button */
2024-10-03 11:59:29 +00:00
.nRESout(nRESout),
.nRESin(nRESin),
.nIPL2(nIPL2),
2023-03-20 04:53:10 +00:00
/* Mac PDS bus master control outputs */
2024-10-03 11:59:29 +00:00
.AoutOE(AoutOE),
2024-10-09 08:17:31 +00:00
.nBR_IOB(nBR_IOBout),
2024-10-03 11:59:29 +00:00
/* QoS select inputs */
2024-10-09 12:00:35 +00:00
.nAS(nAS_FSB),
.ASrf(ASrf),
2024-10-03 11:59:29 +00:00
.BACT(BACT),
2024-10-11 20:41:31 +00:00
.IACKCS(IACKCS),
.VIACS(VIACS),
.IWMCS(IWMCS),
.SCCCS(SCCCS),
.SCSICS(SCSICS),
.SndCSWR(SndCSWR),
/* QoS settings inputs */
.SlowIACK(SlowIACK),
.SlowVIA(SlowVIA),
.SlowIWM(SlowIWM),
.SlowSCC(SlowSCC),
.SlowSCSI(SlowSCSI),
.SlowSnd(SlowSnd),
.SlowClockGate(SlowClockGate),
.SlowTimeout(SlowTimeout),
2024-10-03 11:59:29 +00:00
/* QoS outputs */
.QoSEN(QoSEN),
2024-10-09 12:00:35 +00:00
.MCKE(MCKE));
2021-10-29 10:04:59 +00:00
FSB fsb(
/* MC68HC000 interface */
2024-10-03 11:59:29 +00:00
.FCLK(FCLK),
.nAS(nAS_FSB),
.nDTACK(nDTACK_FSB),
.nVPA(nVPA_FSB),
2023-03-22 01:11:58 +00:00
/* FSB cycle detection */
2024-10-09 11:59:55 +00:00
.ASrf(ASrf),
2024-10-03 11:59:29 +00:00
.BACT(BACT),
.BACTr(BACTr),
2023-03-22 01:11:58 +00:00
/* Ready inputs */
2024-10-03 11:59:29 +00:00
.ROMCS(ROMCS4X),
.RAMCS(RAMCS0X),
.RAMReady(RAMReady),
.IOPWCS(IOPWCS),
.IOPWReady(IOPWReady),
.IONPReady(IONPReady),
.QoSEN(QoSEN),
2021-10-29 10:04:59 +00:00
/* Interrupt acknowledge select */
2024-10-11 20:41:31 +00:00
.IACKCS(IACKCS));
2024-10-03 11:59:29 +00:00
2021-10-29 10:04:59 +00:00
endmodule