Hi everyone,
this is my first post here and I would like to present the project I have been working on for the last three years.
The Tridora-CPU: A homebrew CPU written in Verilog with a stack machine architecture designed for the Pascal compiler that I also
wrote for it.
The CPU runs together with some other I/O-controllers on an Arty-A7 board at 83 MHz. It uses a serial console via USB
and also has a VGA output to display graphics.
The Pascal compiler runs natively on the machine and there is an editor and a minimal operating system running from
a micro-SD-card so you can develop programs directly on the board.
This is my first Verilog/HDL project, so it is probably full of bugs and design errors, but at least it runs stable for now.
Source code, some documentation and a couple of demo videos are available here:
https://gitlab.com/slederer/Tridora-CPUAn emulator is also available.
Currently, the only supported board is the Arty-A7-35T which is no longer in production. It should be easily
adaptable to the Arty-A7-100T, but I am also looking into the Nexys 4 and the Olimex GateMateA1-EVB.
This has been such a fascinating project for me to create a complete computer system from the ground up. Creating
the CPU logic and see it slowly coming to life, then creating all the different bits of software to make it work, first
in assembly language, then in a compiled language, is such a unique experience that you cannot get from modern computers.
It was also quite fascinating to see, when writing the compiler, how well the stack machine architecture and the workings of the compiler (of the good old recursive-descent-parser type) fit together.
So it is also a kind of a retro computing experience.
The system has features from the 8-bit, the 16-bit and the early 32-bit eras, and it
might remind you of the UCSD-P-System and early Turbo-Pascal versions.
Other inspirations were, among others, in no particular order:
- the Novix 4016 CPU (a stack machine CPU designed for Forth, mainly by Charles Moore)
- the J1 CPU by James Bowman (which is not entirely unlike the Novix 4016)
- the Lilith computer by Niklaus Wirth and his team (a stack CPU designed for Modula-2)
- the PERQ workstation (also a stack CPU designed for Pascal)
- the Magic-1 by Bill Buzbee
- the OPC by revaldinho
The source code for the CPU is rather small (~500 lines of Verilog for the CPU core), and because of the stack machine architecture,
the compiler was also easy to write, resulting in about 9000 lines of code.
I tried to keep everything as simple and readable as possible, so that I could understand my own code a few months later.
I also hope that it might help other people to see how a compiler works, and how it fits with the CPU design.
Let me know what you think! Feel free to point out my design mistakes, bugs, or other suggestions.