Create your custom analysis graphs in less than 10 lines of scripting.

0 views
Skip to first unread message

AchimNohl

unread,
Mar 1, 2010, 4:37:10 AM3/1/10
to Virtual Platform-Users
VPA fully supports TCL and TK as well as the very useful BLT library
(http://blt.sourceforge.net/). Within a few lines you can create your
own graphs, barcharts etc. Below you find the few steps that are
needed to create a graph that traces e.g. the FIFO length of the
receive FIFO within the ethernet adapter. All in all 9 l

#Create your graph (in 3 command lines):

# Create a new window in the VPA
viewpane .myWindow
# Create a graph using the BLT librray inside your new window
blt::graph .myWindow.myGraph -title "My Graph"
# Make your graph visible
pack .myWindow.myGraph


#Create your data vectors (another 3 lines):

# BLT vectors are a good choice when the to record large data sets
# Vector for the x data
blt::vector x
# Vector for the y data
blt::vector y
# Bind vectors to the graph
.myWindow.myGraph element create myGraph0 -xdata x -ydata y -pixels 1


#Populate your graph with data (another 3 lines):

# You can use breakpoints and callbacks to add data to your graphs
[i_SMC91C111/mReceiveFifoLen create_watchpoint] set_callback
"myTraceX;myTraceY"

# To add the current time in NS to the vector:
proc myTraceX {} { x append [expr [vpa::get_current_time] /1000] }

# To add e.g. the receive length of the Ethernet adaptor to the FIFO:
proc myTraceY {} { y append [i_SMC91C111/mReceiveFifoLen
get_value ] }

#Done.
# If you want to allow zooming just add another 2 lines:

Blt_ZoomStack .myWindow.myGraph
Blt_Crosshairs .myWindow.myGraph

Best regards,
Achim

Reply all
Reply to author
Forward
0 new messages