Coder Social home page Coder Social logo

gdb_systemc_trace's Introduction

gdb_systemc_trace

GDB Python scripts for SystemC design introspection and tracing

Automatically creates a trace of all signals and module member variables in design

Limitations

Fixed-point datatypes are not supported yet

Installation

Prerequisites

Running basic example

  1. clone gdb_systemc_trace from git and add to $PATH
  2. Download SystemC 2.3.3 https://accellera.org/downloads/standards/systemc
  3. Build with debug info:
    $ tar xvf systemc-2.3.3.tar.gz 
    $ cd systemc-2.3.3/
    $ mkdir build_debug
    $ cd build_debug/
    $ cmake ../ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=14
    $ make -j8
    # build SystemC examples
    $ make check -j8
    # it is important to cd into example directory, sometimes they read some files from workdir
    $ cd examples/sysc/risc_cpu
    $ gdb_systemc_trace.py risc_cpu
    # systemc_trace.vcd file will be created
    
  4. Use GTKWave or other VCD viewer to view generated vcd:
 $ gtkwave systemc_trace.vcd 

risc_cpu

Running simulation with full trace dump

Tracing only required signals

  • ./gdb_systemc_trace.py -l path/to/your/simulation_executable
  • List of all detected signals in design will be printed to console
  • Copy required signal names (full hierarchical names) into some file, say signals.txt
  • ./gdb_systemc_trace.py -f signals.txt
  • systemc_trace.vcd will be created

Print design tree

  • ./gdb_systemc_trace.py -p path/to/your/simulation_executable

Passing arguments to simulation executable

  • ./gdb_systemc_trace.py path/to/your/simulation_executable argument_1 argument_2 ...

gdb_systemc_trace's People

Contributors

ripopov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gdb_systemc_trace's Issues

GDB MemoryError : Cannot access memory at address ...

Hi,
I just tried to use this tool, I am on ubuntu, using SystemC 2.3.3, GNU GDB 9.2, but I get the following error:

** ALERT ** ID: initialize Architectural Registers
** ALERT ** BIOS: initialize BIOS
** ALERT ** DCU: initialize Data Cache

Breakpoint 2, sc_core::sc_simcontext::prepare_to_simulate (this=0x555555618510)
    at /media/skander/data/systemc-2.3.3/src/sysc/kernel/sc_simcontext.cpp:678
678 {
Traceback (most recent call last):
  File "/media/skander/data/gdb_systemc_trace/gdb_scripts/run_trace.py", line 58, in <module>
    design = sc_design.SCModule(simctx)
  File "/media/skander/data/gdb_systemc_trace/gdb_scripts/sc_design.py", line 59, in __init__
    self.__init_from_simctx()
  File "/media/skander/data/gdb_systemc_trace/gdb_scripts/sc_design.py", line 66, in __init_from_simctx
    m_child_objects = stdlib_hacks.StdVectorView(self.value['m_child_objects'])
  File "/media/skander/data/gdb_systemc_trace/gdb_scripts/stdlib_hacks.py", line 42, in __init__
    self.size = self.end - self.begin
**gdb.MemoryError: Cannot access memory at address 0x98**

Do you have any ideas?
Thanks in advance

Does not run!

Hi,

When I followed the process you mentioned in README, I ended up with below eeor? Any clue why?

Here is the error:

simctx = gdb.lookup_symbol("sc_core::sc_curr_simcontext")[0].value().dereference()
AttributeError: 'gdb.Symbol' object has no attribute 'value'

Thank you!

VCD Dump signals/port with different names

Hi @ripopov,
tks for the excellent scripting, I have just a small question, can you point me why the signals/ports name are name port_X some rather than the name written in the sysc?
ps.: I'm compiling with -g -Og
Screenshot from 2020-03-17 12-49-16

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.