Hog Hog2024.2-4
make_sigasi_csv.tcl
Go to the documentation of this file.
1 # Copyright 2018-2024 The University of Birmingham
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 # @file
16 # Create sigasi csv file
17 
18 set path [file normalize "[file dirname [info script]]/.."]
19 set old_path [pwd]
20 source $path/hog.tcl
21 
22 if { $::argc != 1} {
23  Msg Info "Usage: make_sigasi_csv <project name>"
24  exit 1
25 }
26 set project_name [lindex $argv 0]
27 set project_file [file normalize $path/../../Projects/$project_name/$project_name.xpr]
28 
29 if {[file exists $project_file]} {
30  Msg Info "Opening existing project file $project_file..."
31  open_project -quiet $project_file
32 } else {
33  Msg Info "Creating project: $project_name..."
34  source $path/../../Top/$project_name/$project_name.tcl
35 }
36 
37 #Simulation
38 set csv_name "${project_name}_sigasi_sim.csv"
39 #Create IPs here
40 Msg Info "Generating IP targets for simulations..."
41 foreach ip [get_ips] {
42  set targets [list_targets [get_files [file tail [get_property IP_FILE $ip]]]]
43  if { [ lsearch -exact $targets simulation] >= 0 } {
44  generate_target simulation $ip
45  } else {
46  Msg Warning "IP $ip is not a simulation target, skipping..."
47  }
48 }
49 
50 
51 
52 
53 
54 Msg Info "Creating sigasi csv file for simulation $csv_name..."
55 set source_files [get_files -filter {(FILE_TYPE == VHDL || FILE_TYPE == "VHDL 2008" || FILE_TYPE == VERILOG || FILE_TYPE == SYSTEMVERILOG) && USED_IN_SIMULATION == 1 } ]
56 set csv_file [open $old_path/$csv_name w]
57 foreach source_file $source_files {
58  puts $csv_file [ concat [ get_property LIBRARY $source_file ] "," $source_file ]
59 }
60 close $csv_file
61 
62 #Synthesis
63 set csv_name "${project_name}_sigasi_synth.csv"
64 Msg Info "Generating IP targets for synthesis..."
65 foreach ip [get_ips] {
66  generate_target synthesis $ip
67 }
68 
69 Msg Info "Creating sigasi csv file for synthesis $csv_name..."
70 set source_files [get_files -filter {(FILE_TYPE == VHDL || FILE_TYPE == "VHDL 2008" || FILE_TYPE == VERILOG || FILE_TYPE == SYSTEMVERILOG) && USED_IN_SYNTHESIS == 1 } ]
71 set csv_file [open $old_path/$csv_name w]
72 foreach source_file $source_files {
73  puts $csv_file [ concat [ get_property LIBRARY $source_file ] "," $source_file ]
74 }
75 close $csv_file