CIRCT  19.0.0git
Public Member Functions | Private Member Functions | Private Attributes | List of all members
circt::llhd::sim::Trace Class Reference

#include <Trace.h>

Collaboration diagram for circt::llhd::sim::Trace:
Collaboration graph
[legend]

Public Member Functions

 Trace (std::unique_ptr< State > const &state, llvm::raw_ostream &out, TraceMode mode)
 
void addChange (unsigned)
 Add a value change to the trace changes buffer. More...
 
void flush (bool force=false)
 Flush the changes buffer to the output stream. More...
 

Private Member Functions

void pushChange (unsigned inst, unsigned sigIndex, int elem)
 Push one change to the changes vector. More...
 
void pushAllChanges (unsigned inst, unsigned sigIndex)
 Push one change for each element of a signal if it is of a structured type, or the full signal otherwise. More...
 
void addChangeMerged (unsigned)
 Add a merged change to the change buffer. More...
 
void sortChanges ()
 Sorts the changes buffer lexicographically wrt. the hierarchical paths. More...
 
void flushFull ()
 Flush the changes buffer to the output stream with full format. More...
 
void flushMerged ()
 

Private Attributes

llvm::raw_ostream & out
 
std::unique_ptr< State > const & state
 
TraceMode mode
 
Time currentTime
 
std::vector< bool > isTraced
 
std::vector< std::pair< std::string, std::string > > changes
 
std::map< std::pair< unsigned, int >, std::string > mergedChanges
 
std::map< std::pair< std::string, int >, std::string > lastValue
 

Detailed Description

Definition at line 32 of file Trace.h.

Constructor & Destructor Documentation

◆ Trace()

Trace::Trace ( std::unique_ptr< State > const &  state,
llvm::raw_ostream &  out,
TraceMode  mode 
)

Member Function Documentation

◆ addChange()

void Trace::addChange ( unsigned  sigIndex)

◆ addChangeMerged()

void Trace::addChangeMerged ( unsigned  sigIndex)
private

Add a merged change to the change buffer.

Definition at line 94 of file Trace.cpp.

References mergedChanges, and state.

Referenced by addChange().

◆ flush()

void Trace::flush ( bool  force = false)

Flush the changes buffer to the output stream.

The flush can be forced for merged changes, flushing even if the next real-time step has not been reached.

Definition at line 121 of file Trace.cpp.

References currentTime, flushFull(), flushMerged(), circt::llhd::sim::Full, circt::llhd::sim::Time::getTime(), circt::llhd::sim::Merged, circt::llhd::sim::MergedReduce, mode, circt::llhd::sim::NamedOnly, circt::llhd::sim::Reduced, and state.

Referenced by circt::llhd::sim::Engine::simulate().

◆ flushFull()

void Trace::flushFull ( )
private

Flush the changes buffer to the output stream with full format.

Definition at line 130 of file Trace.cpp.

References changes, currentTime, out, sortChanges(), and circt::llhd::sim::Time::toString().

Referenced by flush().

◆ flushMerged()

void Trace::flushMerged ( )
private

◆ pushAllChanges()

void Trace::pushAllChanges ( unsigned  inst,
unsigned  sigIndex 
)
private

Push one change for each element of a signal if it is of a structured type, or the full signal otherwise.

Definition at line 62 of file Trace.cpp.

References pushChange(), and state.

Referenced by addChange().

◆ pushChange()

void Trace::pushChange ( unsigned  inst,
unsigned  sigIndex,
int  elem = -1 
)
private

Push one change to the changes vector.

Definition at line 36 of file Trace.cpp.

References changes, lastValue, and state.

Referenced by flushMerged(), and pushAllChanges().

◆ sortChanges()

void Trace::sortChanges ( )
private

Sorts the changes buffer lexicographically wrt. the hierarchical paths.

Definition at line 113 of file Trace.cpp.

References changes.

Referenced by flushFull(), and flushMerged().

Member Data Documentation

◆ changes

std::vector<std::pair<std::string, std::string> > circt::llhd::sim::Trace::changes
private

Definition at line 40 of file Trace.h.

Referenced by flushFull(), flushMerged(), pushChange(), and sortChanges().

◆ currentTime

Time circt::llhd::sim::Trace::currentTime
private

Definition at line 36 of file Trace.h.

Referenced by addChange(), flush(), flushFull(), and flushMerged().

◆ isTraced

std::vector<bool> circt::llhd::sim::Trace::isTraced
private

Definition at line 38 of file Trace.h.

Referenced by addChange(), and Trace().

◆ lastValue

std::map<std::pair<std::string, int>, std::string> circt::llhd::sim::Trace::lastValue
private

Definition at line 44 of file Trace.h.

Referenced by pushChange().

◆ mergedChanges

std::map<std::pair<unsigned, int>, std::string> circt::llhd::sim::Trace::mergedChanges
private

Definition at line 42 of file Trace.h.

Referenced by addChangeMerged(), and flushMerged().

◆ mode

TraceMode circt::llhd::sim::Trace::mode
private

Definition at line 35 of file Trace.h.

Referenced by addChange(), flush(), flushMerged(), and Trace().

◆ out

llvm::raw_ostream& circt::llhd::sim::Trace::out
private

Definition at line 33 of file Trace.h.

Referenced by flushFull(), and flushMerged().

◆ state

std::unique_ptr<State> const& circt::llhd::sim::Trace::state
private

Definition at line 34 of file Trace.h.

Referenced by addChange(), addChangeMerged(), flush(), flushMerged(), pushAllChanges(), pushChange(), and Trace().


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