Download presentation
Presentation is loading. Please wait.
Published byCleopatra Townsend Modified over 9 years ago
1
Constructive Computer Architecture Tutorial 3 Debugging BSV Andy Wright 6.175 TA September12, 2014http://csg.csail.mit.edu/6.175T01-1
2
Review Last Tutorial: Scheduling Typeclasses Recent Lectures: SMIPS ISA September12, 2014L03-2http://csg.csail.mit.edu/6.175
3
Software Debugging Print Statements See a bug, not sure what causes it Add print statements Recompile Run Still see bug, but you have narrowed it down to a smaller portion of code Repeat with more print statements… Find bug, fix bug, and remove print statements September12, 2014L03-3http://csg.csail.mit.edu/6.175
4
BSV Debugging Display Statements See a bug, not sure what causes it Add display statements Recompile Run Still see bug, but you have narrowed it down to a smaller portion of code Repeat with more display statements… Find bug, fix bug, and remove display statements September12, 2014L03-4http://csg.csail.mit.edu/6.175
5
BSV Display Statements The $display() command is an action that prints statements to the simulation console Examples: $display(“Hello World!”); $display(“The value of x is %d”, x); $display(“The value of y is “, fshow(y)); September12, 2014L03-5http://csg.csail.mit.edu/6.175
6
Ways to Display Values Format Specifiers %d – decimal %b – binary %o – octal %h – hexadecimal %0d, %0b, %0o, %0h Show value without extra whitespace padding September12, 2014L03-6http://csg.csail.mit.edu/6.175
7
Ways to Display Values fshow fshow is a function in the FShow typeclass It can be derived for enumerations and structures Example: typedef emun {Red, Blue} Colors deriving(FShow); Color c = Red; $display(“c is “, fshow(c)); September12, 2014L03-7http://csg.csail.mit.edu/6.175 Prints “c is Red”
8
BSV Debugging Waveform Viewer Simulation executables can dump VCD waveforms./simMyTest –V test.vcd Produces test.vcd containing the values of all the signals used in the simulator Not the same as normal BSV signals VCD files can be viewed by a waveform viewer Such as gtkwave The signal names and values in test.vcd can be hard to understand Especially for structures and enumerations September12, 2014L03-8http://csg.csail.mit.edu/6.175
9
BSV Debugging Example Using the Bluespec GUI and the GTKWave waveform viewer September12, 2014L03-9http://csg.csail.mit.edu/6.175
10
Step 1 Generate VCD File Run./simTestName -V test.vcd September12, 2014L03-10http://csg.csail.mit.edu/6.175
11
Step 2 Open Bluespec GUI Run “bluespec fifo.bspec” September12, 2014L03-11http://csg.csail.mit.edu/6.175 Note, to run the GUI remotely, you need to SSH into the servers with the “ssh –X” command For the fifo lab, fifo.bspec can be found in
12
Step 3 Set top module name Open project options September12, 2014L03-12http://csg.csail.mit.edu/6.175
13
Step 3 Set top module name Set the top module name to match the compiled module in TestBench.bsv September12, 2014L03-13http://csg.csail.mit.edu/6.175
14
Step 4 Open Module Viewer September12, 2014L03-14http://csg.csail.mit.edu/6.175
15
Step 4 Open Module Viewer September12, 2014L03-15http://csg.csail.mit.edu/6.175
16
Step 5 Open Wave Viewer September12, 2014L03-16http://csg.csail.mit.edu/6.175
17
Step 5 Open Wave Viewer September12, 2014L03-17http://csg.csail.mit.edu/6.175
18
September12, 2014L03-18http://csg.csail.mit.edu/6.175 Step 6 Open Wave Viewer
19
Step 6 Add Some Signals September12, 2014L03-19http://csg.csail.mit.edu/6.175
20
Step 6 Add Some Signals September12, 2014L03-20http://csg.csail.mit.edu/6.175 Module Hierarchy Signals
21
Step 7 Look at the Waveforms September12, 2014L03-21http://csg.csail.mit.edu/6.175
22
Step 7 Look at the Waveforms September12, 2014L03-22http://csg.csail.mit.edu/6.175 Types Human readable value names
23
Step 7 Look at the Waveforms September12, 2014L03-23http://csg.csail.mit.edu/6.175
24
Step 8 Add Some More Signals September12, 2014L03-24http://csg.csail.mit.edu/6.175
25
Step 8 Add Some More Signals September12, 2014L03-25http://csg.csail.mit.edu/6.175
26
Step 9 Add Rules Too September12, 2014L03-26http://csg.csail.mit.edu/6.175
27
Step 9 Add Rules Too September12, 2014L03-27http://csg.csail.mit.edu/6.175
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.