-
Notifications
You must be signed in to change notification settings - Fork 55
Running the Tool
See Dev Board Setup for an intro to using PipelineC for the first time.
PipelineC is pure Python other than calls to the synthesis+simulation tools which need additional setup and configuration. It is possible to run PipelineC without specifying an FPGA part / without installing a synthesis tool, however there will be no automatic pipelining or timing feedback provided for you (i.e. only basic VHDL is generated in this --comb --no_synth mode).
ghdl, yosys, and ghdl-yosys-plugin are required for --verilog and --verilator support.
Currently only Linux based environments are supported, it is expected that the system has a C preprocessor cpp executable installed. Native Windows+Mac support requires work, the best option for Windows+Mac users at the moment is use PipelineC, synthesis, and simulation tools through either 1) Linux in a virtual machine or 2) Windows Subsystem for Linux (WSL).
-
Install one or more synthesis tools:
-
Xilinx Vivado: Defaults to
vivadoexecutable in user path. Otherwise either set aXILINX_VIVADOenvironment variable (path like/Xilinx/Vivado/2019.2) or edit theVIVADO_DIRconstant at the top of VIVADO.py- Test:
pipelinec ./examples/tool_tests/vivado.c
- Test:
-
Intel Quartus: Defaults to
quartus_shexecutable in user path. Otherwise Edit theQUARTUS_PATHconstant at the top of QUARTUS.py- Test:
pipelinec ./examples/tool_tests/quartus.c
- Test:
-
Lattice Diamond: Defaults to
diamondcexecutable in user path. Otherwise edit theDIAMOND_PATHandDIAMOND_TOOLconstants at the top of DIAMOND.py- Test:
pipelinec ./examples/tool_tests/diamond.c
- Test:
-
ghdl + yosys + ghdl-yosys-plugin + nextpnr: The easiest install option is via the OSS CAD Suite. Extract the most recent nightly build archive and update the single constant
OSS_CAD_SUITE_PATHat the top of OPEN_TOOLS.py. Otherwise defaults to executables in user path.-
WARNING: Versions of tools installed using
apt-getare likely too old to work.- Install and build latest versions of ghdl, yosys, and ghdl-yosys-plugin for
--verilogand--verilatorsupport. nextpnr is needed for autopipelining. - Older
ghdlversions do not support theIEEEfloatlibrary. -
Yosyswill fail to load theghdlshared library if theghdl-yosys-pluginis not installed.
- Install and build latest versions of ghdl, yosys, and ghdl-yosys-plugin for
- Test:
pipelinec ./examples/tool_tests/open_tools.c
-
WARNING: Versions of tools installed using
-
Gowin EDA: Defaults to
gw_shexecutable in user path. Otherwise edit theGOWIN_PATHconstant at the top of GOWIN.py- Test:
pipelinec ./examples/tool_tests/gowin.c
- Test:
-
Efinix Efinity: Defaults to
efx_run.pyexecutable in user path. Otherwise edit theEFINITY_PATHpath at the top of EFINITY.py- Test:
pipelinec ./examples/tool_tests/efinity.c
- Test:
-
Cologne Chip Toolchain: Defaults to
p_rexecutable in user path. Otherwise edit theCC_TOOLS_PATHpath at the top of CC_TOOLS.py. In both cases it is expected that the most recent build ofcc-toolchaindirectory has been extracted.- Test:
pipelinec ./examples/tool_tests/cc_tools.c
- Test:
-
PyRTL Models: Have the python3 packages
pyrtland its dependencypyparsinginstalled. Do not specify an FPGAPARTpragma and these models will be used by default. Experimental for ~singleMAINfunction/pipeline designs only.- Test:
pipelinec ./examples/tool_tests/pyrtl.c
- Test:
-
Xilinx Vivado: Defaults to
-
Optionally supply the
--out_dircommand line argument, otherwise a newpipelinec_outputdirectory inside the current one is created for output files.- The output directory structure is subject to change but currently looks like:
-
<your_file>.parsed: Ex.main.c.parsedwould be a cached already-parsed version ofmain.cfile. -
vhdl_files.txtis a plain text list of the VHDL files the tool intends for you to use.- As mentioned below, individual synthesis tools also have some specific output files generated just for them.
-
built_in/: this directory has the VHDL files for all basic built-into-C features (ex. simple operators, muxes) -
top/: this directory is named based on the--topcommand line argument. By defaulttop/top.vhdis the final output top level file produced by PipelineC. - Other directories are based on the file path to where code lives:
- Ex. code generated from parsing
examples/arty/top.cis put in an output directory calledexamples/arty/top.c/
- Ex. code generated from parsing
-
- Be aware of some things regarding generated output files:
- There can be stale output directory files, recommend starting from a fresh output directory if any odd behavior is encountered.
- Stopping the tool after code parsing completes means the code will not be parsed again - delete
<your_file>.parsedfrom your output directory if code is modified after parsing. - Stopping the tool during synthesis creates a failing synthesis run log - delete that log file (synthesis tool specific) before trying again.
- Stopping the tool after code parsing completes means the code will not be parsed again - delete
- Pipelining iterations produce many VHDL files, some simple setups like those for sim mistakenly include all VHDL files found in the output directory as opposed to just those listed in
vhdl_files.txt.
- There can be stale output directory files, recommend starting from a fresh output directory if any odd behavior is encountered.
- The output directory structure is subject to change but currently looks like:
-
If you plan to do simulation install one or more simulation tools:
-
Modelsim: Install Modelsim. Make sure the
vsimexecutable is in your path or edit theMODELSIM_PATHconstant defined at the top of MODELSIM.py. Use the--modelsimcommand line option. -
Verilator or CXXRTL: The easiest install option is via the OSS CAD Suite. Extract the most recent nightly build archive and update the single constant
OSS_CAD_SUITE_PATHat the top of OPEN_TOOLS.py. Otherwise defaults to executables in user path. Use--verilatoror--cxxrtlcommand line options. -
cocotb: See cocotb install instructions. Currently only
ghdlis supported as the simulator.ghdlmust be in the user path. Use:--cocotb --ghdl.
Use
--simor--sim --combfor starting simulations. WARNING: The default tool for Lattice ECP5U parts is set to the GHDL+Yosys+NextPNR flow. See SYN.py to change. -
Modelsim: Install Modelsim. Make sure the
See pipelinec -h for all command line options.
- Write PipelineC code. Examples can be uncommented and included from main.c.
- Run the tool.
pipelinec your_file.c. Defaults to main.c if file not specified. - If the tool is stopped before completion you can rerun the tool specifying the same
--out_dirto try and pick up where you left off. This is good for large designs / long synthesis sweeps. - The output of the tool is generated VHDL in the output directory (see
vhdl_files.txt):-
Xilinx Vivado: A
read_vhdl.tclscript is also generated -
Intel Quartus: A
pipelinec_top.qipQuartus IP file is also generated. - Lattice Diamond: Refer to generated 'top' module project file in the output directory.
-
GHDL+Yosys+NextPNR: Refer to generated 'top' module build script
.shin the output directory. -
Gowin EDA: Refer to generated 'top' module build
.tclscript in the output directory. -
Efinix Efinity: Refer to generated 'top' module build script
.shand project.xmlin the output directory. -
Cologne Chip Toolchain: Refer to generated 'top' module build script
.shin the output directory. -
PyRTL Models: Refer to generated 'top' module build script
.shin the output directory.
-
Xilinx Vivado: A
-
Include the generated PipelineC VHDL files in your project.
-
Xilinx Vivado: Can be done with Vivado Tcl command line like so that removes all old PipelineC files and sources all the newly generated VHDL.
remove_files /home/user/pipelinec_output/*; source /home/user/pipelinec_output/read_vhdl.tcl; -
Intel Quartus: Refer to generated
pipelinec_top.qipQuartus IP file in the output directory. -
Lattice Diamond: Refer to generated
vhdl_files.txtand 'top' module project file in the output directory. -
GHDL+Yosys+NextPNR: Refer to generated
vhdl_files.txtand 'top' module build script.shin the output directory. -
Gowin EDA: Refer to generated
vhdl_files.txtand 'top' module files in the output directory. -
Efinix Efinity: Refer to generated
vhdl_files.txtand 'top' module build script.shand project.xmlin the output directory. -
Cologne Chip Toolchain: Refer to generated
vhdl_files.txtand 'top' module build script.shin the output directory. -
PyRTL Models: Refer to generated
vhdl_files.txtand 'top' module build script.shin the output directory.
-
-
Proceed with normal bitstream generation flow.
- PipelineC does not provide clock generation modules or timing constraints for the user. I.e. manufacturer generated clocking modules create constraints, user should make minimal wrapper VHDL module instantiating clock generators and the final connection to board IOs. See Dev Board Setup for more information.
...Maybe someday synthesis tools will take PipelineC description as the top level directly...