Skip to main content

Projects I Wish I Had Mental Space For: nand2tetris in an FPGA

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

Popular posts from this blog

Losing a loved one, as an atheist

When I was around 11 or 12, I started to question the received wisdom that there was a deity. I came to the conclusion that all signs pointed to no. Do I outright, unequivocally and without reservation deny the existence of such an entity? No. However, I don’t see it as a likely scenario, and until I’m presented with hard evidence, I have enough reason to say that there isn’t. Some people take comfort in their religious beliefs, especially their belief in an afterlife. I have no interest in an afterlife, either for myself of my loved ones. In the past five years I’ve lost both my grandmother and mother, both of whom I loved dearly. No amount of belief in an afterlife would soothe my pain. I mourn at the fact that they are lost from my life, right here, right now. I imagine it’s the same even for those who believe that the dead pass on to somewhere else. You can’t escape the fact that their tangible presence is forever gone from your life. Unless you believe in ghosts, but that’s a ...

If I Grow Up

I’ve figured out what I want to be if I grow up: a writer. In fact, by writing this I’m living the dream, aren’t I? I guess things have been building up to this my whole life; I’ve been reading since I could, and writing even when I didn’t have to. Whatever my mood has been, as long as it wasn’t too severe, I’ve always written. When I was down, I wrote depressing poetry or prose. When I was up, I wrote whatever popped into my head. Now that I’m stable, I can take the time to write coherent, sensible articles. What are you going to write? It’s a good question, and I like it quite a bit. I’m going to write articles here, like the ones I’ve written so far. I’m going to write for HandmadeNews.org , with my first article there out just recently. I’ll always be writing emails. Sometimes I’ll write things down in my notebooks. If I feel like my writing is worthy of it, I might write a screenplay Josh Olson would enjoy reading. I wont bring it to him to read, though. If it’s good enough ...

English Journey in Jeopardy?

UPDATED! It seems almost certain that Sophie will be getting laid off at the beginning of next month. As such, my trip to the UK is nixed, unless I get some sort of windfall of cash. Layoff plans In order to cover expenses, and possibly have some money left over for the trip, I’ll be looking at getting a part-time job. With my constant headaches and the possibility of depression, I’d have to get something pretty stress free, and not in a noisy environment. I’m not entirely confident in my ability to show up to work every day. Our income would be significantly reduced, so a lot of what I make from a part-time job would go to bills and such. Part-time is definitely about the limit I could handle. Implications There will be no trip, as it stands. The primary implication is that I might not be able to buy my plane ticket. I think that’ll be the single biggest expense of my trip. Food is probably next, and I *was* a university student on a budget, so I know how to keep from oversp...