I've been working my way through the nand2tetris book, and am at the point where you pull everything together into a working computer. I got distracted and haven't had the chance to come back to it. But I had plans…
Once I'd finished the CPU design I was going to implement it in Verilog for the DE10 nano. The idea was to output the design's screen to a texture that Linux running on the ARM SoC could put into a window. I'd actually started on the Verilog for different components of the system, although that was just to complete the lessons, using someone else's Verilog of the different chips as a base, and improved on their designs. They were using too many gates for their adder, I believe, among other inefficiencies.
I'm a neophyte at FPGA design, but I realized that implementing all the multiplexers and RAM using NAND gates directly was going to under-perform. Not that the design needs the full 50 MHz offered by the board, but it's the principle of the thing. The emulator included with the course materials doesn't even go much faster than single-stepping through the instructions. But the design software for the DE10 nano has building blocks for the lower level components so they're implemented as efficiently as possible for the hardware.
Despite not having completed the project to the point where I'd have it on FPGA, I did learn a lot from what I had been through. There's the basics of designing a CPU and computer, through Verilog, onto learning how to build a Linux system image from scratch. Made me much more comfortable switching my PC to Linux, since it doesn't run Windows 11. Linux is a whole other topic that I can get into, but it's not really relevant here.
Ultimately, the book has you writing a VM that supports a language a bit like Java, since the processor doesn't have a very robust instruction set and needs more support for higher level languages. It's almost purely combinational logic and barely needs a clock for its main operation. Some of the assembly language examples are for things like multiplication by addition. I'm not sure how you'd do bit shifting with the instructions provided. I'll have to look that up. (I looked it up - it's sufficiently complicated that I won't explain it here - assuming I understood it entirely)
So that's where I am with this. Project half-finished, but new things learned. Perfect for the Idea Oubliette!
Comments