generated from maddiebusig/vivado-template-hog
Partially implement manual IP configuration, user parameter config
This commit is contained in:
parent
600eebbd11
commit
913af7a46a
@ -1,3 +1,35 @@
|
||||
proc DictValueOr { dict key default } {
|
||||
if { [dict exists $dict $key] } {
|
||||
return [dict get $dict $key]
|
||||
} else {
|
||||
return default
|
||||
}
|
||||
}
|
||||
|
||||
# Returns the value after in the string after startword and a delimiter
|
||||
#
|
||||
# If the string's format does not match, returns empty string
|
||||
#
|
||||
# EX: [SplitSub foo.bar foo] => "bar"
|
||||
# EX: [SplitSub foo.biz foo] => "biz"
|
||||
# EX: [SplitSub foobar foo] => ""
|
||||
# EX: [SplitSub buz.bar foo] => ""
|
||||
proc SplitSub { str startword } {
|
||||
if { [string first $startword $str] == 0 } {
|
||||
set sepidx [string first "." "$str"]
|
||||
|
||||
if { $sepidx == -1 } {
|
||||
return ""
|
||||
}
|
||||
|
||||
set val [string range "$str" [expr $sepidx + 1] [string length "$str"]]
|
||||
|
||||
return $val
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
# Parse the interface configuration and create a new interface
|
||||
# in the current core
|
||||
#
|
||||
@ -15,6 +47,8 @@ proc ParseInterfaceConf { iface_name iface_conf } {
|
||||
set infer [dict get $iface_conf "INFER"]
|
||||
}
|
||||
|
||||
# Creating interface object
|
||||
|
||||
if { $infer } {
|
||||
puts "Inferring interface"
|
||||
|
||||
@ -30,6 +64,41 @@ proc ParseInterfaceConf { iface_name iface_conf } {
|
||||
set_property NAME $iface_name $created_iface
|
||||
} else {
|
||||
puts "Manually creating interface"
|
||||
|
||||
ipx::add_bus_interface $iface_name [ipx::current_core]
|
||||
|
||||
set created_iface [ipx::get_bus_interfaces $iface_name -of_objects [ipx::current_core]]
|
||||
|
||||
set_property ABSTRACTION_TYPE_VLNV $iface_protocol $created_iface
|
||||
set_property BUS_TYPE_VLNV $iface_protocol $created_iface
|
||||
}
|
||||
|
||||
set iface [ipx::get_bus_interfaces $iface_name -of_objects [ipx::current_core]]
|
||||
|
||||
# Set interface properties
|
||||
set_property DESCRIPTION [DictValueOr $iface_conf "DESCRIPTION" ""] $iface
|
||||
set_property DISPLAY_NAME [DictValueOr $iface_conf "DISPLAY_NAME" ""] $iface
|
||||
|
||||
# If no mode is explicitly specified, use the potentially inferred mode
|
||||
if { [dict exists $iface_conf "MODE"] } {
|
||||
set_property INTERFACE_MODE [dict get $iface_conf "MODE"] $iface
|
||||
}
|
||||
|
||||
# Create user parameters
|
||||
foreach {key val} $iface_conf {
|
||||
puts "Checking if $key is parameter"
|
||||
|
||||
set param_name [SplitSub $key "PARAMETER"]
|
||||
|
||||
if { $param_name == "" } {
|
||||
continue
|
||||
}
|
||||
|
||||
puts "Setting parameter $param_name"
|
||||
|
||||
ipx::add_bus_parameter $param_name $iface
|
||||
set param [ipx::get_bus_parameters $param_name -of_objects $iface]
|
||||
set_property value $val $param
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user