Constructive Computer Architecture Tutorial 4 Debugging Sizhuo Zhang 6.175 TA Oct 23, 2015T04-1http://csg.csail.mit.edu/6.175.

Slides:



Advertisements
Similar presentations
Simulation executable (simv)
Advertisements

Slide 1CPU Emulator Tutorial This program is part of the software suite that accompanies the book The Digital Core, by Noam Nisan and Shimon Schocken 2003,
Electrical and Computer Engineering MIDI Note Number Display UGA Presentation and Demo ECE 353 Lab B.
1 CSCI N305 C Language Programming Welcome to CSCI N305! Compiling Your First Program Using Microsoft Visual Studio 2008.
Lab6 – Debug Assembly Language Lab
Cadence Verilog Simulation Guide and Tutorial PART I ECE 4680 Computer Architecture Fall 2005.
Programming in Verilog CPSC 321 Computer Architecture Andreas Klappenecker.
Verilog Lab This presentation includes some material that is selected from BUCKNELL VERILOG HANDBOOK. Instructor: Dr. Charles Liu Prepared by John Ren.
A Visual Introduction to PC SAS. Start SAS by double-clicking on the SAS icon...
02/10/06EECS150 Lab Lecture #41 Debugging EECS150 Spring 2006 – Lab Lecture #4 Philip Godoy Greg Gibeling.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Design Verification Design Profiler Course 8. All materials updated on: September 30, Design Profiler Design Profiler is a tool integrated within.
Constructive Computer Architecture Tutorial 4: SMIPS on FPGA Andy Wright 6.S195 TA October 7, 2013http://csg.csail.mit.edu/6.s195T04-1.
Lesson 4 Computer Software
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
P51UST: Unix and Software Tools Unix and Software Tools (P51UST) Compilers, Interpreters and Debuggers Ruibin Bai (Room AB326) Division of Computer Science.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
The NetBeans IDE CSIS 3701: Advanced Object Oriented Programming.
Simulink ® Interface Course 13 Active-HDL Interfaces.
SoC Verification HW #2 TA: Wei-Ting Tu Assignment: 04/12/06
ADAM2 Single Remocon MCU IDE User’s Manual S/W Integrated Development Environment - Assembler - Simulator - Code Wizard V1.0 Technical Sales Team, ETA.
Python From the book “Think Python”
Active-HDL Interfaces Debugging C Code Course 10.
Active-HDL Interfaces Building VHPI Applications C Compilation Course 9.
Interfaces to External EDA Tools Debussy Denali SWIFT™ Course 12.
Constructive Computer Architecture Tutorial 3: Debugging SMIPS Andy Wright 6.S195 TA October 4, 2013http://csg.csail.mit.edu/6.s195T03-1.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Debugging and Profiling With some help from Software Carpentry resources.
Programmable Logic Training Course HDL Editor
MIPS Project -- Simics Yang Diyi Outline Introduction to Simics Simics Installation – Linux – Windows Guide to Labs – General idea Score Policy.
Constructive Computer Architecture Tutorial 3 Debugging BSV Andy Wright TA September12, 2014http://csg.csail.mit.edu/6.175T01-1.
Infrastructure design & implementation of MIPS processors for students lab based on Bluespec HDL Students: Danny Hofshi, Shai Shachrur Supervisor: Mony.
Bit-DSP-MicrocontrollerTMS320F2812 Texas Instruments Incorporated European Customer Training Center University of Applied Sciences Zwickau (FH)
Oct 2, 2014T01-1http://csg.csail.mit.edu/6.175 Constructive Computer Architecture Tutorial 1 BSV Sizhuo Zhang TA.
Constructive Computer Architecture Tutorial 2 Advanced BSV Sizhuo Zhang TA Oct 9, 2015T02-1http://csg.csail.mit.edu/6.175.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 11 – gdb and Debugging.
Using Simulator With Undertow Suite. Source environment variables For example, envsource has all the environment variables set up. You can change the.
Application Debugging. Debugging methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic.
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
Lab Exercise Management Steven P. Levitan, University of Pittsburgh Design Automation Conference Sunday, June 9, 2002.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 4: Testing, Dataflow Modeling Spring 2009.
Week 1-1 Friday Lab  Bring CD and book  Load Promodel on PC of your choice, see next slide for specific directions  Work through Lab 1 – Intro to Promodel,
Introduction to Eclipse Programming with an Integrated Development Environment.
Constructive Computer Architecture Tutorial 4: Running and Debugging SMIPS Andy Wright TA October 10, 2014http://csg.csail.mit.edu/6.175T04-1.
Teaching Digital Logic courses with Altera Technology
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Debugging Lab Antonio Gómez-Iglesias Texas Advanced Computing Center.
Tutorial for Modelsim 1 Installation Download the Modelsim Student Edition: Follow the.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Hex Editing using HxD Nick Fogal & Lindsay Shaffer.
Topic 2: Hardware and Software
14 Compilers, Interpreters and Debuggers
CS4101 Introduction to Embedded Systems Lab 1: MSP430 LaunchPad IDE
Getting Started with R.
Easy way to debug with VCS
Constructive Computer Architecture: Lab Comments & RISCV
BSV objects and a tour of known BSV problems
6.375 Tutorial 2 Guards and Scheduling Ming Liu
Debugging BSV and Typeclasses. Constructive Computer Architecture
Constructive Computer Architecture Tutorial 3 RISC-V Processor
1. Open Visual Studio 2008.
6.375 Tutorial 5 RISC-V 6-Stage with Caches Ming Liu
Getting Started: Developing Code with Cloud9
Debugging EECS150 Fall Lab Lecture #4 Sarah Swisher
Debugging EECS150 Fall Lab Lecture #4 Sarah Swisher
Presentation transcript:

Constructive Computer Architecture Tutorial 4 Debugging Sizhuo Zhang TA Oct 23, 2015T04-1http://csg.csail.mit.edu/6.175

BSV Debug -- $display 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 Oct 23, 2015T04-2http://csg.csail.mit.edu/6.175

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)); Oct 23, 2015T04-3http://csg.csail.mit.edu/6.175

Ways to Display Values Format Specifiers %d – decimal %b – binary %o – octal %h – hexadecimal %0d, %0b, %0o, %0h Show value without extra whitespace padding Oct 23, 2015T04-4http://csg.csail.mit.edu/6.175

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)); Oct 23, 2015T04-5http://csg.csail.mit.edu/6.175 Prints “c is Red”

BSV Debugging Waveform Viewer Simulation executables can dump VCD waveforms./bsim_dut –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 Oct 23, 2015T04-6http://csg.csail.mit.edu/6.175

Bluespec GUI Example We use Bluespec GUI + gtkwave to view waveform of VCD files gtkwave Installed in vlsifarm matchines SSH with -X ssh –X Windows may need some tools  Cygwin/X Use onecycle processor in lab5 as Example Oct 23, 2015T04-7http://csg.csail.mit.edu/6.175

Bluespec project We have set SceMi to generate it when building the project project.bld: workstation-project-file $ cd scemi/sim $ build –v onecycle onecycle.bspec is the project file Oct 23, 2015T04-8http://csg.csail.mit.edu/6.175

Simulation: generate VCD file $ cp../../programs/build/assembly/vmh/simple.riscv.vmh mem.vmh $./bsim_dut –V out.vcd > log.txt & $./tb Oct 23, 2015T04-9http://csg.csail.mit.edu/6.175

Open Bluespec GUI $ bluespec onecycle.bspec Oct 23, 2015T04-10http://csg.csail.mit.edu/6.175

Open Module Browser Window  Module Browser Oct 23, 2015T04-11http://csg.csail.mit.edu/6.175

Module Browser Oct 23, 2015T04-12http://csg.csail.mit.edu/6.175 Module Hierarchy Signals Methods Top level module

Oct 23, 2015T04-13http://csg.csail.mit.edu/6.175

Open Waveform Viewer Oct 23, 2015T04-14http://csg.csail.mit.edu/6.175

Load VCD Oct 23, 2015T04-15http://csg.csail.mit.edu/6.175

Waveform Viewer Oct 23, 2015T04-16http://csg.csail.mit.edu/6.175 Signal names Waveform

Add Signals to View Add clock Oct 23, 2015T04-17http://csg.csail.mit.edu/6.175

Add Signals to View Add PC Oct 23, 2015T04-18http://csg.csail.mit.edu/6.175

Add Signals to View Add csrf.wr method Oct 23, 2015T04-19http://csg.csail.mit.edu/6.175

Add Signals to View Add can_fire, will_filre for rule doProc Oct 23, 2015T04-20http://csg.csail.mit.edu/6.175

Waveforms Oct 23, 2015T04-21http://csg.csail.mit.edu/6.175 Readable value

Problem No internal signals Optimized away during compilation But I want to see them for dubuggin  For example: dInst Oct 23, 2015T04-22http://csg.csail.mit.edu/6.175

Solution -- Probe interface Probe#(type t); method Action _write(t x); endinterface module mkProbe(Probe#(t)) provisos( Bits#(t, sz)); Write to mkProbe will be recorded in VCD file Instantiate mkProbe for each signal that we want to record Oct 23, 2015T04-23http://csg.csail.mit.edu/6.175

Probe Example import Probe::*;... module mkProc(Proc); mkProbe#(DecodedInst) dInstProbe <- mkProbe;... rule doProc;... let dInst = decode(inst); dInstProbe <= dInst;... endrule... endmodule Oct 23, 2015T04-24http://csg.csail.mit.edu/6.175

After Adding Probe Oct 23, 2015T04-25http://csg.csail.mit.edu/6.175

Oct 23, 2015T04-26http://csg.csail.mit.edu/6.175

Combine with Assembly Assembly code of compiled tests are in programs/build/*/dump Refer to the assembly code in debugging Oct 23, 2015T04-27http://csg.csail.mit.edu/6.175

Debugging Scheduling GUI: schedule Analysis The same as “-show-shedule” BSC flag Oct 23, 2015T04-28http://csg.csail.mit.edu/6.175

Select mkProc Oct 23, 2015T04-29http://csg.csail.mit.edu/6.175

Output of Schedule Analysis Rule order: execution order of rules and methods From top to bottom Oct 23, 2015T04-30http://csg.csail.mit.edu/6.175

Alternative for Schedule Analysis Add –show-schedule to project.bld Generate info_dir/*.sched Contain same information as GUI outputs Oct 23, 2015T04-31http://csg.csail.mit.edu/6.175

General Debugging Advice Debugging is to guess what goes wrong Check warnings in compiler outputs Scheduling warnings Understand all warnings in mkProc Stare at your code – prove its correctness Add $display – convenient & very useful Look at assembly code, locate position Dump VCD file and see waveform Oct 23, 2015T04-32http://csg.csail.mit.edu/6.175

Note Codes on the slide is a little different from our labs Read src/includes to be familiar with out lab setup. Oct 23, 2015T04-33http://csg.csail.mit.edu/6.175