electronics system level based...

25
Electronics System Level Based Design Spring, 2006 Pre-Lab 2: CoWare Scsh & Eclipse 1

Upload: others

Post on 26-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

  • Electronics System Level Based Design

    Spring, 2006

    Pre-Lab 2: CoWare Scsh & Eclipse

    1

  • Introduction The purpose of this lab exercise is: 1. Run a simulation by Scsh. 2. Use Eclipse debugging environment.

    Objectives Build and run simulation

    Practice how to Debug:

    Set a breakpoint in the debugger Watch local variables Turn breakpoint on and off Do an interactive trace

    Fig.1 The System Diagram of this Lab

    2

  • Steps Simulation Using Scsh

    I. Create the build.tcl 1. Use tar xvfz pre_lab2.tgz to decompress the lab files. 2. Login and change to directory “trainClass/sim” 3. Examine the contents of names.fof..

    % more names.fof 4. Create the build.tcl file. Use your favorite editor. The file contains the

    following: build.tcl:

    5. Save the file. 6. Create the elab.tcl file. The file should contain the following

    command:

    7. Copy the library header file in place. %cp lib/EncDecMessage.h.Build lib/EncDecMessage.h

    II. Build and run the simulation. 1. Start scsh:

    % scsh 2. Execute the build script:

    % source build.tcl 3. Run the simulation:

    ::scsh> run 4. Notice the output of the simulation. The Input module displays the

    Message sent. The Channel module displays the encrypted data

    3

  • received from the Encryption module. The Display module displays the decrypted message.

    III. Call for Help 1. Enter the following commands at the scsh prompt:

    ::scsh> help PDFmanuals (for PDF manuals) ::scsh> help manuals (for HTML manuals)

    4

  • Debugging Using the Eclipse IDE

    I. Define and Build Project 1. Login and change to directory “trainClass” (This is the working

    directory for this lab) 2. The directories used for this lab are:

    debug –source code for this exercise trainClass–start Eclipse in this directory.

    3. Clear the workspace: rm –rf workspace/.metadata 4. Start the Eclipse platform:

    % scide &(The splash screen and Workspace Launcher appear) 5. Select the workspace directory. In the Workspace Launcher dialog,

    Click on the Browse button and select …/trainClass/workspace.

    5

  • Click the OK button.(The Eclipse workbench window appears)

    6. Right click in the Navigator window and select Import… from the popup menu.(The Import dialog appears)

    6

  • 7. Select Scsh Project into Work space in the Select import source pane. Click the Next button.

    7

  • 8. Click on the Browse…button and select the trainClass/debug directory.

    9. The Import wizard:

    Selects the project name: debug. Locates the build script and displays the contents Click the Next button.

    10. Set the run script. The Import wizard automatically selects the elab or

    run script. Select the run.tcl script. Click the Next button.

    8

  • 11. Set the clean script. The Import wizard does not automatically select a script. But it does display all scripts containing the name, “clean.” Select the clean.tcl script. Click the Finish button.

    9

  • 12. Upon clicking the Import Finish button, the builder module creates a new project, imports the files, switches to the SystemC Development perspective and starts building the project.

    II. Run the simulation in Debug Mode 1. Select Run Debug…(The Debug Launch window appears) 2. On the Main tab, click the Browse button and select Debug for the

    Project field. (The run.tcl script contents appear and the Debug button is activated)

    3. Create a new debug configuration. Under the Configurations window,

    click the New button(The Debug Launch window is reconfigured) The following settings appear in the Debug window:(If they don’t appear, edit or click the appropriate Browse and Search buttons) Name: sim Under the Main tab, Project: debug Scsh Run Script: run.tcl.

    10

  • 4. Click on the Debugger tab. Verify and change settings if needed as

    follows: Debugger: ConvergenSC Scsh Stop at main() on startup checkbox is Off(All other

    options are off) 5. Click the Debug button.(Switches to Debug perspective, launches, and

    breaks at end of initialization)

    11

  • 6. Set the Remember my decision check box. Click the Yes button.(The Eclipse Platform switches to the Debug Perspective and breaks at the end of initialization) Note: This is set in Window Preferences

    Run/Debug View Management

    7. Configure the Debug perspective by adding two additional views. Select Window Show View Other…(The Show View dialog appears)

    8. Expand the Basic folder and select Navigator. Click the OK button

    12

  • III. Set a Source Code Breakpoint 1. Open the input.cpp file by double-clicking on the input.cpp icon in the

    Navigator view.

    13

  • 2. Turn on editor line numbers. Select Window Preferences. (The Preferences window appears) Expand and select C/C++ Editor Set the Show line numbers checkbox to on. Click the OK button.

    The input.cpp file opens

    3. Set a source code breakpoint on line 7 (containing the if statement) by

    placing the cursor to the left of the line number. You can double-click or right mouse click and select Toggle Breakpoint from the pop up menu.(When completed, you should see a sphere with a check mark to the left on line 7.)

    14

  • Right click to set breakpoint

    4. Make the Debug view active by clicking on the Debug tab. Continue the simulation by clicking on the Resume button (or Run Resume). (The simulation will break on line 7.)

    IV. Examine Local Variables 1. In the input.cpp editor window, hover your cursor over variable

    mes_num on line 7. (The current value is displayed)

    15

  • Select Debug tab Click Resume button to start simulation

    Hover the cursor to watch the current value

    2. Move the simulation forward by clicking on the Resume button (or

    Run Resume).Did the variable values update? 3. Did you notice the current time field in the SystemC Design

    Browser?(It is displaying the current simulation time, for example, 5 )Run the simulation forward 10 time units(this would be time 15 in our example). Enter 10 In the text entry window to the right of the current time field. Hover your cursor over the buttons to the left of the

    text entry field. Click on the Run for specified time button.

    4. Did time move ahead 10 units? Why not? What happened?(It hit the breakpoint on line 7 of input.cpp before 10 time units passed) Click the Resume button in the Debug view.(The debugger stops at time 15)

    16

  • Enter time

    5. Turn off the source code breakpoint. Click on the Breakpoints view

    tab (Displays the list of breakpoints) Click the checkbox to disable the breakpoint. (If the simulation terminates, restart by clicking on the

    Debug icon.) Turn off

    6. Return to the SystemC Design Browser and run the simulation ahead another 10 time units. Did the simulation move forward 10 time units?

    V. Set Event Breakpoint 1. In the SystemC Design Browser tab, Select the input module located

    17

  • under system. In the right hand pane, locate port_0:mes_out. 2. Place your cursor over port_0:mes_out and right click. Select Event

    Break from the pop up menu. Set count to 1 in the Event Break dialog. Click on the OK button.

    3. Move the simulation forward several times by clicking on the Resume button (or Run Resume).Did the port_0:mes_outvalues update?

    4. Turn off the SystemC breakpoint. Click on the SystemC Break points tab.(Displays the list of breakpoints)Right click on the breakpoint and select remove.

    18

  • Turn off breakpoint

    VI. Set Clock Breakpoint 1. In the SystemC Design Browser tab, Select the input module located

    under system. In the right hand pane, locate port_1:clk 2. Place your cursor over port_1: clk and right click. Select Clock Break

    from the pop up menu. Set count to 2 in the Event Break dialog. Click on the OK button

    .

    19

  • 3. Move the simulation forward several times by clicking on the Resume button (or Run Resume).How is the current time changing in the SystemC Design Browser?

    4. Turn off the SystemC breakpoint. Click on the SystemC Break points tab. (Displays the list of breakpoints) Right click on the breakpoint and

    select remove. (Terminate the session , ,then restart the simulation

    by clicking on the Debug icon. )

    The breakpoint is shown here.

    VII. Examine Connectivity 1. In the SystemC Design Browser tab, Select the channel module

    located under system. 2. Place your cursor over channel and right click. Select Browse

    Connectivity from the popup menu. (The Connectivity Browser tab updates)

    20

  • Connectivity is shown here.

    Expand

    3. Expand the plus icons to examine the ports connected to the channel block.

    4. Trace connectivity Select and place cursor over encryptor.port_1 in the Connectivity Browser tab. Right Click and select Show in Design Browser from the popup menu. Did the SystemC Design Browser update?

    21

  • VIII. Do an Interactive Trace 1. Open a trace file. Select the menu in the SystemC Design Browser, the

    small black triangle. From the menu, Select Open Trace File (The Save As form appears) Select debug as the parent folder. Enter myTrace in the File name field. Click the OK button.

    22

  • 2. Select signals to be traced. In the SystemC Design Browser tab, Click on system in the left pane. In the right pane, Select MES1, right-click and select Trace from the popup menu In similar fashion, add signal_0, sendclock and receiveclock to the list of trace items.

    23

  • 3. Run the simulation for 40 time units (Note: you may need to start another simulation run if the simulation terminates)

    4. Close the trace file. Select the menu in the Design Browser View, the

    small black triangle. From the menu, Select Close Trace File. 5. In an xterm window, locate file myTrace.vcd.(Under trainClass/debug

    directory) 6. View the vcd file. If you have a program such as nWave, open it to

    load myTrace.vcd. Please observe the signal changes and the cycle counts.

    24

  • Ref 1. CIC 訓練課程 Coware-ConvergenSC Training Manual. July-2005

    25

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 150 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.00333 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages false /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 600 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.00167 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile (None) /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName (http://www.color.org) /PDFXTrapped /False

    /Description >>> setdistillerparams> setpagedevice