Warp-SE/cpld/FSB.v

35 lines
1.0 KiB
Coq
Raw Normal View History

2021-10-29 10:04:59 +00:00
module FSB(
/* MC68HC000 interface */
input FCLK, input nAS, output reg nDTACK, output reg nVPA,
2021-10-29 10:04:59 +00:00
/* AS cycle detection */
2023-07-16 03:20:51 +00:00
output BACT, output BACTr_out, output reg WS,
2021-10-29 10:04:59 +00:00
/* Ready inputs */
input ROMCS,
input RAMCS, input RAMReady,
2023-06-07 22:51:59 +00:00
input IOPWCS, input IOPWReady, input IOReady,
2023-07-16 03:20:51 +00:00
input SndReady,
2023-04-08 09:49:29 +00:00
/* Interrupt acknowledge select */
2021-10-29 10:04:59 +00:00
input IACS);
/* AS cycle detection */
reg ASrf = 0;
2023-07-16 03:20:51 +00:00
reg [3:1] BACTr;
always @(negedge FCLK) begin ASrf <= !nAS; end
assign BACT = !nAS || ASrf; // BACT - bus active
2023-06-07 22:51:59 +00:00
always @(posedge FCLK) BACTr[3:1] <= { BACTr[2:1], BACT };
2023-07-16 03:20:51 +00:00
assign BACTr_out = BACTr[1];
2023-06-07 22:51:59 +00:00
always @(posedge FCLK) WS <= BACTr[3:1]==3'b111 && BACT;
2021-10-29 10:04:59 +00:00
/* DTACK/VPA control */
2023-07-16 03:20:51 +00:00
wire Ready = SndReady &&
(RAMCS && RAMReady && !IOPWCS) ||
(RAMCS && RAMReady && IOPWCS && IOPWReady) ||
(ROMCS) || (IOReady);
always @(posedge FCLK) nDTACK <= !(Ready && BACT && !IACS);
always @(posedge FCLK, posedge nAS) begin
if (nAS) nVPA <= 1;
else nVPA <= !(Ready && BACT && IACS);
2021-10-29 10:04:59 +00:00
end
endmodule