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