Commit e88fd10c authored by Jens Korinth's avatar Jens Korinth

VC709: Fix bug in LED plugin

parent 6c8a19dc
...@@ -35,24 +35,35 @@ namespace eval leds { ...@@ -35,24 +35,35 @@ namespace eval leds {
puts " WARNING: can only connect up to 6 LEDs, additional inputs will be discarded" puts " WARNING: can only connect up to 6 LEDs, additional inputs will be discarded"
} }
set rlist [list] set rlist [list]
# create tie-off constant zero
set zero [tapasco::createConstant one 1 0]
set zero_pin [get_bd_pins -of_objects $zero -filter {DIR == "O"}]
for {set i 0} {$i < 6 && [llength $inputs] > $i} {incr i} { for {set i 0} {$i < 6 && [llength $inputs] > $i} {incr i} {
set pin [lindex $inputs $i] set pin [lindex $inputs $i]
puts " LED $i: $pin" puts " LED $i: $pin"
lappend rlist [get_bd_pins $pin] set bd_pin [get_bd_pins $pin]
if {$bd_pin != {}} {
lappend rlist $bd_pin
} else {
lappend rlist $zero_pin
}
} }
if {[llength $inputs] < 6} { if {[llength $inputs] < 6} {
# create tie-off constant one
set one [tapasco::createConstant one 1 0]
set onepin [get_bd_pins -of_objects $one -filter {DIR == "O"}]
for {} {$i < 6} {incr i} { for {} {$i < 6} {incr i} {
lappend rlist $onepin lappend rlist $zero_pin
} }
} }
if {[lsearch rlist $zero_pin] == -1} {
# delete the constant
delete_bd_objs $zero
}
return $rlist return $rlist
} }
proc create_led_core {{name "gp_led"} {inputs [list]}} { proc create_led_core {{name "gp_led"} {inputs [list]}} {
variable vlnv variable vlnv
variable default_led_pins
puts "Creating LED core ..." puts "Creating LED core ..."
puts " VLNV: $vlnv" puts " VLNV: $vlnv"
if {[llength $inputs] == 0} { if {[llength $inputs] == 0} {
...@@ -82,7 +93,10 @@ namespace eval leds { ...@@ -82,7 +93,10 @@ namespace eval leds {
puts "Implementing Platform feature LED ..." puts "Implementing Platform feature LED ..."
# create and connect LED core # create and connect LED core
set const_one [tapasco::createConstant "const_one" 1 1] set const_one [tapasco::createConstant "const_one" 1 1]
set gp_led [create_led_core "gp_led" [dict get [tapasco::get_feature "LED"] "inputs"]] set f [tapasco::get_feature "LED"]
set inputs [list]
if {[dict exists $f "inputs"]} { set inputs [dict get $f "inputs"] }
set gp_led [create_led_core "gp_led" $inputs]
set pcie_aclk [get_bd_pins "/PCIe/pcie_aclk"] set pcie_aclk [get_bd_pins "/PCIe/pcie_aclk"]
set pcie_aresetn [get_bd_pins "/PCIe/pcie_aresetn"] set pcie_aresetn [get_bd_pins "/PCIe/pcie_aresetn"]
set pcie_aclk_net [get_bd_net -of_objects $pcie_aclk] set pcie_aclk_net [get_bd_net -of_objects $pcie_aclk]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment