Having finally found time to start breadboarding my SD card interface I first made sure that the edge trigger circuit I had tested in ModelSim would work when built with real components.
An issue I had encountered previously when breadboarding RC2014 peripherals was that if I wanted to disconnect the circuit from the RC2014 I would lose track of which wire was which. To work around this this time I took an unused RC2014 protoboard module and soldered on just the usual 90 pin header and a socket header below it. The protoboard can still be used later (minus one row of holes) and now provides something that wires can be plugged into that can be removed from the RC2014.
With the edge trigger circuit built I tested it using my Open Logic Sniffer, which has been an invaluable tool for many projects. I did however notice that running on the RC2014's 8mhz clock brings the Open Logic Sniffer quite close to its limits. The 200mhz maximum sample rate provides resolution for only about 12 steps within each clock cycle, so there is limited scope for playing with gate delays.
Once the edge detect circuit was proven to work I started building the rest of the circuit and things quickly got complicated.
The image above shows the almost complete circuit, but with a loopback between the input and output shift registers where the SD card would normally fit, and some blinkenlights on the outputs from the input shift register to indicate its state before it was connected to the data bus.
I spent quite a long time debugging why the signal coming into the input shift register was always off by one bit. Initially I blamed timing issues in the glue logic and spent quite a while experimenting with inserting delays to try and fix things. Eventually I realised that I was clocking both the Shift Clock Pulse input of the 74HCT595 and the Store Clock Pulse (which latches values from the shift register to the output shift register) with the same clock signal. This resulted in the output register always showing the last but one state of the shift register. Switching the Store Clock Pulse input to an inverted copy of the clock signal fixed this and I was able to send any byte from the output shift register to the input shift register with the circuit operating in autoshift mode.
Previously when breadboarding I had been building the circuit in KiCAD, planning out the breadboard layout as PCB, then building the circuit based on that design. Any changes made on the breadboard had to be updated in KiCAD or things got very confusing.
Unfortunately this mechanism got onerous once I started making changes on the breadboard. Following traces on the screen is no easier than following them in the real world and long jumper wires were hard to route in KiCAD without using many extra layers.
For the most recent attempt I decided to try a more old school approach and build a netlist representing the breadboard contents on paper. I made and printed some templates in Google Sheets, annotated the existing breadboarded design onto the sheet, then kept it up to date as things changed. This turned out to be a lot more convenient than keeping track of the design in KiCAD as it was easy to search for a signal by name and the paper was easier to reach on my desk.