-
Notifications
You must be signed in to change notification settings - Fork 0
/
system_bd.tcl
53 lines (46 loc) · 1.81 KB
/
system_bd.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
set design_name system
set errMsg ""
set nRet 0
set cur_design [current_bd_design -quiet]
set list_cells [get_bd_cells -quiet]
if { $design_name eq "" } {
set errMsg "ERROR: Please set the variable <design_name> to a non-empty value."
set nRet 1
} elseif { $cur_design ne "" } {
if { $list_cells eq "" || $cur_design eq $design_name } {
puts "INFO: Constructing design in IPI design <$cur_design>..."
if { $list_cells eq "" } {
puts "INFO: Changing value of <design_name> from <$design_name> to <$cur_design> since current design is empty."
set design_name [get_property NAME $cur_design]
} else {
set errMsg "ERROR: Design <$design_name> already exists in your project, please set the variable <design_name> to another value."
set nRet 1
}
}
} elseif { [get_files -quiet ${design_name}.bd] ne "" } {
set errMsg "ERROR: Design <$design_name> already exists in your project, please set the variable <design_name> to another value."
set nRet 2
} else {
puts "INFO: Currently there is no design <$design_name> in project, so creating one..."
create_bd_design $design_name
puts "INFO: Making design <$design_name> as current_bd_design."
current_bd_design $design_name
}
puts "INFO: Currently the variable <design_name> is equal to \"$design_name\"."
if { $nRet != 0 } {
puts $errMsg
return $nRet
}
proc create_root_design { parentCell } {
set parentCell [expr {$parentCell eq "" ? [get_bd_cells /] : $parentCell}]
set parentObj [get_bd_cells $parentCell]
if { $parentObj eq "" } {
puts "ERROR: Unable to find parent cell <$parentCell>!"
return
}
if { [get_property TYPE $parentObj] ne "hier" } {
puts "ERROR: Parent <$parentObj> has TYPE = <$parentType>. Expected to be <hier>."
return
}
current_bd_instance $parentObj
}