managing vhdl projects with Makefiles

Discussion in 'VHDL' started by alb, Aug 2, 2013.

  1. alb

    alb Guest

    Hi everyone,

    this is another attempt to switch to a completely batched mode to manage
    my vhdl projects. The rationale behind is that I'd like to get a
    directory structure for my projects that is tool independent and I'd
    like to use Makefiles to handle vhdl dependencies and development phases
    (simulation, synthesis, p&r, ...).

    I have read several articles on this subject but none of them was
    presenting an end-to-end flow for an example design and I every time
    struggled a lot trying to put everything together [1].

    I know about 'vmk' tool, but to be honest I haven't found any additional
    information on top of the man page. If anyone here is regularly using it
    I'd appreciate some examples.

    At Cern it has been developed an 'hdlmake' tool to generate makefiles
    and much more (like downloading stuff from remote repositories or
    launching simulations/synthesis on remote servers), but to be honest I
    prefer tools that "do one thing and to it well".

    I know that is striving for a standard structure for
    projects and it qualifies some of them as 'Certified Projects' (OCCP) if
    they obey to certain rules, including having make-scripts. But to be
    honest I lost my way several times in the past.

    Any suggestion/comment is welcome.


    [1] OT: I have to say that I've been lacking 'laziness' recently and
    this is one of the main reasons why I'm still stuck with this silly
    alb, Aug 2, 2013
    1. Advertisements

  2. alb

    Rob Gaddi Guest

    I've seen those same tools, and given them brief consideration, but at
    the end of the day I go back to GNU make. I don't want some
    specialized make tool that cares whether I'm writing HDL, C, or
    anything else.

    That said, dependencies are a horror, and I've found no consistent way
    to do it across target platforms; my Xilinx makefiles look entirely
    different than my Altera ones, and both of them have serious
    limitations relating the source files to the project. The Altera stuff
    is particularly touchy; I've found that in order to do anything
    meaningful with makefiles I wind up needing to have supplemental Tcl
    scripts that my makefile calls through quartus_sh.
    Rob Gaddi, Aug 2, 2013
    1. Advertisements

  3. What vendor are you using? That's the biggest question here, rather than
    the HDL side.

    We have makefiles for Altera that will:
    Checkout any component repositories needed by the project
    Build Bluespec -> Verilog
    [or run the Bluespec simulator]
    Run Qsys to generate Altera's Verilog IP (including some of the B->V output)
    Synthesise the Verilog in Quartus
    Download to an FPGA
    Load the FPGA memory/flash/etc

    Each step is only a few lines, so don't need a special tool, but they're
    fairly Altera- and project- specific. Up to source code level the directory
    structure isn't really important, and then the structure is set by the
    synthesis tools. Bluespec figures out the children of a component so we
    don't have to list them in the makefile, and the Altera project files
    (either Qsys or Quartus) itemise the components, so we don't have to specify
    that in the makefile either.

    The main part of the work is working out the incantations to run tools from
    the command line not via the GUI (and make them obey dependencies).

    I'm not as familiar with VHDL as I am with Verilog, but I don't think
    there's much different that would apply to VHDL here (some of Altera's IP is
    in VHDL, but it doesn't affect the build process).

    Theo Markettos, Aug 2, 2013
  4. alb Guest

    Yes, batch mode and tool independence, that's something I'd like as well. But not make files. You can see my efforts in this area here:

    and more details (with GHDL, but mostly applies to other sims) here:

    ttask is something that I'm currently working on, and at the moment it onlysupports simulation, (Modelsim, Xilinx, GHDL, iverilog), although my plan is to add support for other phases in FPGA development as well.

    Basically, you tell it type of project (e.g. modelsim, xilinx-isim, etc), where your source files are (i.e. you don't have to conform to a pre-definedlayout), and you tell it some build properties (e.g. build directory, number of simulation threads (which has an impact on how many licenses get checked out **)), then you run tasks for running simulations.

    Note that it is only version 0.5, so I'm still adding functionality and I'dwager it has plenty of rough edges as well.

    For other phases of FPGA development, I did start to add support for XilinxISE, but I abandoned it to focus my efforts on the simulators. There is xilinx-ise.tcl file in the source tree, but that's way, way out of date, to the extent that it's completely broken, hence you won't find any documentation for it. My plan is to fix it, and add support for altera tools, etc.


    ** for paid tools, the free ones including modelsim altera and Xilinx webpack are happy to run parallel simulations.

    Note also that I'm primarily developing this under Linux, and all my tests work there. I do run it under Windows however as well, but just the Windowsversion of Vivado has a bug in it which currently stops my scripts workingwith it... but I'll fix that and get round to reporting the Vivado bug (xvhdl -work lib=dir doesn't seem to work).
, Aug 3, 2013
  5. alb

    alb Guest

    I use the Libero-Soc workflow which is using ModelSim and Synplify Pro
    for simulation and synthesis, while is using Designer for the p&r.

    In my simple approach I would have rather had a simple Makefile (GNU
    Make) to handle dependencies but use tcl scripts to handle tool options
    and the like.

    Unfortunately I'm not very skilled in tcl yet (read: I do not know tcl
    yet!) and I would have liked to start from an example rather than
    starting from scratch.
    Is you makefile available somewhere? Or any simplified version of it?
    I understand the steps are pretty tool-dependent but I guess I can skim
    that part out and fit my need in...hopefully.

    I've found this article on Microsemi knowledge-base page:

    I'll give it a try and see how it goes.
    alb, Aug 5, 2013
  6. alb

    alb Guest

    On 02/08/2013 18:01, Rob Gaddi wrote:
    IMO what makes vmk interesting is that it analyzes your code base and
    generates a GNU Makefile to handle dependencies. I'm not sure then how
    does it handle simulations/synthesis and so on.

    Well, in my case I should say that I'm not dealing with hundreds of
    files and I could potentially do a dependency tree by hand, without any
    additional hassle. But I guess that my laziness prevents me from doing
    something manually if I can automate it :).
    I would imagine though that while dependencies are handled by Makefile
    rules, then actual tasks can be done by external tcl scripts. Already
    something similar would make my life way easier than pushing buttons on
    that silly GUI.
    alb, Aug 5, 2013
  7. Here's the toplevel makefile:

    There are child makefiles for building Bluespec, ROMs, etc, but they're not
    that interesting... Bluespec does its own dependency handling, so the
    essence of the build is a single line (with a few alternatives for varieties
    of simulator), and the ROMs are standard software build makefiles.
    Hmm... I see what you mean. Altera's version of same can be driven from
    shell (and so Makefile) rather than TCL. So it's much easier to plumb into
    existing infrastructure.

    Theo Markettos, Aug 5, 2013
  8. alb

    alb Guest

    Hi Theo,

    On 05/08/2013 22:37, Theo Markettos wrote:
    thank you loads! There are quite interesting points in this file. I like
    the overall structure and it seems quite user friendly. As a top level
    makefile it can recursively enter in all subdir and have everything done.

    My directory tree is essentially the following:

    constraints/ -- constraint files
    rtl/ -- vhdl code
    simulation/ -- simulation scripts
    synthesis/ -- synthesis scripts
    stimuli/ -- testbench with cases and so on

    Your example would be perfect as a top level calling each of the
    Makefiles present in each subdir.

    Currently I've started using 'vmk' and I find it quite interesting. I'm
    trying to understand some more details regarding predefined tools and
    how to configure new ones.

    Apparently it exists also an 'lmk' tool for libraries, but I still
    haven't found it anywhere on the net (so far).

    One big bit I learned through this quest is that if entities and
    architectures are split on separate files (as well as packages'
    declarations and packages' bodies), then modifying an architecture (or a
    package body), does not trigger a recompilation of any other unit, which
    may be quite beneficial for large projects.
    alb, Aug 6, 2013
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.