generated from maddiebusig/vivado-template-hog
Compare commits
No commits in common. "51f3102faea9dd6acca185af6807ada2b700da89" and "a6e86c8f3c053bb0d956602f99302603c07958d3" have entirely different histories.
51f3102fae
...
a6e86c8f3c
@ -12,13 +12,8 @@ PORTS=s_axi_awaddr s_axi_awprot s_axi_awvalid s_axi_awready s_axi_wdata s_axi_ws
|
||||
|
||||
[interface.s_axi_aclk]
|
||||
INTERFACE=xilinx.com:signal:clock_rtl:1.0
|
||||
ENABLEMENT_DEPENDENCY
|
||||
INFER=false
|
||||
MODE=slave
|
||||
PORT.CLK=s_axi_aclk
|
||||
PARAMETER.FREQ_HZ=100000000
|
||||
PARAMETER.ASSOCIATED_RESET=s_axi_aresetn
|
||||
PARAMETER.ASSOCIATED_BUSIF=s_axi
|
||||
INFER=true
|
||||
PORTS=s_axi_aclk
|
||||
|
||||
[interface.s_axi_aresetn]
|
||||
INTERFACE=xilinx.com:signal:reset_rtl:1.0
|
||||
|
||||
@ -1,35 +1,3 @@
|
||||
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
|
||||
#
|
||||
@ -40,15 +8,13 @@ proc SplitSub { str startword } {
|
||||
proc ParseInterfaceConf { iface_name iface_conf } {
|
||||
puts "Parsing interface $iface_name"
|
||||
|
||||
set iface_abstraction [dict get $iface_conf "INTERFACE"]
|
||||
set iface_protocol [dict get $iface_conf "INTERFACE"]
|
||||
variable infer false
|
||||
|
||||
if { [dict exists $iface_conf "INFER"] } {
|
||||
set infer [dict get $iface_conf "INFER"]
|
||||
}
|
||||
|
||||
# Creating interface object
|
||||
|
||||
if { $infer } {
|
||||
puts "Inferring interface"
|
||||
|
||||
@ -56,7 +22,7 @@ proc ParseInterfaceConf { iface_name iface_conf } {
|
||||
|
||||
puts "Using ports: $ports"
|
||||
|
||||
set result [ipx::infer_bus_interface $ports $iface_abstraction [ipx::current_core]]
|
||||
set result [ipx::infer_bus_interface $ports $iface_protocol [ipx::current_core]]
|
||||
|
||||
# Inferred name could differ from the desired name, so set it
|
||||
set inferred_name [lindex $result 2]
|
||||
@ -64,64 +30,6 @@ 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_abstraction $created_iface
|
||||
|
||||
# We need to set BOTH the bus ABSTRACTION, and the bus TYPE.
|
||||
# The type can be obtained from the abstraction, so it is what
|
||||
# is provided in ip.conf. Vivado does not provide an easy way
|
||||
# to get one from the other, so we load the interface IP and
|
||||
# get it's property.
|
||||
set bus_abstraction [lindex [ipx::get_ipfiles -type busabs $iface_abstraction] 0]
|
||||
set bus_type_vlnv [get_property BUS_TYPE_VLNV $bus_abstraction]
|
||||
|
||||
set_property BUS_TYPE_VLNV $bus_type_vlnv $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 {
|
||||
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
|
||||
}
|
||||
|
||||
# Create port mappings
|
||||
foreach {key val} $iface_conf {
|
||||
set logical_port [SplitSub $key "PORT"]
|
||||
set physical_port $val
|
||||
|
||||
if { $logical_port == "" } {
|
||||
continue
|
||||
}
|
||||
|
||||
puts "Mapping logical port $logical_port"
|
||||
|
||||
ipx::add_port_map $logical_port $iface
|
||||
set port_map [ipx::get_port_maps $logical_port -of_objects $iface]
|
||||
set_property physical_name $physical_port $port_map
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user