HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::SaleaeParser Class Reference

The SaleaeParser class is an engine which allows to parse any number of SALEAE files into a sequence of events ordered by time. The SaleaeParser is used in the following way: More...

#include </home/runner/work/hal/hal/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/saleae_parser.h>

Collaboration diagram for hal::SaleaeParser:
Collaboration graph

Public Member Functions

 SaleaeParser (const std::string &filename)
 
uint64_t get_max_time () const
 Get last simulated time from SALEAE directory. More...
 
bool register_callback (const std::string &name, uint32_t id, std::function< void(void *, uint64_t, int)> callback, void *obj)
 Registers callback which gets executed upon next_event() More...
 
bool register_callback (const Net *net, std::function< void(void *, uint64_t, int)> callback, void *obj)
 Registers callback which gets executed upon next_event() More...
 
bool next_event ()
 Call to parser to deliver next event via registered callbacks (see above). More...
 
SaleaeDirectory get_directory () const
 Getter for SALEAE directory instance. More...
 

Static Public Attributes

static uint64_t sTimeScaleFactor = 1000000000
 conversion factor to be applied when converting double values from original SALEAE file to integer values More...
 

Detailed Description

The SaleaeParser class is an engine which allows to parse any number of SALEAE files into a sequence of events ordered by time. The SaleaeParser is used in the following way:

  • Create an instance of parser with filename of SALEAE directory as mandatory argument.
  • Register callback for each waveform events are requested. The callback function must have three mandatory arguments :
    1) A parser-dont-care object that helps the callback function to identify the waveform.
    2) Event time.
    3) Waveform value.
  • Repeat: call next_event() until function returns false.

Definition at line 73 of file saleae_parser.h.

Constructor & Destructor Documentation

◆ SaleaeParser()

hal::SaleaeParser::SaleaeParser ( const std::string &  filename)

Constructor for SaleaeParser

Parameters
filenameFull path and filename of SALEAE directory file

Definition at line 19 of file saleae_parser.cpp.

Member Function Documentation

◆ get_directory()

SaleaeDirectory hal::SaleaeParser::get_directory ( ) const
inline

Getter for SALEAE directory instance.

Definition at line 121 of file saleae_parser.h.

◆ get_max_time()

uint64_t hal::SaleaeParser::get_max_time ( ) const

Get last simulated time from SALEAE directory.

Definition at line 64 of file saleae_parser.cpp.

References hal::SaleaeDirectory::get_max_time().

◆ next_event()

bool hal::SaleaeParser::next_event ( )

Call to parser to deliver next event via registered callbacks (see above).

Definition at line 38 of file saleae_parser.cpp.

References hal::SaleaeDataTuple::mTime, hal::SaleaeDataTuple::mValue, and hal::SaleaeDataTuple::readError().

Referenced by hal::SimulationThread::run().

◆ register_callback() [1/2]

bool hal::SaleaeParser::register_callback ( const Net net,
std::function< void(void *, uint64_t, int)>  callback,
void *  obj 
)

Registers callback which gets executed upon next_event()

Parameters
netNet pointer corresponding to waveform for which callback gets registered
callbackCallback function with three mandatory arguments
objPointer to any object (e.g. net) that might be useful for callback function to identify net or waveform
Returns
true if callback was registered successfully, false otherwise (e.g. if net was not found in SALEAE directory)

Definition at line 69 of file saleae_parser.cpp.

References net, and register_callback().

◆ register_callback() [2/2]

bool hal::SaleaeParser::register_callback ( const std::string &  name,
uint32_t  id,
std::function< void(void *, uint64_t, int)>  callback,
void *  obj 
)

Registers callback which gets executed upon next_event()

Parameters
nameNet/Waveform name for which callback gets registered
idNet/Waveform ID for which callback gets registered
callbackCallback function with three mandatory arguments
objPointer to any object (e.g. net) that might be useful for callback function to identify net or waveform
Returns
true if callback was registered successfully, false otherwise (e.g. if net was not found in SALEAE directory)

Definition at line 74 of file saleae_parser.cpp.

References hal::SaleaeDirectory::get_datafile_path(), hal::SaleaeInputFile::get_last_error(), hal::SaleaeInputFile::get_next_value(), and name.

Referenced by hal::VcdSerializer::exportCsv(), hal::VcdSerializer::exportVcd(), hal::WavedataTableEditor::loadWaveData(), register_callback(), hal::SimulationThread::run(), hal::WaveDataProviderGroup::WaveDataProviderGroup(), and hal::WaveDataProviderTrigger::WaveDataProviderTrigger().

Member Data Documentation

◆ sTimeScaleFactor

uint64_t hal::SaleaeParser::sTimeScaleFactor = 1000000000
static

conversion factor to be applied when converting double values from original SALEAE file to integer values

Definition at line 124 of file saleae_parser.h.

Referenced by hal::SaleaeInputFile::get_buffered_data(), hal::SaleaeHeader::read(), hal::SaleaeInputFile::SaleaeInputFile(), and hal::NetlistSimulatorController::set_saleae_timescale().


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