Designing a CPU in VHDL, Part 1: Rationale, Tools, Method
labs.domipheus.com
labs.domipheus.com
https://github.com/cseed/arachne-pnr
Together with Yosys (a Verilog synthesis tool):
and the IceStorm bitstream creation tools:
http://www.clifford.at/icestorm/
it provides a full Verilog-to-bitstream open source toolchain for the iCE40 FPGAs. There is also a low-cost (~$21) USB development board:
http://www.latticesemi.com/icestick
Unfortunately, this toolchain doesn't support VHDL, so I can't try out the OP's TPU.
I have plans for eventually build a VHDL implementation of TR3200 CPU with it.
Xilinx is happy to not reset registers, Altera will generate a bigger design if reset is not stated in the code.
Your project would be at the computer organization level. IIRC adding a pipeline would move it to computer architecture level.
I understand that reading outside a class may be a bit boring, but these courses gave us a much better understanding of key concepts and issues; from basic boolean operations (i.e how to do them right, how to optimize them), to basic concepts (e.g. 2's complement, base-2 arithmetic, FSMs, flip-flops), to more advanced concepts (e.g complex logical components, datapath, control), to various issues (e.g hazards, async / sync design), etc (i.e all these you probably won't implement as cache, OoO execution, virtual memory).
Knowing —to a certain degree— all these made the project easier and much more fun since we could actually have crazy ideas and try to implement them.
I don't know the current state of literature, but when I took the courses (12 years ago) the Patterson and Hennessy books (Computer Organization and Design, Computer Architecture) were terrific.
Still havn't seen a book that covers SIMD very well?
Sounds promising. The 4th edition just had the GPU content stuffed into an appendix.
Also, start looking into pipelining ASAP. Implement one micro-arch, benchmark it, then try to do better. It's a great way to learn.
The type checking that makes VHDL so annoying is also the same type checking that's saved me. Coming from Haskell, VHDL was a much easier language to learn than Verilog.
Where they differ is mainly in typing. VHDL requires you (unlike haskell, actually) to (very verbosely) spell out the type of everything. Verilog's type system is more like C's. You declare basic types and it's fairly loosey goosey about them. VHDL's syntax is based on Ada and Verilog's is more C like (but uses begin-end instead of curly braces).
It's not perfect either, but reading it is vastly more pleasant than plodding through a design in one of the Vs.
VHDL is dead in the industry(). While VHDL is slightly better for teaching, why not learn directly what everyone else uses? Also, because VHDL is such a pain to support for CAD tools, more tools support Verilog only, or support VHDL as a second-class citizen.
() my european friends hate me each time I say that, but it's true.
Building a CPU is what I eventually intend to do and I am curious how would you benchmark a hardware design?
What metrics would someone use for judging the effectiveness of a CPU arch? My current understanding is gate count, area occupied by the design, clocks per instruction (CPI) and maximum frequency the design can be clocked at.
Once you implement/simulate your design in silicon, power usage becomes a good comparison metric. As the depends on clock frequency, DMIPS/mW is another common comparison benchmark. Since a lot of embedded applications spend most of there time in very low power states with the core stopped, sleep current and wake/sleep time are now becoming very important. This is more of a whole chip benchmark, and is a very popular area for microcontroller manufacturers to fight over right now, as results can vary wildly depending on the application. The makers of CoreMark have tried to come out with a benchmark[2], but it doesn't cover peripherals yet and isn't quite as popular.
1. https://www.eembc.org/coremark/ 2. http://www.eembc.org/ulpbench/
One of the most valuable lessons that I've learnt from this is to treat the FPGA as a validation target, and the FPGA tools purely as a way to produce that image - they're entirely unfriendly to develop in. If you use verilog then verilator gives lightening fast simulations and you can use it to verify the hardware against.
Is this because the second argument is another register (presumably containing an address to branch to) instead of a label?
Prehaps this is so the assembler/linker/loader doesn't need to resolve what address the label ends up having
"Moxie is a general purpose bi-endian load-store processor, with sixteen 32-bit general purpose registers and a comprehensive ISA consisting of two-operand variable width instructions. There are moxie implementations that run on both Altera and Xilinx FPGA architectures, a number of simulator ports (including QEMU), and a complete GNU toolchain for C/C++ development."
(never mind it being multicycle, it was done this way for a reason, and dropping in a RISC design should be fairly trivial.)
I found both to have their little quirks, but personally liked Verilog syntax a little better - modules concept made a lot more sense coming from a software background. Do you have an existing instruction set you're planning on supporting?
https://www.digilentinc.com/Products/Catalog.cfm?NavPath=2,4...
It's pretty cheap, but it has a whole bunch of nice things built onto it, and a simple flasher script that actually works on Linux!
https://embeddedmicro.com/tutorials/mojo/
Too bad its dev environment doesn't support OS X though.