Verilog Simulation with Verilator and SDL
projectf.io
projectf.io
My team chose to reimplement Space Invaders. The soft-core was supported by a C compiler, so we wrote the game in C, with carefully-chosen functions for graphics rendering containing #ifdefs that gated either direct memory accesses (for the FPGA VGA hardware) or SDL calls.
Our "init()" function would initialize the VGA hardware on the FPGA, and create an SDL window when compiled on a computer with an OS.
Using this, the hardware and software people were able to work together in parallel, and we won best project for our class, with a grand prize of "we'll show your cool project to the next classes".
As I recall, we wrote most of the game using SDL backend, and only tested it on "real" hardware a few days before the final project. We found a single bug (during the integration) that took us on the order of half an hour to debug, and that was that.
It seems to be though a lot the open source stuff seems to pick Verilog for some reason.
Most commercial tools support both HDLs.
I should also add that if you wanted to use a single language for everything OSVVM is excellent.
While not a big fan of the begin end style syntax, it definitely is better than verilog in my experience.
I find interesting so many open source projects like this target Verilog. It also kinda bugs me.
Modulo "HDL is different because everything is synchronous" and the testing DSL, You can learn most of verilog in a day, not so much VHDL.
For me, the syntax is ideal. On the plus side VHDL seems to have actually been designed with the intention of being used for FPGA designs. Verilog on the other hand just seems like a hack in comparison.
VHDL also supports defining record types, such that a collection of signals can be assigned together.
Most complaints about Verilog from VHDL people come from outdated notions of the current state of the language and its tooling.
I dont like the begin end style syntax and some the verbosity that entails with VHDL. However, I would rather create designs in VHDL than verilog when given the choice.
You can even do:
typedef enum bit[1:0] {
my_one, my_two, my_three, my_four
} my_enum;
typedef struct packed {
my_enum b,
bit [3:0] x
} my_struct
my_struct.b <= my_three;
etc...It's been a nice path since I last dealt with Verilog. The concept of interfaces makes struct/vector input/output even nicer.
Thanks!
Indeed I'd say SystemVerilog is doing better on that front, as Verilator (https://www.veripool.org/verilator/) supports SystemVerilog and is probably the best open source tool for 'real' HDL work (note the number of industrial users).
What I meant were the free toolchains provided by all of the FPGA vendors. They typically support SystemVerilog in synthesis and modelsim as far as I have seen.
Any time VHDL comes up it's usually in the context of "this isn't a problem in VHDL". (But also "this would be way more verbose in VHDL")
Or something different?
Verilator can simulator a subset of SystemVerilog, mostly that which is synthesizable (though work is on-going to expand its capabilities so it can run UVM code).
So it's a replacement for modelsim if you're just using it to run your actual design RTL. You need to build a synthesisable testbench or write one in C++ (or check cocotb: https://github.com/cocotb/cocotb)