Warp-SE/cpld/FSB.v

47 lines
1000 B
Coq
Raw Normal View History

2021-10-29 10:04:59 +00:00
module FSB(
/* MC68HC000 interface */
2023-03-22 01:11:58 +00:00
input FCLK, input nAS, output reg nDTACK, output nVPA,
2021-10-29 10:04:59 +00:00
/* AS cycle detection */
2023-03-22 01:11:58 +00:00
output BACT,
2021-10-29 10:04:59 +00:00
/* Ready inputs */
2022-09-04 01:32:05 +00:00
input Ready0, input Ready1, input Ready2,
2021-10-29 10:04:59 +00:00
/* Interrupt acknowledge select */
input IACS);
/* AS cycle detection */
reg ASrf = 0;
always @(negedge FCLK) begin ASrf <= ~nAS; end
2023-03-20 04:53:10 +00:00
assign BACT = ~nAS || ASrf; // BACT - bus active
2021-10-29 10:04:59 +00:00
2022-09-04 01:32:05 +00:00
/* Ready generation and bypass */
2021-10-29 10:04:59 +00:00
reg Ready0r, Ready1r, Ready2r;
2022-09-04 01:32:05 +00:00
wire Ready = (Ready0 || Ready0r) &&
(Ready1 || Ready1r) &&
(Ready2 || Ready2r);
2021-10-29 10:04:59 +00:00
always @(posedge FCLK) begin
if (~BACT) begin
Ready0r <= 0;
Ready1r <= 0;
Ready2r <= 0;
end else begin
if (Ready0) Ready0r <= 1;
if (Ready1) Ready1r <= 1;
if (Ready2) Ready2r <= 1;
end
end
2022-09-04 01:32:05 +00:00
2021-10-29 10:04:59 +00:00
/* DTACK/VPA control */
reg VPA;
assign nVPA = ~(~nAS && VPA);
always @(posedge FCLK) begin
if (~BACT) begin
nDTACK <= 1;
VPA <= 0;
2023-03-20 05:13:11 +00:00
end else if (Ready) begin
2021-10-29 10:04:59 +00:00
nDTACK <= IACS;
VPA <= IACS;
end
end
endmodule