Saturday, August 19, 2017

Logic complete for disk emulator version of Alto disk tool


I ran quite a few simulations of the logic to watch the WriteDataClock line, get in sync with the clock pulses (entrainment) so that it can detect data bits, detect data bits properly, and switch on the sync state when it sees the first non-zero data bit value.

It worked well for various offsets, random variations, slower and faster rates. That code is locked into place. I turned to the logic to drive the deserialization - picking parallel 16 bit words from the serial bit stream encoded in the WriteDataClock input from the Alto.

It has to stay on the word boundaries, find the right pattern and signal when each word has been extracted. Those words are picked up and written to memory during write or update operations on the disk, plus an extra checksum word is sent at the end of a record which allows us to detect if we mangled the data stream.

This too needs a simulation that can present a longer bitstream after the sync word, more than two entire words, with a mix of 0 and 1 bit values. After I put that together, I ran the simulation, fine tuned the logic and ended up with machinery that will successfully look for the sync word and then extract words from the stream as long as it is allowed to stay in the synchronized state.

Moving up one layer in functionality, I need to finish the UpdateRecord machine that handles writing one record of a sector. All it has to do is:
  • watch WriteDataClock for the sync bit
  • extract each word from the deserializer
  • writing the word to the proper place in memory
  • accumulate the running checksum with each word
  • compare the extracted checksum to the calculated one
This machine is only triggered from the higher level UpdateSector machine if the WriteGate signal is turned on while the GenerateSector machine is in the preamble phase of a record. The UpdateSector machine follows GenerateSector in lockstep, but is setting up the addresses for memory control and counts that will be needed if the WriteGate goes on to update each record.

By late afternoon I had all the logic in place, but as yet untested. The emulator should work properly at this point. There is only one area where I deviate from the behavior of a real Diablo drive and that is when the Alto is writing to the drive, a real drive will echo the data back on ReadClock and ReadData, but I don't. One might have a diagnostic program that attempted to look at the ReadGate enabled stream while it is writing with WriteGate on, but due to a time delay this is nontrivial to do.

I began to mull ways I could simulate or build in a testdriver to do some testing without having a real Alto connected. This took some time. My earlier testdriver for testing the disk driver produces bits that look like the serial stream in from a disk.

I have to blend it to a shared clock and data line, to be routed into the WriteDataClock input. Too, I need a control that lets me trigger the three flavors or writing - write entire sector, read header then update label + data, or read header + label then update data.

I won't finish this today but I am planning the necessary changes and should get this together tomorrow. This is a internal test generator, only being used for debug. 

No comments:

Post a Comment