patchSimulavr: an AVR simulator - Patches: patch #6835, New tracing subsystem with .vcd...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #6835: New tracing subsystem with .vcd file generation for viewing with e.g. gtkwave

Submitter:  Onno Kortmann <onnokort>
Submitted:  Thu 21 May 2009 10:14:54 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  onnokort Open/Closed:  Closed
Component Version:  simulavrxx

Tue 23 Mar 2010 09:16:26 PM UTC, comment #1: 

committed

Onno Kortmann <onnokort>
Group Member
Thu 21 May 2009 10:14:54 PM UTC, original submission:  

Overview: This patch is the first try at implementing a very general and better tracing facility in simulavrxx, to allow tracing of arbitrary states in the simulation, such as hidden states in the SPI or the UART.

Debugging the of AVR hardware components such as SPI, UART requires checking the correctness of the simulated hardware as well as a detailed view while debugging. Viewing just the state of the external pins is often not very helpful.

This patch implements a very general, named registry of pointers to various variables inside the simulator, which can then be queried for their value. The class 'TraceVCD' produces a .vcd file which can then be viewed in gtkwave as graphical traces (Note that in principle, it should also be possible to do real-time tracing with gtkwave through a fifo or similar). The TraceVCD object is driven through a step() method from the avrdevice's Step() method.

Enabling tracing for a value is trivially easy, as only a link has to be made between its name in the dump file and the location in memory.

The perfomance penality is practically non-existant if the tracing is disabled (one conditional jump per step() invocation) and only very moderate when enabled. The current
tracing code is littered with a lot of "if (core->trace_on)" checks, which are basically all redundant when one factors out the check like this patch does.

The command line options have been extended by a "-c" and "-o" option to specify the list of variables to be traced resp. the output .vcd file.

Extension ideas:
- more tracing points, of course
- write support
- verilog read/write support
- replace old tracing code for pins as well as for human-readable output by a more generalized variant of this code
- performance improvements by removing the string matching code in the .vcd output loop
- as I understand it, the GDB interface of simulavr currently only allows a view on a fixed subset (flash, ram, regs, PC etc.) of the hardware. By porting the GDB interface to this general registry, a lot more details could be queried.

The patch is just compilable & seems to do the right thing, so probably pre-alpha quality. It is also completely independent of the verilog interface.

Like for all my patches, feedback is very much appreciated :-)

Onno Kortmann <onnokort>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #18178:  trace-vcd.patch added by onnokort (21KiB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by onnokort (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-03-23 onnokort StatusNone Done
        Assigned toNone onnokort
        Open/ClosedOpen Closed
    2009-05-21 onnokort Attached File- Added trace-vcd.patch, #18178

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code