Collection of Tcl functions used in Vivado/Quartus scripts. More...
Go to the source code of this file.
Functions | |
ALLOWED_PROPS | |
GetSimulators | |
IsLibero | |
IsSynplify | |
IsXilinx | |
IsVivado | |
IsISE | |
IsQuartus | |
IsTclsh | |
IsVersal part | |
Find out if the given Xilinx part is a Vesal chip. More... | |
IsZynq part | |
Find out if the given Xilinx part is a Vesal chip. More... | |
BinaryStepName part | |
# Returns the step name for the stage that produces the binary file More... | |
Msg level msg ?title? | |
WriteToFile File msg | |
Write a into file, if the file exists, it will append the string. More... | |
SetProperty property value object | |
Sets a property of an object to a given value. More... | |
GetProperty property object | |
Retrieves the value of a property of an object. More... | |
SetParameter parameter value | |
Sets the value of a parameter to a given value. More... | |
AddTopFile top_module top_file sources | |
Adds the file containing the top module to the project. More... | |
SetTopProperty top_module sources | |
set the top module as top module. More... | |
GetProject proj | |
Retrieves the project named proj. More... | |
GetRun run | |
Gets a list of synthesis and implementation runs in the current project that match a run (passed as parameter) More... | |
GetFile file | |
Gets a list of files contained in the current project that match a file name (passed as parameter) More... | |
CreateFileSet fileset | |
Creates a new fileset. More... | |
GetFileSet fileset | |
Retrieves a fileset. More... | |
AddFile file fileset | |
Add a new file to a fileset. More... | |
GetRepoPath | |
gets the full path to the /../../ folder More... | |
CompareVersions ver1 ver2 | |
Compare two semantic versions. More... | |
GitVersion target_version | |
Check git version installed in this machine. More... | |
DoxygenVersion target_version | |
Checks doxygen version installed in this machine. More... | |
FindFileType file_name | |
FindVhdlVersion file_name | |
Set VHDL version to 2008 for *.vhd files. More... | |
ReadListFile args | |
Read a list file and adds the files to Vivado/Quartus, adding the additional information as file type. More... | |
OS | |
Return operative sistem. More... | |
GetLinkedFile link_file | |
Return the real file linked by a soft link. More... | |
MergeDict dict0 dict1 | |
Merge two tcl dictionaries of lists. More... | |
DictGet dictName keyName ?default? | |
Gets key from dict and returns default if key not found. More... | |
GetHashLib lib | |
Get git SHA of a vivado library. More... | |
GetModifiedFiles ?repo_path? ?pattern? | |
Get a list of all modified the files matching then pattern. More... | |
RestoreModifiedFiles ?repo_path? ?pattern? | |
Restore with checkout – the files specified in pattern. More... | |
GetFileList FILE path | |
Recursively gets file names from list file. More... | |
GetSHA ?path? | |
Get git SHA of a subset of list file. More... | |
GetVer path ?force_develop? | |
Get git version and commit hash of a subset of files. More... | |
GetVerFromSHA SHA repo_path ?force_develop? | |
Get git version and commit hash of a specific commit give the SHA. More... | |
GetProjectVersion proj_dir repo_path ?ext_path? ?sim? | |
GetHogDescribe sha ?repo_path? | |
GetSubmodule path_file | |
GetConfFiles proj_dir | |
GetRepoVersions proj_dir repo_path ?ext_path? ?sim? | |
HexVersionToString version | |
ExtractVersionFromTag tag | |
Tags the repository with a new version calculated on the basis of the previous tags. More... | |
CopyIPbusXMLs proj_dir path dst ?xml_version? ?xml_sha? ?generate? | |
Read a XML list file and copy files to destination. More... | |
CompareVHDL file1 file2 | |
Compare two VHDL files ignoring spaces and comments. More... | |
Relative base dst | |
Returns the dst path relative to base. More... | |
RelativeLocal pathName filePath | |
Returns the path of filePath relative to pathName. More... | |
MsgAndLog msg ?severity? ?outFile? | |
Prints a message with selected severity and optionally write into a log file. More... | |
GetProjectFiles | |
GetHogFiles args | |
Extract files, libraries and properties from the project's list files. More... | |
ParseFirstLineHogFiles list_path list_file | |
Parse possible commands in the first line of Hog files (e.g. #Vivado, #Simulator, etc) More... | |
AddHogFiles libraries properties filesets | |
Add libraries and properties to Vivado/Quartus project. More... | |
CheckExtraFiles libraries | |
ReadExtraFileList extra_file_name | |
Function used to read the list of files generated at creation time by tcl scripts in Project/proj/.hog/extra.files. More... | |
GenerateQsysSystem qsysFile commandOpts | |
Function used to generate a qsys system from a .qsys file. The procedure adds the generated IPs to the project. More... | |
ForceUpToDate | |
Forces all the Vivado runs to look up to date, useful before write bitstream. More... | |
HandleIP what_to_do xci_file ip_path repo_path ?gen_dir? ?force? | |
Copy IP generated files from/to a remote o local direcotry (possibly EOS) More... | |
Md5Sum file_name | |
Evaluates the md5 sum of a file. More... | |
CheckYmlRef repo_path allow_failure | |
Checks that "ref" in .gitlab-ci.yml actually matches the hog.yml file in the. More... | |
ParseJSON JSON_FILE JSON_KEY | |
Parse JSON file. More... | |
eos command ?attempt? | |
Handle eos commands. More... | |
Git command ?files? | |
Handle git commands. More... | |
GitRet command ?files? | |
Handle git commands without causing an error if ret is not 0. More... | |
FileCommitted File | |
Checks if file was committed into the repository. More... | |
ExecuteRet args | |
Handle shell commands. More... | |
Execute args | |
Handle shell commands. More... | |
GetMaxThreads proj_dir | |
Gets MAX number of Threads property from property.conf file in Top/$proj_name directory. More... | |
WriteGitLabCIYAML proj_name ?ci_conf? | |
Returns the gitlab-ci.yml snippet for a CI stage and a defined project. More... | |
FindNewestVersion versions | |
ResetRepoFiles reset_file | |
SearchHogProjects dir | |
GetGroupName proj_dir repo_dir | |
ReadConf file_name | |
WriteConf file_name config ?comment? | |
IsRelativePath path | |
WriteUtilizationSummary input output project_name run | |
GetDateAndTime commit | |
GetProjectFlavour proj_name | |
FormatGeneric generic | |
GetGenericFromConf proj_dir target ?sim? | |
Gets custom generics from hog.conf. More... | |
SetGenericsSimulation repo_path proj_dir target | |
Sets the generics in all the sim.conf simulation file sets. More... | |
GetTopFile | |
Return the path to the active top file. More... | |
GetTopModule | |
Return the name of the active top module. More... | |
GetVerilogGenerics file | |
GetVhdlGenerics file ?entity? | |
GetFileGenerics filename ?entity? | |
WriteGenerics mode repo_path design date timee commit version top_hash top_ver hog_hash hog_ver cons_ver cons_hash libs vers hashes ext_names ext_hashes user_ip_repos user_ip_vers user_ip_hashes flavour ?xml_ver? ?xml_hash? | |
GetIDEVersion | |
GetIDEFromConf conf_file | |
Mkdir dir | |
Copy i_dirs o_dir | |
RemoveDuplicates mydict | |
Remove duplicates in a dictionary. More... | |
CompareLibDicts proj_libs list_libs proj_sets list_sets proj_props list_props ?severity? ?outFile? ?extraFiles? | |
Compare the contents of two dictionaries. More... | |
WriteSimListFiles libs props simsets list_path repo_path | |
WriteListFiles libs props list_path repo_path ? $ext_path? | |
RemoveEmptyKeys d | |
Logo ?repo_path? | |
CheckLatestHogRelease ?repo_path? | |
GetOptions argv parameters usage | |
InitLauncher script tcl_path parameters usage argv | |
GetCustomCommands ?directory? ?ret_commands? | |
ListProjects ?repo_path? ?print? ?ret_conf? | |
ProjectExists project ?repo_path? | |
GetIDECommand proj_conf | |
findFiles basedir pattern | |
IsInList element list | |
IsCommitAncestor ancestor commit | |
FindCommonGitChild SHA1 SHA2 | |
moveElementToEnd inputList element | |
Detailed Description
Collection of Tcl functions used in Vivado/Quartus scripts.
Definition in file hog.tcl.
Function Documentation
◆ AddFile()
AddFile | file fileset | ||
◆ AddHogFiles()
AddHogFiles | libraries properties filesets | ||
◆ AddTopFile()
AddTopFile | top_module top_file sources | ||
Adds the file containing the top module to the project.
It automatically recognises whether it is in Vivado or Quartus mode
- Parameters
-
[in] top_module name of the top module, expected top_<project_name>
[in] top_file name of the file containing the top module [in] sources list of source files
◆ ALLOWED_PROPS()
◆ BinaryStepName()
BinaryStepName | part | ||
# Returns the step name for the stage that produces the binary file
Projects using Versal chips have a different step for producing the binary file, we use this function to take that into account
- Parameters
-
[out] 1 if it's Versal 0 if it's not [in] part The FPGA part
◆ CheckExtraFiles()
◆ CheckLatestHogRelease()
◆ CheckYmlRef()
CheckYmlRef | repo_path allow_failure | ||
◆ CompareLibDicts()
CompareLibDicts | proj_libs list_libs proj_sets list_sets proj_props list_props ?severity? ?outFile? ?extraFiles? | ||
Compare the contents of two dictionaries.
- Parameters
-
[in] proj_libs The dictionary of libraries in the project [in] list_libs The dictionary of libraries in list files [in] proj_sets The dictionary of filesets in the project [in] list_sets The dictionary of filesets in list files [in] proj_props The dictionary of file properties in the project [in] list_props The dictionary of file pproperties in list files [in] severity The severity of the message in case a file is not found (Default: CriticalWarning) [in] outFile The output log file, to write the messages (Default "") [in] extraFiles The dictionary of extra files generated a creation time (Default "")
- Returns
- n_diffs The number of differences
- extra_files Remaining list of extra files
◆ CompareVersions()
CompareVersions | ver1 ver2 | ||
Compare two semantic versions.
- Parameters
-
[in] ver1 a list of 3 numbers M m p [in] ver2 a list of 3 numbers M m p
In case the ver1 or ver2 are in the vormat vX.Y.Z rather than a list, they will be converted. If one of the tags is an empty string it will be considered as 0.0.0
- Returns
- Return 1 ver1 is greather than ver2, 0 if they are equal, and -1 if ver2 is greater than ver1
◆ CompareVHDL()
CompareVHDL | file1 file2 | ||
◆ Copy()
◆ CopyIPbusXMLs()
CopyIPbusXMLs | proj_dir path dst ?xml_version? ?xml_sha? ?generate? | ||
Read a XML list file and copy files to destination.
Additional information is provided with text separated from the file name with one or more spaces
- Parameters
-
[in] proj_dir project path, path containing the ./list directory containing at least a list file with .ipb extention [in] path the path the XML files are referred to in the list file [in] dst the path the XML files must be copied to [in] xml_version the M.m.p version to be used to replace the VERSION placeholder in any of the xml files [in] xml_sha the Git-SHA to be used to replace the GIT_SHA placeholder in any of the xml files [in] generate if set to 1, tells the function to generate the VHDL decode address files rather than check them
◆ CreateFileSet()
CreateFileSet | fileset | ||
◆ DictGet()
DictGet | dictName keyName ?default? | ||
◆ DoxygenVersion()
DoxygenVersion | target_version | ||
◆ eos()
eos | command ?attempt? | ||
Handle eos commands.
It can be used with lassign like this: lassign [eos <eos command> ] ret result
- Parameters
-
[in] command the EOS command to be run, e.g. ls, cp, mv, rm [in] attempt (default 0) how many times the command should be attempted in case of failure
- Returns
- a list of 2 elements: the return value (0 if no error occurred) and the output of the EOS command
◆ Execute()
Execute | args | ||
◆ ExecuteRet()
ExecuteRet | args | ||
◆ ExtractVersionFromTag()
ExtractVersionFromTag | tag | ||
◆ FileCommitted()
FileCommitted | File | ||
◆ FindCommonGitChild()
◆ findFiles()
◆ FindFileType()
◆ FindNewestVersion()
◆ FindVhdlVersion()
FindVhdlVersion | file_name | ||
◆ ForceUpToDate()
ForceUpToDate |
◆ FormatGeneric()
FormatGeneric | generic | ||
◆ GenerateQsysSystem()
GenerateQsysSystem | qsysFile commandOpts | ||
Function used to generate a qsys system from a .qsys file. The procedure adds the generated IPs to the project.
- Parameters
-
[in] qsysFile the Intel Platform Designed file (.qsys), containing the system to be generated [in] commandOpts the command options to be used during system generation as they are in qsys-generate options
◆ GetConfFiles()
GetConfFiles | proj_dir | ||
Get the configuration files to create a vivado/quartus project
- Parameters
-
[in] proj_dir The project directory containing the conf file or the the tcl file
- Returns
- [in] a list containing the full path of the hog.conf, sim.conf, pre-creation.tcl, post-creation.tcl and proj.tcl files
◆ GetCustomCommands()
◆ GetDateAndTime()
GetDateAndTime | commit | ||
◆ GetFile()
GetFile | file | ||
Gets a list of files contained in the current project that match a file name (passed as parameter)
The file name is matched against the input parameter. IF no parameter if passed returns a list of all files in the project
- Parameters
-
[in] file name (or part of it)
- Returns
- a list of files matching the parameter
◆ GetFileGenerics()
◆ GetFileList()
GetFileList | FILE path | ||
Recursively gets file names from list file.
If the list file contains files with extension .src .sim .con, it will recursively open them
- Parameters
-
[in] FILE list file to open [in] path the path the files are referred to in the list file
- Returns
- a list of the files contained in the list file
◆ GetFileSet()
GetFileSet | fileset | ||
Retrieves a fileset.
Gets a list of filesets in the current project that match a specified search pattern. The default command gets a list of all filesets in the project.
- Parameters
-
[in] fileset the name to be checked
- Returns
- a list of filesets in the current project that match the specified search pattern.
◆ GetGenericFromConf()
GetGenericFromConf | proj_dir target ?sim? | ||
◆ GetGroupName()
GetGroupName | proj_dir repo_dir | ||
◆ GetHashLib()
GetHashLib | lib | ||
◆ GetHogDescribe()
GetHogDescribe | sha ?repo_path? | ||
◆ GetHogFiles()
GetHogFiles | args | ||
Extract files, libraries and properties from the project's list files.
- Parameters
-
[in] args The arguments are <list_path> <repository path>[options] - list_path path to the list file directory Options:
- -list_files <List files> the file wildcard, if not specified all Hog list files will be looked for
- -sha_mode forwarded to ReadListFile, see there for info
- -ext_path <external path> path for external libraries forwarded to ReadListFile
- Returns
- a list of 3 dictionaries: libraries and properties
- libraries has library name as keys and a list of filenames as values
- properties has as file names as keys and a list of properties as values
- filesets has filset name as keys and the correspondent list of libraries as values (significant only for simulations)
◆ GetIDECommand()
◆ GetIDEFromConf()
GetIDEFromConf | conf_file | ||
◆ GetIDEVersion()
GetIDEVersion |
◆ GetLinkedFile()
GetLinkedFile | link_file | ||
◆ GetMaxThreads()
GetMaxThreads | proj_dir | ||
◆ GetModifiedFiles()
GetModifiedFiles | ?repo_path? ?pattern? | ||
◆ GetOptions()
◆ GetProject()
GetProject | proj | ||
◆ GetProjectFiles()
GetProjectFiles |
@ brief Returns a list of 2 dictionaries: libraries and properties
- libraries has library name as keys and a list of filenames as values
- properties has as file names as keys and a list of properties as values
Files, libraries and properties are extracted from the current Vivado project
- Returns
- a list of two elements. The first element is a dictionary containing all libraries. The second elements is a discretionary containing all properties
◆ GetProjectFlavour()
GetProjectFlavour | proj_name | ||
◆ GetProjectVersion()
GetProjectVersion | proj_dir repo_path ?ext_path? ?sim? | ||
Get the project version
- Parameters
-
[in] proj_dir The top folder of the project of which all the version must be calculated [in] repo_path The top folder of the repository [in] ext_path path for external libraries [in] sim if enabled, check the version also for the simulation files
- Returns
- returns the project version
◆ GetProperty()
GetProperty | property object | ||
Retrieves the value of a property of an object.
It automatically recognises whether it is in Vivado or Quartus mode
- Parameters
-
[in] property the name of the property to be retrieved [in] object the object from which to retrieve the property
- Returns
- the value of object.property
◆ GetRepoPath()
GetRepoPath |
◆ GetRepoVersions()
GetRepoVersions | proj_dir repo_path ?ext_path? ?sim? | ||
Get the versions for all libraries, submodules, etc. for a given project
- Parameters
-
[in] proj_dir The project directory containing the conf file or the the tcl file [in] repo_path top path of the repository [in] ext_path path for external libraries [in] sim if enabled, check the version also for the simulation files
- Returns
- a list containing all the versions: global, top (hog.conf, pre and post tcl scrpts, etc.), constraints, libraries, submodules, external, ipbus xml, user ip repos
◆ GetRun()
GetRun | run | ||
Gets a list of synthesis and implementation runs in the current project that match a run (passed as parameter)
The run name is matched against the input parameter
- Parameters
-
[in] run the run identifier
- Returns
- a list of synthesis and implementation runs matching the parameter
◆ GetSHA()
GetSHA | ?path? | ||
◆ GetSimulators()
◆ GetSubmodule()
GetSubmodule | path_file | ||
◆ GetTopFile()
◆ GetTopModule()
◆ GetVer()
GetVer | path ?force_develop? | ||
◆ GetVerFromSHA()
GetVerFromSHA | SHA repo_path ?force_develop? | ||
Get git version and commit hash of a specific commit give the SHA.
- Parameters
-
[in] SHA the git SHA of the commit [in] repo_path the path of the repository, this is used to open the Top/repo.conf file [in] force_develop Force a tag for the develop branch (increase m)
- Returns
- a list: the git SHA, the version in hex format
◆ GetVerilogGenerics()
GetVerilogGenerics | file | ||
◆ GetVhdlGenerics()
GetVhdlGenerics | file ?entity? | ||
◆ Git()
Git | command ?files? | ||
Handle git commands.
- Parameters
-
[in] command the git command to be run including refs (branch, tags, sha, etc.), except files. [in] files files given to git as argument. They will always be separated with – to avoid weird accidents
- Returns
- the output of the git command
◆ GitRet()
GitRet | command ?files? | ||
Handle git commands without causing an error if ret is not 0.
It can be used with lassign like this: lassign [GitRet <git command> <possibly files> ] ret result
- Parameters
-
[in] command the git command to be run including refs (branch, tags, sha, etc.), except files. [in] files files given to git as argument. They will always be separated with – to avoid weird accidents Sometimes you need to remove the –. To do that just set files to " "
- Returns
- a list of 2 elements: the return value (0 if no error occurred) and the output of the git command
◆ GitVersion()
GitVersion | target_version | ||
◆ HandleIP()
HandleIP | what_to_do xci_file ip_path repo_path ?gen_dir? ?force? | ||
Copy IP generated files from/to a remote o local direcotry (possibly EOS)
- Parameters
-
[in] what_to_do can be "push", if you want to copy the local IP synth result to the remote direcyory or "pull" if you want to copy the files from thre remote directory to your local repository [in] xci_file the .xci file of the IP you want to handle [in] ip_path the path of the directory you want the IP to be saved (possibly EOS) [in] repo_path the main path of your repository [in] gen_dir the directory where generated files are placed, by default the files are placed in the same folder as the .xci [in] force if not set to 0, will copy the IP to the remote directory even if it is already present
◆ HexVersionToString()
HexVersionToString | version | ||
◆ InitLauncher()
◆ IsCommitAncestor()
◆ IsInList()
◆ IsISE()
◆ IsLibero()
◆ IsQuartus()
◆ IsRelativePath()
IsRelativePath | path | ||
◆ IsSynplify()
◆ IsTclsh()
◆ IsVersal()
IsVersal | part | ||
◆ IsVivado()
◆ IsXilinx()
◆ IsZynq()
IsZynq | part | ||
◆ ListProjects()
◆ Logo()
◆ Md5Sum()
Md5Sum | file_name | ||
◆ MergeDict()
MergeDict | dict0 dict1 | ||
◆ Mkdir()
◆ moveElementToEnd()
◆ Msg()
◆ MsgAndLog()
MsgAndLog | msg ?severity? ?outFile? | ||
◆ OS()
◆ ParseFirstLineHogFiles()
ParseFirstLineHogFiles | list_path list_file | ||
Parse possible commands in the first line of Hog files (e.g. #Vivado, #Simulator, etc)
- Parameters
-
[in] list_path path to the list file directory [in] list_file the list file name
- Returns
- a string with the first-line command
- libraries has library name as keys and a list of filenames as values
- properties has as file names as keys and a list of properties as values
◆ ParseJSON()
ParseJSON | JSON_FILE JSON_KEY | ||
◆ ProjectExists()
◆ ReadConf()
ReadConf | file_name | ||
◆ ReadExtraFileList()
ReadExtraFileList | extra_file_name | ||
◆ ReadListFile()
ReadListFile | args | ||
Read a list file and adds the files to Vivado/Quartus, adding the additional information as file type.
Additional information is provided with text separated from the file name with one or more spaces
- Parameters
-
[in] args The arguments are <list_file> <path> [options] - list_file file containing vhdl list with optional properties
- path path the vhdl file are referred to in the list file Options:
- -lib <library> name of the library files will be added to, if not given will be extracted from the file name
- -sha_mode if not set to 0, the list files will be added as well and the IPs will be added to the file rather than to the special ip library. The sha mode should be used when you use the lists to calculate the git SHA, rather than to add the files to the project.
- Returns
- a list of 3 dictionaries: "libraries" has library name as keys and a list of filenames as values, "properties" has as file names as keys and a list of properties as values, "filesets" has fileset name as keys and the list of associated libraries as values.
◆ Relative()
Relative | base dst | ||
◆ RelativeLocal()
RelativeLocal | pathName filePath | ||
◆ RemoveDuplicates()
RemoveDuplicates | mydict | ||
◆ RemoveEmptyKeys()
◆ ResetRepoFiles()
ResetRepoFiles | reset_file | ||
◆ RestoreModifiedFiles()
RestoreModifiedFiles | ?repo_path? ?pattern? | ||
◆ SearchHogProjects()
SearchHogProjects | dir | ||
◆ SetGenericsSimulation()
SetGenericsSimulation | repo_path proj_dir target | ||
Sets the generics in all the sim.conf simulation file sets.
- Parameters
-
[in] repo_path the top folder of the projectThe path to the main git repository [in] proj_dir the top folder of the project [in] target software target(vivado, questa) defines the output format of the string
◆ SetParameter()
SetParameter | parameter value | ||
◆ SetProperty()
SetProperty | property value object | ||
◆ SetTopProperty()
SetTopProperty | top_module sources | ||
◆ WriteConf()
WriteConf | file_name config ?comment? | ||
◆ WriteGenerics()
WriteGenerics | mode repo_path design date timee commit version top_hash top_ver hog_hash hog_ver cons_ver cons_hash libs vers hashes ext_names ext_hashes user_ip_repos user_ip_vers user_ip_hashes flavour ?xml_ver? ?xml_hash? | ||
◆ WriteGitLabCIYAML()
WriteGitLabCIYAML | proj_name ?ci_conf? | ||
◆ WriteListFiles()
◆ WriteSimListFiles()
◆ WriteToFile()
WriteToFile | File msg | ||
◆ WriteUtilizationSummary()
WriteUtilizationSummary | input output project_name run | ||