10 if { [
catch {
exec which sigasi-cli}] } {
11 puts "sigasi-cli not available -- check sigasi-cli is in PATH"
14 if { [
catch {
exec -- sigasi-cli --license}] } {
15 puts "check SIGASI_LM_LICENSE_FILE is set"
21 proc sigasi-export {} {
26 Msg Info "Creating Sigasi CSV files for project $project_name..."
27 set proj_dir $repo_path/Top/$project_name
28 set proj_list_dir $repo_path/Top/$project_name/list
29 set project [
file tail $project_name]
30 lassign [
GetHogFiles -list_files {.src} $proj_list_dir $repo_path] libraries
31 set csv_file [open "sigasi_$project.csv" w]
32 foreach lib $libraries {
33 set source_files [
DictGet $libraries $lib]
34 foreach source_file $source_files {
36 [
file extension $source_file] eq ".vhd"
37 || [
file extension $source_file] eq ".vhdl"
38 || [
file extension $source_file] eq ".sv"
39 || [
file extension $source_file] eq ".v"
41 puts $csv_file [
concat [
file rootname $lib] "," $source_file]
45 lassign [
GetHogFiles -list_files ".sim" $proj_list_dir $repo_path] \
47 foreach lib $listSimLibraries {
48 set source_files [
DictGet $listSimLibraries $lib]
49 foreach source_file $source_files {
51 [
file extension $source_file] eq ".vhd"
52 || [
file extension $source_file] eq ".vhdl"
53 || [
file extension $source_file] eq ".sv"
54 || [
file extension $source_file] eq ".v"
56 puts $csv_file [
concat [
file rootname $lib] "," $source_file]
61 Msg Info "Sigasi CSV file created: sigasi_$project.csv"
62 Msg Info "You can use the python script provided by Sigasi to convert the generated csv file into a Sigasi project."
65 https://www.sigasi.com/knowledge/how_tos/generating-sigasi-project-vivado-project/#2-generate-the-sigasi-project-files-from-the-csv-file"
76 Msg Info "Generating a code quality report for project $project_name..."
80 file mkdir $repo_path/sigasi_lint
81 set outfile "$repo_path/sigasi_lint/$project_name"
82 set repo_conf $repo_path/Top/repo.conf
85 if {[
file exists $repo_conf]} {
87 if {[dict exists $PROPERTIES sigasi]} {
88 set sigasiDict [dict get $PROPERTIES sigasi]
89 if {[dict exists $sigasiDict LIBRARY_DATABASE]} {
90 set libraries [dict get $sigasiDict LIBRARY_DATABASE]
91 foreach lib [
split $libraries ,] {
92 lappend options_list "--library-database=[
string trim $lib]"
95 if {[dict exists $sigasiDict REPORT_FORMAT]} {
96 set report_format [dict get $sigasiDict REPORT_FORMAT]
97 lappend options_list "--$report_format"
99 if { $report_format == "json" || $report_format == "sonarqube" } {
101 }
elseif { $report_format == "warnings-ng" } {
112 if {[dict exists $sigasiDict REPORT_ABSOLUTE]} {
113 lappend options_list "--absolute"
115 if {[dict exists $sigasiDict REPORT_SUPPRESSED]} {
116 lappend options_list "--include-suppressed"
118 if {[dict exists $sigasiDict FAIL]} {
119 lappend options_list "--fail-on-[dict get $sigasiDict FAIL]"
124 lappend options_list "--out=$outfile$filetype"
126 puts "sigasi-cli verify $repo_path $options_list "
127 if { [
catch {
exec -- sigasi-cli verify $repo_path {*}$options_list}] } {
128 Msg Error "sigasi-cli verify failed - please review $outfile$filetype for issues"
132 Msg Info "Despite passing there maybe minor code violations caught. See $outfile$filetype"
136 proc sigasi-format {} {
142 Msg Info "Formatting VHDL files for project $project_name ..."
146 set keywords "lowercase"
147 set repo_conf $repo_path/Top/repo.conf
151 if {[
file exists $repo_conf]} {
152 set PROPERTIES [
ReadConf $repo_conf]
153 if {[dict exists $PROPERTIES sigasi]} {
154 set sigasiDict [dict get $PROPERTIES sigasi]
155 if {[dict exists $sigasiDict TABS]} {
156 lappend options_list ""
158 lappend options_list "--spaces-for-tabs"
160 if {[dict exists $sigasiDict PRESERVE_NEWLINES]} {
161 lappend options_list "--preserve-newlines"
163 if {[dict exists $sigasiDict NO_ALIGN]} {
164 lappend options_list "--no-align"
166 if {[dict exists $sigasiDict VHDL_VERSION]} {
167 lappend options_list "--vhdl-version=[dict get $sigasiDict VHDL_VERSION]"
169 if {[dict exists $sigasiDict TAB_WIDTH]} {
170 set tab_width [dict get $sigasiDict TAB_WIDTH]
172 if {[dict exists $sigasiDict KEYWORDS]} {
173 set keywords [dict get $sigasiDict KEYWORDS]
175 if {[dict exists $sigasiDict IGNORE_DIR]} {
176 set ignore [dict get $sigasiDict IGNORE_DIR]
177 foreach dir [
split $ignore ,] {
178 lappend ignore_list "$repo_path/[
string trim $dir]"
184 set proj_dir $repo_path/Top/$project_name
185 set proj_list_dir $repo_path/Top/$project_name/list
186 set project [
file tail $project_name]
188 lassign [
GetHogFiles -list_files {.src} $proj_list_dir $repo_path] libraries
189 lappend [
GetHogFiles -list_files ".sim" $proj_list_dir $repo_path] libraries
191 foreach lib $libraries {
192 set source_files [
DictGet $libraries $lib]
194 foreach source_file $source_files {
196 foreach dir $ignore_list {
197 if { [
string match $dir* $source_file] } {
202 puts "skipping $source_file due to IGNORE_DIR setting"
204 if {[
file extension $source_file] == ".vhd" ||
205 [
file extension $source_file] == ".vhdl" } {
206 puts "sigasi-cli format $options_list --keywords=$keywords --tab-width=$tab_width $source_file"
207 exec -- sigasi-cli format {*}$options_list --keywords=$keywords --tab-width=$tab_width $source_file
215 proc sigasi-document {} {
221 Msg Info "Generating project documentation for $project_name..."
224 set outdir "$repo_path/sigasi_doc/$project_name"
225 set repo_conf $repo_path/Top/repo.conf
226 set project_conf $repo_path/Top/$project_name/hog.conf
229 if {[
file exists $project_conf]} {
230 set PROJ_PROPS [
ReadConf $project_conf]
231 if {[dict exists $PROJ_PROPS sigasi]} {
232 set sigasiDict [dict get $PROJ_PROPS sigasi]
233 if {[dict exists $sigasiDict TOP_LEVEL]} {
234 lappend options_list "--top-level=[dict get $sigasiDict TOP_LEVEL]"
240 if {[
file exists $repo_conf]} {
241 set PROPERTIES [
ReadConf $repo_conf]
242 if {[dict exists $PROPERTIES sigasi]} {
243 set sigasiDict [dict get $PROPERTIES sigasi]
244 if {[dict exists $sigasiDict LIBRARY_DATABASE]} {
245 set libraries [dict get $sigasiDict LIBRARY_DATABASE]
246 foreach lib [
split $libraries ,] {
247 lappend options_list "--library-database=[
string trim $lib]"
254 if {[dict exists $sigasiDict DIAGRAM_NODE_LIMIT]} {
255 lappend options_list "--diagram-node-limit=[dict get $sigasiDict DIAGRAM_NODE_LIMIT]"
257 if {[dict exists $sigasiDict DESIGN_UNITS_PER_PAGE]} {
258 lappend options_list "--design-units-per-page=[dict get $sigasiDict DESIGN_UNITS_PER_PAGE]"
260 if {[dict exists $sigasiDict DIAGRAMS]} {
261 lappend options_list "--diagrams=[dict get $sigasiDict DIAGRAMS]"
263 if { $proj_top == 0} {
264 if {[dict exists $sigasiDict TOP_LEVEL]} {
265 lappend options_list "--top-level=[dict get $sigasiDict TOP_LEVEL]"
270 lappend options_list "--output-directory=$outdir"
272 puts "sigasi-cli document $repo_path $options_list "
274 set results [exec -- sigasi-cli document $repo_path {*}$options_list 2>@1 ]
276 } trap CHILDSTATUS {results} {
277 Msg Error "Generation of documentation has failed. Please debug sigasi command outside of HOG"
280 Msg Info "Documentation successfully saved to $outdir"