zerkman / zest

Implementation of an Atari ST in VHDL for Xilinx-based FPGAs
GNU General Public License v3.0
32 stars 3 forks source link

Random IKBD malfunction #24

Open zerkman opened 4 months ago

zerkman commented 4 months ago

The FPGA-reimplementation of the Atari intelligent keyboard (IKBD) may, in some uncertain circumstances, not be working. It seems like the serial communication is lost between the hd6301 keyboard processor and the ACIA. As the IKBD is also responsible for mouse management, this problem also prevents the mouse from working.

The exact circumstances to reproduce the error are unclear.

Typical symptoms

Possible causes

The problem arises in parts I haven't developed myself (I used open-source cores for hd6301 and ACIA). There could be an issue with the clocking implementation, which could lead to some race conditions. I must investigate that part.

The problem randomly appears in some (not all) builds, and especially it tends to not appear at all in my debug builds. I do integrate the Xilinx Integrated Logic Analizer (ILA) in the debug builds, with IKBD/ACIA tx/rx signals systematically enabled just in case the problem appears, but so far I have been unsuccessful in spotting the problem. Simulation does not seem to be very helpful either.

Best course of action would be to work on a thorough re-implemetation of the clocking mechanisms involved in both the ACIA and hd6301, and make them fully compliant with the "master clock + clock enables" mechanism that is used in all other components (see this post for more information).

zerkman commented 3 months ago

An attempt at solving this problem has been made in 609d0b84c74f420a1662636a546226c455f7f889. It completely replaces an internal clock in IKBD with the equivalent main clock+enable signals. Just fixing the clock implementation made Vivado detect numerous clock constraint violations, so many intermediary registers have also been added in the fix.