Warp-SE/cpld/WarpSE.v

156 lines
3.5 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,
input nAS_FSB,
input nLDS_FSB,
input nUDS_FSB,
input nWE_FSB,
output nDTACK_FSB,
output nVPA_FSB,
output nBERR_FSB,
2022-04-05 22:00:27 +00:00
input CLK,
output MCLK,
output RCLK,
2021-10-29 10:04:59 +00:00
input CLK2X_IOB,
input CLK_IOB,
input E_IOB,
input nDTACK_IOB,
input nVPA_IOB,
output nVMA_IOB,
output nAS_IOB,
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,
input nRES,
2022-03-28 03:45:53 +00:00
input nIPL2,
2022-04-05 22:00:27 +00:00
output CKE,
output nCS,
2021-10-29 10:04:59 +00:00
output nRAS,
output nCAS,
2022-04-05 22:00:27 +00:00
output nRWE,
output [1:0] BA,
2021-10-29 10:04:59 +00:00
output [11:0] RA,
2022-04-05 22:00:27 +00:00
output DQMH,
output DQML,
2021-10-29 10:04:59 +00:00
output nADoutLE0,
output nADoutLE1,
output nAoutOE,
output nDoutOE,
output nDinOE,
2022-03-28 03:45:53 +00:00
output nDinLE,
input [2:0] SW,
output CLK20EN,
output CLK25EN);
/* DIP switches */
assign CLK20EN = SW[0];
assign CLK25EN = !SW[0];
wire MotherboardROMEN = !SW[1];
2021-10-29 10:04:59 +00:00
/* AS cycle detection */
wire BACT;
2022-04-05 22:00:27 +00:00
wire [1:0] SS;
wire CLK_FSB = (~CLK && SS[1:0]==2'b01);
CLK clk(CLK, SS, MCLK, RCLK);
2021-10-29 10:04:59 +00:00
wire IOCS, SCSICS, IOPWCS, IACS, ROMCS, RAMCS, SndRAMCSWR;
CS cs(
2022-03-28 03:45:53 +00:00
/* Setting input */
MotherboardROMEN,
2021-10-29 10:04:59 +00:00
/* MC68HC000 interface */
A_FSB[23:08], CLK_FSB, nRES, nWE_FSB,
/* AS cycle detection */
BACT,
/* Device select outputs */
IOCS, SCSICS, IOPWCS, IACS, ROMCS, RAMCS, SndRAMCSWR);
RAM ram(
2022-04-05 22:00:27 +00:00
CLK, SS,
2021-10-29 10:04:59 +00:00
/* MC68HC000 interface */
2022-04-05 22:00:27 +00:00
A_FSB[21:1], nWE_FSB, nAS_FSB, nLDS_FSB, nUDS_FSB,
2021-10-29 10:04:59 +00:00
/* AS cycle detection */
BACT,
/* Select and ready signals */
2022-04-05 22:00:27 +00:00
RAMCS, ROMCS,
/* SDRAM interface */
CKE, nCS, nRAS, nCAS, nRWE,
BA, RA, DQMH, DQML);
2021-10-29 10:04:59 +00:00
wire Ready_IOBS, BERR_IOBS;
2022-03-28 03:45:53 +00:00
wire Park, IOREQ, IOACT, IOBERR;
2021-10-29 10:04:59 +00:00
wire ALE0S, ALE0M, ALE1;
assign nADoutLE0 = ~(ALE0S || ALE0M);
assign nADoutLE1 = ~ALE1;
wire IORW0, IOL0, IOU0;
IOBS iobs(
/* MC68HC000 interface */
CLK_FSB, nWE_FSB, nAS_FSB, nLDS_FSB, nUDS_FSB,
/* AS cycle detection, FSB BERR */
BACT,
/* Select and ready signals */
IOCS, IOPWCS, Ready_IOBS, BERR_IOBS,
/* Read data OE control */
nDinOE,
/* IOB Master Controller Interface */
IOREQ, IOACT, IOBERR,
/* FIFO primary level control */
ALE0S, IORW0, IOL0, IOU0,
/* FIFO secondary level control */
ALE1);
2022-03-28 03:45:53 +00:00
wire nAS_IOBout, nLDS_IOBout, nUDS_IOBout, nVMA_IOBout;
assign nAS_IOB = nAoutOE ? 1'bZ : nAS_IOBout;
assign nLDS_IOB = nAoutOE ? 1'bZ : nLDS_IOBout;
assign nUDS_IOB = nAoutOE ? 1'bZ : nUDS_IOBout;
assign nVMA_IOB = nAoutOE ? 1'bZ : nVMA_IOBout;
2021-10-29 10:04:59 +00:00
IOBM iobm(
/* PDS interface */
CLK2X_IOB, CLK_IOB, E_IOB,
2022-03-28 03:45:53 +00:00
nBR_IOB, nAS_IOBout, nLDS_IOBout, nUDS_IOBout, nVMA_IOBout,
nAS_IOB, nBG_IOB, nDTACK_IOB, nVPA_IOB, nBERR_IOB, nRES,
2021-10-29 10:04:59 +00:00
/* PDS address and data latch control */
nAoutOE, nDoutOE, ALE0M, nDinLE,
/* IO bus slave port interface */
2022-03-28 03:45:53 +00:00
IOACT, IOBERR,
Park, IOREQ, IOL0, IOU0, IORW0);
2021-10-29 10:04:59 +00:00
wire TimeoutA, TimeoutB;
CNT cnt(
/* FSB clock and AS detection */
CLK_FSB, BACT,
/* Timeout signals */
TimeoutA, TimeoutB);
2022-03-28 03:45:53 +00:00
/* Accelerator Disable Control */
reg RESr0 = 0;
reg RESr1 = 0;
reg RESr2 = 0;
reg IPL2r0 = 0;
reg IPL2r1 = 0;
reg RESDone = 0;
reg Disable = 0;
assign Park = ~Disable;
always @(posedge CLK_FSB) begin
RESr0 <= ~nRES; RESr1 <= RESr0; RESr2 <= RESr1;
IPL2r0 <= ~nIPL2; IPL2r1 <= IPL2r0;
if ( RESr0 && RESr1 && RESr2 && ~RESDone && IPL2r0 && IPL2r1) Disable <= 1;
if (~RESr0 && ~RESr1 && RESr2) RESDone <= 1;
end
2021-10-29 10:04:59 +00:00
FSB fsb(
2022-04-05 22:00:27 +00:00
CLK, SS,
2021-10-29 10:04:59 +00:00
/* MC68HC000 interface */
CLK_FSB, nAS_FSB, nDTACK_FSB, nVPA_FSB, nBERR_FSB,
/* AS cycle detection */
BACT,
/* Ready and IA inputs */
2022-04-05 22:00:27 +00:00
Ready_IOBS, ~(SndRAMCSWR && ~TimeoutA), Disable,
2021-10-29 10:04:59 +00:00
/* BERR inputs */
(~SCSICS && TimeoutB), BERR_IOBS,
/* Interrupt acknowledge select */
IACS);
endmodule