generated from maddiebusig/vivado-template-hog
Compare commits
5 Commits
a6e86c8f3c
...
51f3102fae
| Author | SHA1 | Date | |
|---|---|---|---|
| 51f3102fae | |||
| 68c9947d1a | |||
| 712206a524 | |||
| 913af7a46a | |||
| 600eebbd11 |
@ -12,8 +12,13 @@ PORTS=s_axi_awaddr s_axi_awprot s_axi_awvalid s_axi_awready s_axi_wdata s_axi_ws
|
|||||||
|
|
||||||
[interface.s_axi_aclk]
|
[interface.s_axi_aclk]
|
||||||
INTERFACE=xilinx.com:signal:clock_rtl:1.0
|
INTERFACE=xilinx.com:signal:clock_rtl:1.0
|
||||||
INFER=true
|
ENABLEMENT_DEPENDENCY
|
||||||
PORTS=s_axi_aclk
|
INFER=false
|
||||||
|
MODE=slave
|
||||||
|
PORT.CLK=s_axi_aclk
|
||||||
|
PARAMETER.FREQ_HZ=100000000
|
||||||
|
PARAMETER.ASSOCIATED_RESET=s_axi_aresetn
|
||||||
|
PARAMETER.ASSOCIATED_BUSIF=s_axi
|
||||||
|
|
||||||
[interface.s_axi_aresetn]
|
[interface.s_axi_aresetn]
|
||||||
INTERFACE=xilinx.com:signal:reset_rtl:1.0
|
INTERFACE=xilinx.com:signal:reset_rtl:1.0
|
||||||
|
|||||||
@ -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
|
# Parse the interface configuration and create a new interface
|
||||||
# in the current core
|
# in the current core
|
||||||
#
|
#
|
||||||
@ -8,13 +40,15 @@
|
|||||||
proc ParseInterfaceConf { iface_name iface_conf } {
|
proc ParseInterfaceConf { iface_name iface_conf } {
|
||||||
puts "Parsing interface $iface_name"
|
puts "Parsing interface $iface_name"
|
||||||
|
|
||||||
set iface_protocol [dict get $iface_conf "INTERFACE"]
|
set iface_abstraction [dict get $iface_conf "INTERFACE"]
|
||||||
variable infer false
|
variable infer false
|
||||||
|
|
||||||
if { [dict exists $iface_conf "INFER"] } {
|
if { [dict exists $iface_conf "INFER"] } {
|
||||||
set infer [dict get $iface_conf "INFER"]
|
set infer [dict get $iface_conf "INFER"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Creating interface object
|
||||||
|
|
||||||
if { $infer } {
|
if { $infer } {
|
||||||
puts "Inferring interface"
|
puts "Inferring interface"
|
||||||
|
|
||||||
@ -22,7 +56,7 @@ proc ParseInterfaceConf { iface_name iface_conf } {
|
|||||||
|
|
||||||
puts "Using ports: $ports"
|
puts "Using ports: $ports"
|
||||||
|
|
||||||
set result [ipx::infer_bus_interface $ports $iface_protocol [ipx::current_core]]
|
set result [ipx::infer_bus_interface $ports $iface_abstraction [ipx::current_core]]
|
||||||
|
|
||||||
# Inferred name could differ from the desired name, so set it
|
# Inferred name could differ from the desired name, so set it
|
||||||
set inferred_name [lindex $result 2]
|
set inferred_name [lindex $result 2]
|
||||||
@ -30,6 +64,64 @@ proc ParseInterfaceConf { iface_name iface_conf } {
|
|||||||
set_property NAME $iface_name $created_iface
|
set_property NAME $iface_name $created_iface
|
||||||
} else {
|
} else {
|
||||||
puts "Manually creating interface"
|
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