Live data from Hacker News

Designing a CPU in VHDL, Part 1: Rationale, Tools, Method

labs.domipheus.com

21–30 of 45 posts

Re: Designing a CPU in VHDL, Part 1: Rationale, Tools, Method

#21
post #13

For those interested in other FPGA boards, Digilent makes a whole series of affordable ones. https://www.digilentinc.com/Products/Catalog.cfm?NavPath=2,4...

On that note, Mojo is a good board to learn FPGAs. It includes an ATMega32 microcontoller and Xilinx Spartan. Its maker also has some good tutorials online:

https://embeddedmicro.com/tutorials/mojo/

Too bad its dev environment doesn't support OS X though.

Re: Designing a CPU in VHDL, Part 1: Rationale, Tools, Method

#22

Please do yourself a favor and use Verilog instead. I understand that VHDL forces you to write cleaner code, but it's also frustrating for no good reason. Also, start looking into pipelining ASAP. Implement one micro-arch, benchmark it, then try to do better. It's a great way to learn.

Yikes, I find Verilog to be much too C like while VHDL is almost Python like. I enjoy the strictness. VHDL 2008 (should be supported by tools now) fixes a lot of VHDL's warts. Also, I love the two process design methodology that you can use with VHDL. It lets you single-step through your VHDL code in the simulator as if it were plain procedural code! http://www.gaisler.com/doc/vhdl2proc.pdf

One can do the "two process design methodology" in Verilog too. It's not unique to VHDL.

Re: Designing a CPU in VHDL, Part 1: Rationale, Tools, Method

#24

>bonus points goes to the people who realise there is an odd thing about the form of the baz (branch if Ra is zero) instruction. Is this because the second argument is another register (presumably containing an address to branch to) instead of a label?

yes! I've not implemented conditional jump to an immediate offset yet, so you need the branch target in a register.

Re: Designing a CPU in VHDL, Part 1: Rationale, Tools, Method

#25

Please do yourself a favor and use Verilog instead. I understand that VHDL forces you to write cleaner code, but it's also frustrating for no good reason. Also, start looking into pipelining ASAP. Implement one micro-arch, benchmark it, then try to do better. It's a great way to learn.

Cheers for the tips. I'll eventually move to Verilog, but as others point out, I think it's good to walk before I run. Regarding pipelining, I'm getting right on it - and the iterative benchmarking is something I plan to do. Thanks again :)

Re: Designing a CPU in VHDL, Part 1: Rationale, Tools, Method

#26
post #9

My best advice: synthesize early and often, and spend the time to poke around in the synthesis schematic viewer - Webpack still includes this I believe. It's a great way to compare what you wrote in code to the logic you intended to implement in your mind's eye (or better yet, your notebook).

Thanks for the advice! I've been synthesizing a bit, fixing a few issues that at least didnt present when building for the simulator. I've yet to run it actually on hardware, though - that part will be fun. Webpack does still come with the schematic viewer, which is really neat.

Re: Designing a CPU in VHDL, Part 1: Rationale, Tools, Method

#27

Please do yourself a favor and use Verilog instead. I understand that VHDL forces you to write cleaner code, but it's also frustrating for no good reason. Also, start looking into pipelining ASAP. Implement one micro-arch, benchmark it, then try to do better. It's a great way to learn.

Forgive my ignorance, for I'm just starting out with VHDL and digital hardware design in general.

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.

Re: Designing a CPU in VHDL, Part 1: Rationale, Tools, Method

#28

If someone like to try VHDL or Verilog and not have FPGA board, could try EDA Playground : http://www.edaplayground.com/x/Cs2 (An 32 bit ALU)

This is amazing! I've been looking for an online HDL for learning and trying out ideas on the fly and with no IDE at hand. Thanks for the link!

Re: Designing a CPU in VHDL, Part 1: Rationale, Tools, Method

#29

If someone like to try VHDL or Verilog and not have FPGA board, could try EDA Playground : http://www.edaplayground.com/x/Cs2 (An 32 bit ALU)

This is amazing! I've been looking for an online HDL for learning and trying out ideas on the fly and with no IDE at hand. Thanks for the link!

^_^

I have plans for eventually build a VHDL implementation of TR3200 CPU with it.

Re: Designing a CPU in VHDL, Part 1: Rationale, Tools, Method

#30
Also note, an other cool project: http://moxielogic.org/blog/ (a ex co-worker.)

"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."

Post reply on HN