simulavr  1.1.0
DumpVCD Class Reference

#include <traceval.h>

Inheritance diagram for DumpVCD:

Public Member Functions

 DumpVCD (std::ostream *os, const std::string &tscale="ns", const bool rstrobes=false, const bool wstrobes=false)
 Create tracer with time scale tscale and output os. More...
 
 DumpVCD (const std::string &name, const std::string &tscale="ns", const bool rstrobes=false, const bool wstrobes=false)
 Create tracer with time scale tscale for output file name. More...
 
void setActiveSignals (const TraceSet &act)
 
void start ()
 Writes header stuff and the initial state. More...
 
void stop ()
 Writes a last time marker. More...
 
void cycle ()
 Writes next clock cycle and resets all RS and WS states. More...
 
void markRead (const TraceValue *t)
 
void markWrite (const TraceValue *t)
 
void markChange (const TraceValue *t)
 
bool enabled (const TraceValue *t) const
 Returns true iff tracing a particular value is enabled. More...
 
 ~DumpVCD ()
 
- Public Member Functions inherited from Dumper
virtual void markReadUnknown (const TraceValue *t)
 
virtual ~Dumper ()
 Destructor, called for all dumpers at the very end of the run. More...
 

Private Member Functions

void valout (const TraceValue *v)
 
void flushbuffer (void)
 writes content of osbuffer to os and empty osbuffer afterwards More...
 

Private Attributes

TraceSet tv
 
std::map< const TraceValue *, size_t > id2num
 
const std::string tscale
 
const bool rs
 
const bool ws
 
bool changesWritten
 
std::vector< int > marked
 
std::ostream * os
 
std::stringstream osbuffer
 

Detailed Description

Produces value change dump files.

Definition at line 285 of file traceval.h.

Constructor & Destructor Documentation

◆ DumpVCD() [1/2]

DumpVCD::DumpVCD ( std::ostream *  os,
const std::string &  tscale = "ns",
const bool  rstrobes = false,
const bool  wstrobes = false 
)

Create tracer with time scale tscale and output os.

Definition at line 420 of file traceval.cpp.

◆ DumpVCD() [2/2]

DumpVCD::DumpVCD ( const std::string &  name,
const std::string &  tscale = "ns",
const bool  rstrobes = false,
const bool  wstrobes = false 
)

Create tracer with time scale tscale for output file name.

Definition at line 431 of file traceval.cpp.

◆ ~DumpVCD()

DumpVCD::~DumpVCD ( )

Definition at line 562 of file traceval.cpp.

References DumpManager::_devidx, DumpManager::_instance, and os.

Member Function Documentation

◆ cycle()

void DumpVCD::cycle ( )
virtual

Writes next clock cycle and resets all RS and WS states.

Reimplemented from Dumper.

Definition at line 507 of file traceval.cpp.

References changesWritten, flushbuffer(), SystemClock::GetCurrentTime(), SystemClock::Instance(), marked, and osbuffer.

Referenced by DumpManager::cycle().

◆ enabled()

bool DumpVCD::enabled ( const TraceValue t) const
virtual

Returns true iff tracing a particular value is enabled.

FIXME: For a lot of values to trace, checking enabled() each time by doing find on a map() could be slow. Here is potential for more optimization!

Implements Dumper.

Definition at line 558 of file traceval.cpp.

References id2num.

Referenced by DumpManager::cycle().

◆ flushbuffer()

void DumpVCD::flushbuffer ( void  )
private

writes content of osbuffer to os and empty osbuffer afterwards

Definition at line 412 of file traceval.cpp.

Referenced by cycle(), start(), and stop().

◆ markChange()

void DumpVCD::markChange ( const TraceValue t)
virtual

This will produce a change in the value CHANGE dump file :-)

Reimplemented from Dumper.

Definition at line 552 of file traceval.cpp.

References changesWritten, id2num, osbuffer, rs, valout(), and ws.

◆ markRead()

void DumpVCD::markRead ( const TraceValue t)
virtual

Iff rstrobes is true, this will mark reads on a special R-strobe signal line.

Reimplemented from Dumper.

Definition at line 534 of file traceval.cpp.

References changesWritten, id2num, marked, osbuffer, rs, and ws.

◆ markWrite()

void DumpVCD::markWrite ( const TraceValue t)
virtual

Iff wstrobes is true, this will mark writes on a special W-strobe signal line .

Reimplemented from Dumper.

Definition at line 544 of file traceval.cpp.

References changesWritten, id2num, marked, osbuffer, rs, and ws.

◆ setActiveSignals()

void DumpVCD::setActiveSignals ( const TraceSet act)
virtual

Called with the set of all active signals, after they've been specified.

Reimplemented from Dumper.

Definition at line 442 of file traceval.cpp.

References avr_error, id2num, and tv.

◆ start()

void DumpVCD::start ( )
virtual

Writes header stuff and the initial state.

Reimplemented from Dumper.

Definition at line 453 of file traceval.cpp.

References changesWritten, flushbuffer(), os, osbuffer, rs, tscale, tv, valout(), and ws.

Referenced by DumpManager::start().

◆ stop()

void DumpVCD::stop ( )
virtual

Writes a last time marker.

Reimplemented from Dumper.

Definition at line 523 of file traceval.cpp.

References flushbuffer(), SystemClock::GetCurrentTime(), SystemClock::Instance(), and os.

◆ valout()

void DumpVCD::valout ( const TraceValue v)
private

Definition at line 405 of file traceval.cpp.

References TraceValue::bits(), and TraceValue::VcdBit().

Referenced by markChange(), and start().

Member Data Documentation

◆ changesWritten

bool DumpVCD::changesWritten
private

Definition at line 326 of file traceval.h.

Referenced by cycle(), markChange(), markRead(), markWrite(), and start().

◆ id2num

std::map<const TraceValue*, size_t> DumpVCD::id2num
private

Definition at line 323 of file traceval.h.

Referenced by enabled(), markChange(), markRead(), markWrite(), and setActiveSignals().

◆ marked

std::vector<int> DumpVCD::marked
private

Definition at line 329 of file traceval.h.

Referenced by cycle(), markRead(), and markWrite().

◆ os

std::ostream* DumpVCD::os
private

Definition at line 330 of file traceval.h.

Referenced by start(), stop(), and ~DumpVCD().

◆ osbuffer

std::stringstream DumpVCD::osbuffer
private

Definition at line 333 of file traceval.h.

Referenced by cycle(), markChange(), markRead(), markWrite(), and start().

◆ rs

const bool DumpVCD::rs
private

Definition at line 325 of file traceval.h.

Referenced by markChange(), markRead(), markWrite(), and start().

◆ tscale

const std::string DumpVCD::tscale
private

Definition at line 324 of file traceval.h.

Referenced by start().

◆ tv

TraceSet DumpVCD::tv
private

Definition at line 322 of file traceval.h.

Referenced by DumpManager::save(), setActiveSignals(), start(), and trace_direct().

◆ ws

const bool DumpVCD::ws
private

Definition at line 325 of file traceval.h.

Referenced by markChange(), markRead(), markWrite(), and start().


The documentation for this class was generated from the following files: