Major Tools
Other Tools
General Info

Issue #593

Support running make and creating top C file

Added by Wojciech Koszek almost 7 years ago. Updated 12 days ago.

% Done:



I would like to use Verilator for my development. I use Icarus Verilog now.

Typical use case for me is to: start 1 .v file, add 3 lines, compile/simulate, add 3 more lines, compile/simulate, etc..

Icarus makes it relatively easy:

iverilog file.v -o file

Verilator isn't too competitive. I do understand more difficult use scenario that you picked might be because willingness to deal with only those users who spend time on studying Verilator, but honestly I can't start doing stuff like what I described quickly with Verilator.

So 2 things which I'd like to see:

- Verilator --cp option should generate some form of ready-to-use .cpp wrapper so that the sources in obj_dir are ready to be compiled

- Verilator with -o switch should probably start the compiler automatically and build everything for me.

Basically whatever VCS is doing I'd like to see in Verilator


#1 Updated by Wilson Snyder almost 7 years ago

  • Status changed from New to Feature

I agree with the intent of making it easier to compile and run.

There's a few complicating decisions....

What does Verilator do to make the top level? Since verilator doesn't make it's own clocks, the model being generated can have no inputs which implies a fairly trivial model. This would be a lot more valuable when a event model is added.

Presumably Verilator would need to call 'make'. This requires subshell process management, and the addition of appropriate -make-option-flags or somesuch for passing to make. Also, what does Verilator do on Windows and machines without gmake?

#2 Updated by Wojciech Koszek almost 7 years ago


Typically it's up to me to generate the clocks, so Verilator shouldn't be any different in that case. In my design, in a test-bench, I typically have:

always clk_reg = #(CLK_PERIOD) ~clk_reg;

And this is my clock. This is what you meant?

In terms of calling "make" -- this could be left to user, if necessary. Verilator for:

verilator file.c -o output

could generate directory file.dir with .c/.h stuff and shell script "output", which would invoke make with necessary arguments. file.dir would have a plain "makefile", which is handled by GNU/BSD make as well as Microsoft "nmake". Or it could just geneate output.c, output.h, output.makefile in the current directory. There's lots of options.

I wouldn't worry about bringing support for all possible systems at once. I assume you can't use Verilator nowadays on Windows machines without C compiler anyway, so suggested feature wouldn't change too much.

#3 Updated by Wilson Snyder almost 7 years ago

  • Subject changed from Make Verilator more Iverilog-alike to Support running make and creating top C file

#4 Updated by Wilson Snyder 12 days ago

  • Status changed from Feature to WillNotFix

Verilating and making can be done with cmake which is soon to be completed.

Making a main.cpp needs timescales, which is going to be an (even longer) wait, so closing out due to age.

Also available in: Atom