Implement interface inferring

This commit is contained in:
Madeline Busig 2025-11-10 19:50:08 -08:00
parent c2e6cec4e7
commit a6e86c8f3c

View File

@ -1,3 +1,38 @@
# Parse the interface configuration and create a new interface
# in the current core
#
# @param iface_name Name of the interface to crate
# @param iface_conf Dictionary containing the interface configuration, parsed
# from hog.tcl ReadConf
#
proc ParseInterfaceConf { iface_name iface_conf } {
puts "Parsing interface $iface_name"
set iface_protocol [dict get $iface_conf "INTERFACE"]
variable infer false
if { [dict exists $iface_conf "INFER"] } {
set infer [dict get $iface_conf "INFER"]
}
if { $infer } {
puts "Inferring interface"
set ports [split [dict get $iface_conf "PORTS"]]
puts "Using ports: $ports"
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]
set created_iface [ipx::get_bus_interfaces $inferred_name -of_objects [ipx::current_core]]
set_property NAME $iface_name $created_iface
} else {
puts "Manually creating interface"
}
}
set gitroot [exec git rev-parse --show-toplevel] set gitroot [exec git rev-parse --show-toplevel]
set hogroot "$gitroot/Hog" set hogroot "$gitroot/Hog"
@ -84,6 +119,19 @@ foreach param [ipx::get_user_parameters -of_objects [ipx::current_core]] {
ipx::remove_user_parameter $param_name [ipx::current_core] ipx::remove_user_parameter $param_name [ipx::current_core]
} }
puts "Parsing interfaces"
foreach {key val} $ip_conf {
if { [string first "interface" "$key"] == 0 } {
set sepidx [string first "." "$key"]
set iface_name [string range "$key" [expr $sepidx + 1] [string length "$key"]]
ParseInterfaceConf "$iface_name" $val
} else {
puts "$key is not an interface"
}
}
puts "Packaging IP" puts "Packaging IP"
# Increment revision # Increment revision