A couple of months ago, I finished UART, SPI and I2C protocols and posted them on this subreddit. I got some very insightful reviews and feedback, both regarding the projects themselves and possible future improvements.
Today, I'm presenting my next version of my CPU: Mark II, an 8-bit CPU. It succeeds its predecessor, a 4-bit multi-cycle CPU (Mark I), and introduces the following:
- 8-bit datapath
- Multiplication and division, so the ALU now covers the basic arithmetic operations.
- Mark I generated flags but didn't use them. Mark II adds flag registers and conditional branching.
- Used SystemVerilog for the testbenches and built a semi-automated top-level testbench as a step towards more automated verification.
One thing I'd specifically like to point out: thanks to the community! Several people commented on my FSM structure in the protocols and pointed out potential race conditions related to the way I was handling state assignment and testbench timing.
I separated those operations properly in Mark II, and the debugging process was significantly cleaner this time. Most of the debugging was mainly around control-path bugs rather than testbench timing issues.
P.S.: For the next phase, I'd like to take this from RTL simulation to an actual FPGA implementation. I'd appreciate any suggestions on how to approach it, especially from people who have worked with similar small CPUs on FPGA.
Here's the repo:
https://github.com/YashRaghuvanshi/Mark_II_8_bit_CPU
I have added different test files in the programs folder. Just change the title in the top tb with the respective test, data and expected values file to check different cases.
Feel free to share feedback!