TraceValue Class Reference

#include <traceval.h>

Inheritance diagram for TraceValue:
Inheritance graph
[legend]
Collaboration diagram for TraceValue:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Atype { READ = 1, WRITE = 2, CHANGE = 4 }
 

Possible access types for a trace value.

More...

Public Member Functions

 TraceValue (size_t bits, const std::string &_name, const int __index=-1, void *shadow=0)
 Generate a new unitialized trace value of width bits.
size_t bits () const
 Give number of bits for this value. Max 32.
unsigned value () const
 Gives the saved shadow value for this trace value.
std::string name () const
 Give name (fully qualified), including the index appended if it is >=0.
std::string barename () const
 Gives the name without the index.
int index () const
 Gives the index of this member in a memory field (or -1).
bool enabled () const
void enable ()
 Enable tracing.
void change (unsigned val)
 Log a change on this value.
void change (unsigned val, unsigned mask)
void write (unsigned val)
 Log a write access on this value.
void read ()
 Log a read access.
bool written () const
void set_written ()
void set_written (unsigned val)
Atype flags () const
 Gives the current set of flag readings.
virtual void cycle ()
 Called at least once for each cycle if this trace value is activated.
virtual void dump (Dumper &d)

Protected Member Functions

void clear_flags ()
 Clear all access flags.

Private Attributes

std::string _name
int _index
const unsigned b
 number of bits
void * shadow
 shadow reg, if used
unsigned v
 The value itself.
int f
 accesses since last dump/clearflagsd
bool _written
bool _enabled
 Tracing of this value enabled at all?

Friends

class TraceKeeper

Detailed Description

Abstract interface for traceable values. Traced values can be written (marking it with a WRITE flag and if the value changed also a CHANGE flag. If the traced value has been written once, it is marked 'written()' for the whole simulation. They can also be read, marking the READ flag.

For values where no accessors for read and write can be intercepted, it is also possible to use the cycle() method (activated when the traceval is initialized with a shadow ptr !=0), which will then simply update the state of the value during the cycle() method by comparing it with the internal state. This does not allow to trace read and write accesses, but all state changes will still be represented in the output file. This is helpful for e.g. tracing the hidden shadow states in various parts of the AVR hardware, such as the timer double buffers.

Definition at line 102 of file traceval.h.


Member Enumeration Documentation

Possible access types for a trace value.

Enumerator:
READ 
WRITE 
CHANGE 

Definition at line 130 of file traceval.h.


Constructor & Destructor Documentation

TraceValue::TraceValue ( size_t  bits,
const std::string &  _name,
const int  __index = -1,
void *  shadow = 0 
)

Generate a new unitialized trace value of width bits.

Definition at line 36 of file traceval.cpp.


Member Function Documentation

std::string TraceValue::barename (  )  const

Gives the name without the index.

Definition at line 57 of file traceval.cpp.

References _name.

Referenced by DumpManager::save().

Here is the caller graph for this function:

size_t TraceValue::bits (  )  const

Give number of bits for this value. Max 32.

Definition at line 49 of file traceval.cpp.

References b.

Referenced by DumpVCD::valout().

Here is the caller graph for this function:

void TraceValue::change ( unsigned  val,
unsigned  mask 
)

Definition at line 75 of file traceval.cpp.

References _written, CHANGE, f, and v.

void TraceValue::change ( unsigned  val  ) 

Log a change on this value.

Definition at line 67 of file traceval.cpp.

References _written, CHANGE, f, and v.

Referenced by BasicTimerUnit::CountTimer(), TwiceTV::cycle(), IOSpecialReg::hardwareChange(), IOReg< HWTimer8_0C >::hardwareChange(), IOSpecialReg::hardwareChangeMask(), BasicTimerUnit::SetCounter(), and RWSreg::trigger_change().

Here is the caller graph for this function:

void TraceValue::clear_flags (  )  [protected]

Clear all access flags.

void TraceValue::cycle (  )  [virtual]

Called at least once for each cycle if this trace value is activated.

This may check for updates to an underlying referenced value etc. and update the flags accordingly.

Reimplemented in TwiceTV.

Definition at line 109 of file traceval.cpp.

References _written, avr_error, b, CHANGE, f, shadow, and v.

void TraceValue::dump ( Dumper d  )  [virtual]

Dump the state or state change somewhere. This also resets the current flags.

Definition at line 132 of file traceval.cpp.

References _written, CHANGE, f, Dumper::markChange(), Dumper::markRead(), Dumper::markReadUnknown(), Dumper::markWrite(), READ, and WRITE.

Here is the call graph for this function:

void TraceValue::enable (  ) 

Enable tracing.

Definition at line 65 of file traceval.cpp.

References _enabled.

bool TraceValue::enabled (  )  const

Enabled? All operations should be skipped if a trace value is not enabled.

Definition at line 63 of file traceval.cpp.

References _enabled.

TraceValue::Atype TraceValue::flags (  )  const

Gives the current set of flag readings.

Definition at line 107 of file traceval.cpp.

References f.

int TraceValue::index (  )  const

Gives the index of this member in a memory field (or -1).

Definition at line 59 of file traceval.cpp.

References _index.

Referenced by name(), TraceValueCoreRegister::RegisterTraceSetValue(), and DumpManager::save().

Here is the caller graph for this function:

std::string TraceValue::name (  )  const

Give name (fully qualified), including the index appended if it is >=0.

Definition at line 51 of file traceval.cpp.

References _name, index(), and int2str().

Referenced by IOReg< HWTimer8_0C >::get(), WarnUnknown::markReadUnknown(), TraceValueRegister::RegisterTraceValue(), IOReg< HWTimer8_0C >::set(), and TraceValueRegister::UnregisterTraceValue().

Here is the call graph for this function:

Here is the caller graph for this function:

void TraceValue::read (  ) 

Log a read access.

Definition at line 92 of file traceval.cpp.

References f, and READ.

Referenced by RWMemoryMember::operator unsigned char(), and RWMemoryMember::operator=().

Here is the caller graph for this function:

void TraceValue::set_written ( unsigned  val  ) 

Just set the written flag for tracevalues which are automatically initialized (IO registers etc.)

This method sets not only the _written flag, it set's also the saved value for detecting changes.

Definition at line 102 of file traceval.cpp.

References _written, and v.

void TraceValue::set_written (  ) 

Just set the written flag for tracevalues which are automatically initialized (IO registers etc.)

Definition at line 98 of file traceval.cpp.

References _written.

Referenced by BasicTimerUnit::BasicTimerUnit(), TwiceTV::cycle(), HWIrqSystem::HWIrqSystem(), IOReg< HWTimer8_0C >::IOReg(), and IOSpecialReg::Reset().

Here is the caller graph for this function:

unsigned TraceValue::value (  )  const

Gives the saved shadow value for this trace value.

Note that the shadow value does not necessarily reflect the *current* value of the traced variable.

Definition at line 61 of file traceval.cpp.

References v.

Referenced by TwiceTV::cycle(), and DumpVCD::valout().

Here is the caller graph for this function:

void TraceValue::write ( unsigned  val  ) 

Log a write access on this value.

Definition at line 83 of file traceval.cpp.

References _written, CHANGE, f, v, and WRITE.

Referenced by RWMemoryMember::operator=().

Here is the caller graph for this function:

bool TraceValue::written (  )  const

Gives true if this value has been written at one point during the simulation.

Definition at line 96 of file traceval.cpp.

References _written.

Referenced by DumpVCD::valout().

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class TraceKeeper [friend]

Definition at line 183 of file traceval.h.


Member Data Documentation

bool TraceValue::_enabled [private]

Tracing of this value enabled at all?

Note that it must additionally be enabled in the particular Dumper.

Definition at line 207 of file traceval.h.

Referenced by enable(), and enabled().

int TraceValue::_index [private]

Definition at line 188 of file traceval.h.

Referenced by index().

std::string TraceValue::_name [private]

Definition at line 186 of file traceval.h.

Referenced by barename(), and name().

bool TraceValue::_written [private]

Initialized to zero upon creation and any logged write will make this true.

Definition at line 202 of file traceval.h.

Referenced by change(), cycle(), dump(), set_written(), write(), and written().

const unsigned TraceValue::b [private]

number of bits

Definition at line 191 of file traceval.h.

Referenced by bits(), and cycle().

int TraceValue::f [private]

accesses since last dump/clearflagsd

Definition at line 199 of file traceval.h.

Referenced by change(), cycle(), dump(), flags(), read(), and write().

void* TraceValue::shadow [private]

shadow reg, if used

Definition at line 194 of file traceval.h.

Referenced by cycle().

unsigned TraceValue::v [private]

The value itself.

Definition at line 197 of file traceval.h.

Referenced by change(), cycle(), set_written(), value(), and write().


The documentation for this class was generated from the following files:
Generated on Sun Feb 12 16:53:23 2012 for Simulavr by  doxygen 1.6.3