[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: Verilog, testbenches, and Makefiles
Larry Doolittle wrote:
[...]
> The heart of the Makefile is a set of four general rules:
>
> %_tb: %_tb.v
> iverilog -Wall -DSIMULATE ${VFLAGS_$@} $^ -o $@
>
> # Generic regression test
> %_check: %_tb testcode.awk
> vvp $< | awk -f $(filter %.awk, $^)
>
> %.vcd: %_tb
> vvp $<
>
> # Useful for those testbenches that have a corresponding .sav file
> %_view: %.vcd %.sav
> gtkwave $^
>
> To make this apply properly to foo, all you need to add is:
>
> foo_tb: foo.v bar.v
>
[...]
Hi Larry,
That is awesome. Thanks for sharing that. I am using a Makefile with
Icarus as well, but haven't figured it out that detailed as you have it.
So far I have used a for loop that loops over the simulation targets,
but think your approach is much better.
>
> That's it! I started using Icarus and Makefiles heavily about four
> years ago, and have gradually worked my way up to this point. This
> template is compatible with the pristine-source paradigm using VPATH.
> My current project has ten _check targets for the various components
> that make up the final design; five of them are exactly as presented
> above, the other five have more specialized post-processing.
>
> I welcome discussion and suggestions for improvement.
I am usually splitting up my code into different folders:
<project>/
|
+ doc/
+ rtl/
+ tb/
+ sim/
\ syn/
The doc/ folder holds all the documentation related to the project. I am
using Latex, so I have a Makefile here too for building the pdf. In the
rtl/ folder is the synthesizable code. The test bench is stored separate
in the tb/ folder. Now the sim/ folder holds scripts related to
simulation. In the case for Icarus that is a Makefile similar to what
you showed. Finally the syn/ folder holds scripts to run synthesis.
For Synthesis with Xilinx ISE I am using a Python script published at
the Dillon Engineering site:
http://www.dilloneng.com/documents/downloads/gen_ise_sh/
That script creates a Makefile. Probably that functionality could be
replaced by a Makefile as well.
So a central Makefile in the <project>/ folder has the targets doc, sim,
syn, and clean, which will call the respective Makefiles in the sub
folders.
I am voting for putting your Makefile on the Icarus wiki page.
Cheers,
Guenter
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user