Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
19654 Discussions

Cmd line - how to get started?

Honored Contributor II

I've been trying out Quartus Lite 17.0.1 for a couple of days and know how to synthesise simple designs with it (using Ubuntu 16.04). 


But for development, I'd prefer to move away from the GUI and use the command line instead, i.e. doing a compile + fit + assembly + jtag programming cycle without having to go through the mouse-based IDE. 


I know Make and Tcl quite well, but know nothing yet about how it inter-operates with Quartus. 


Is there an easy way to get started? I've been looking around on the web and this forum, but what I find seems to address a much more elaborate 100% cmd-line based workflow, whereas this is merely about re-running a project I've already created with the GUI. All I'm looking for is a way to do the repetitive stuff from the cmd-line, for everything else the GUI is fine (and a nice way to explore & learn). 


Any tips and pointer appreciated. 



0 Kudos
2 Replies
Honored Contributor II

Here's a Makefile I use to run a full Quartus compile thru programming file generation on a design: 


makefile: DESIGN=MY_DESIGN generate:: $(QUARTUS_BIN)/quartus_map $(DESIGN) --write_settings_files=off $(QUARTUS_BIN)/quartus_fit $(DESIGN) --write_settings_files=off --seed=1 $(QUARTUS_BIN)/quartus_asm $(DESIGN) --write_settings_files=off $(QUARTUS_BIN)/quartus_sta $(DESIGN) $(QUARTUS_BIN)/quartus_eda $(DESIGN) --write_settings_files=off -c $(DESIGN) $(QUARTUS_BIN)/quartus_cpf -c $(DESIGN).cof clean:: -rm -f $(DESIGN).*.rpt $(DESIGN).*.summary $(DESIGN).*.smsg $(DESIGN).map $(DESIGN)_assignment_defaults.qdf $(DESIGN).*.ddb $(DESIGN).sld -rm -f $(DESIGN).done $(DESIGN).map $(DESIGN).pof $(DESIGN).sof $(DESIGN).jic $(DESIGN).pin $(DESIGN).jdi $(DESIGN).qws -rm -rf db incremental_db simulation # the end  


Programming is still done by launching the Quartus graphical programming utility. 


The Makefile does not attempt to do any dependency checking as it is not really meaningful; once you change a source file (.v or .sdc or .qsf) you really need to run the full MAP thru SOF/POF/JBC programming file generation anyway. So really it is not using much of the capability of make (all the dependency checking) and in reality the listed quartus commands could just be embedded into a shell script. 


And a setup file to configure which installed version of Quartus I want to use (I have several versions installed). I just have to run this setup file once before invoking make, to setup all the required environment variables.!/bin/bash# export QUARTUS_BASE=/cygdrive/C/Tools/Altera/16.0 export QUARTUS_ROOTDIR=${QUARTUS_BASE}/quartus if ; then export QUARTUS_BIN=${QUARTUS_BASE}/quartus/bin64 else export QUARTUS_BIN=${QUARTUS_BASE}/quartus/bin fi export QSYS_ROOTDIR=${QUARTUS_BASE}/quartus/sopc_builder/bin export SOPC_KIT_NIOS2=${QUARTUS_BASE}/nios2eds# echo QUARTUS_BASE=${QUARTUS_BASE} echo QUARTUS_ROOTDIR=${QUARTUS_ROOTDIR} echo QUARTUS_BIN=${QUARTUS_BIN} echo QSYS_ROOTDIR=${QSYS_ROOTDIR} echo SOPC_KIT_NIOS2=${SOPC_KIT_NIOS2}# # the end  


I run this on the CYGWIN 32b environment under Windows 7 64b and it works without any issues. 


In my design directory I have text files: MY_DESIGN.qsf, .cdf, .cof, .qpf, .sdc which I maintain using a text editor (EMACS). 

I have a separate source directory which has MY_DESIGN.v and all subsidiary verilog files. 

I rarely have to invoke the graphical Quartus IDE.
Honored Contributor II

Ooh, yes, this looks like it will get me exactly to what I was hoping for. MANY thanks for sharing! I'm using Quartus in a VM under Parallels and my home directory mounted, the command line will be a great convenience, staying in a vim+ssh context on MacOS. 


Great, the adventure continues... thanks again.