2012年4月12日木曜日

QuartusII システムコンソール Dashboard

システムコンソールのGUI機能、Dashboardの習得のため、DailとTimeChartで、FPGA内に作った32bit Timerカウンタを読みだして表示させてみました。

 Dashboardでは、これ以外にも Label, Text, Button, checkBox, LED, ComboBox, Table, BarChart, LineChart, PiChartなどが使えます。



システムコンソール Dashboard

上記Dashboardの表示Tabに関するTclは下記

namespace eval i2c_Control {

variable dash [add_service dashboard i2c_Control "I2C Control" "Tools/Dashboard"]

dashboard_set_property $dash self developmentMode true
dashboard_set_property $dash self itemsPerRow 1


# count g2 
proc count_g2 {group_name} {


variable dash
variable g2_cnt_val
variable g2_cnt_en


#  Timer read and display dail and chart
if { $g2_cnt_en } {


   set mast [lindex [get_service_paths master] 0]


   open_service master $mast


 # 0x40番地の32bit Timer counterをリードし、g2_cnt_valにセット    
   set g2_cnt_val [master_read_32 $mast 0x040 1]


  # dialへの読み取ったカウント値のセット
   dashboard_set_property $dash $group_name.dial value [expr ($g2_cnt_val /10000000)]
  # timechartへの読み取ったカウント値のセット
   dashboard_set_property $dash $group_name.tchart latest [expr ($g2_cnt_val /1000000)]

   after 1000 i2c_Control::count_g2 $group_name
   }
 }


# gen_group2 


proc gen_group2 { { group_name "myTab.g2" } } {
variable dash


dashboard_add $dash $group_name  group myTab
dashboard_set_property $dash $group_name itemsPerRow 1


# dial
dashboard_add $dash $group_name.dial dial $group_name
dashboard_set_property $dash $group_name.dial title "Dial_fpga"
dashboard_set_property $dash $group_name.dial min 0
dashboard_set_property $dash $group_name.dial max 440
dashboard_set_property $dash $group_name.dial preferredWidth 300
dashboard_set_property $dash $group_name.dial preferredHeight 300
dashboard_set_property $dash $group_name.dial value 0
  
# timechart
dashboard_add $dash $group_name.tchart timeChart $group_name
dashboard_set_property $dash $group_name.tchart title "Time chart"
dashboard_set_property $dash $group_name.tchart preferredWidth 800
dashboard_set_property $dash $group_name.tchart labelX "Time"
dashboard_set_property $dash $group_name.tchart labelY "Counter value"
dashboard_set_property $dash $group_name.tchart latest 0
  
# button to start the counter
dashboard_add $dash $group_name.bstart button $group_name
dashboard_set_property $dash $group_name.bstart text "Start counter"
dashboard_set_property $dash $group_name.bstart onClick  "set i2c_Control::g2_cnt_en 1; dashboard_set_property $dash  $group_name.bstart enabled false; dashboard_set_property $dash  $group_name.bstop enabled true; i2c_Control::count_g2  $group_name"
 
# button to stop the counter
dashboard_add $dash $group_name.bstop button $group_name
dashboard_set_property $dash $group_name.bstop text "Stop counter"
dashboard_set_property $dash $group_name.bstop enabled false
dashboard_set_property $dash $group_name.bstop onClick   "set i2c_Control::g2_cnt_en 0; dashboard_set_property $dash  $group_name.bstart enabled true; dashboard_set_property $dash  $group_name.bstop enabled false"
}

# tabbedGroup


dashboard_add $dash myTab tabbedGroup self
dashboard_set_property $dash myTab preferredWidth 1024
dashboard_set_property $dash myTab preferredHeight 700


# Create Grourps


gen_group1 "Dial"
gen_group2 "Counter_fpga"
#gen_group3 "I2C_Control"
}

0 件のコメント:

コメントを投稿