PandA-2024.02
Public Member Functions | Protected Member Functions | Protected Attributes
MemoryInitializationWriterBase Class Reference

Functor used to write initialization of the memory writer. More...

#include <memory_initialization_writer_base.hpp>

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

Public Member Functions

 MemoryInitializationWriterBase (const tree_managerConstRef TM, const BehavioralHelperConstRef behavioral_helper, const unsigned long int reserved_mem_bytes, const tree_nodeConstRef function_parameter, const TestbenchGeneration_MemoryType testbench_generation_memory_type, const ParameterConstRef parameters)
 Constructor. More...
 
void CheckEnd () override
 Check that all the necessary information was present in the initialization string. More...
 
void GoDown () override
 Start the initialization of a new aggregated data structure. More...
 
void GoNext () override
 Consume an element of an aggregated data structure. More...
 
void GoUp () override
 Ends the initialization of the current aggregated data structure. More...
 
- Public Member Functions inherited from CInitializationParserFunctor
 CInitializationParserFunctor ()
 Constructor. More...
 
virtual ~CInitializationParserFunctor ()
 Destructor. More...
 
virtual void Process (const std::string &content)=0
 Process an element. More...
 
virtual void ActivateFileInit (const std::string &filename)=0
 In case the test_v has a size over a threshold write the tests on a file. More...
 
virtual void FinalizeFileInit ()=0
 Copy and close the file. More...
 

Protected Member Functions

const std::string PrintStatus () const
 Print the current status. More...
 

Protected Attributes

const tree_managerConstRef TM
 The tree manager. More...
 
const BehavioralHelperConstRef behavioral_helper
 The behavioral helper. More...
 
const unsigned long int reserved_mem_bytes
 The number of bytes to be written. More...
 
unsigned long int written_bytes
 The number of bytes currently written. More...
 
std::vector< std::pair< const tree_nodeConstRef, size_t > > status
 The stack representing the current status of the parser; the content is the last dumped element. More...
 
const tree_nodeConstRef function_parameter
 The variable/parameter being printed. More...
 
const TestbenchGeneration_MemoryType testbench_generation_memory_type
 The type of initialization being written. More...
 
- Protected Attributes inherited from CInitializationParserFunctor
int debug_level
 The debug level. More...
 
bool write_in_a_file
 the data will be written in a data copied by the caller More...
 
std::string file_variable
 variable used to write in a variable More...
 

Detailed Description

Functor used to write initialization of the memory writer.

Definition at line 65 of file memory_initialization_writer_base.hpp.

Constructor & Destructor Documentation

◆ MemoryInitializationWriterBase()

MemoryInitializationWriterBase::MemoryInitializationWriterBase ( const tree_managerConstRef  _TM,
const BehavioralHelperConstRef  _behavioral_helper,
const unsigned long int  _reserved_mem_bytes,
const tree_nodeConstRef  _function_parameter,
const TestbenchGeneration_MemoryType  _testbench_generation_memory_type,
const ParameterConstRef  parameters 
)

Constructor.

Header include.

Parameters
TMis the tree manager
behavioral_helperis the behavioral helper
reserved_mem_bytesis the number of bytes to be written
function_parameteris the function parameter whose initialization is being printed
testbench_generation_memory_typeis the type of initialization being printed
parametersis the set of input parameters

. include HLS/simulation include STD include STL include tree includes utility include

Definition at line 68 of file memory_initialization_writer_base.cpp.

References tree_helper::CGetType(), function_parameter, and status.

Here is the call graph for this function:

Member Function Documentation

◆ CheckEnd()

void MemoryInitializationWriterBase::CheckEnd ( )
overridevirtual

Check that all the necessary information was present in the initialization string.

First of all we have to check that there is just one element in the stack

Implements CInitializationParserFunctor.

Definition at line 83 of file memory_initialization_writer_base.cpp.

References PrintStatus(), reserved_mem_bytes, status, STR, THROW_ERROR, and written_bytes.

Here is the call graph for this function:

◆ GoDown()

void MemoryInitializationWriterBase::GoDown ( )
overridevirtual

◆ GoNext()

void MemoryInitializationWriterBase::GoNext ( )
overridevirtual

Consume an element of an aggregated data structure.

We have read a field of record, move to the next field, if any

Check if there is at least another field

Implements CInitializationParserFunctor.

Definition at line 219 of file memory_initialization_writer_base.cpp.

References tree_helper::CGetFieldTypes(), CInitializationParserFunctor::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_CONST_NODE, INDENT_DBG_MEX, tree_helper::IsArrayEquivType(), tree_helper::IsPointerType(), tree_helper::IsStructType(), PrintStatus(), status, and THROW_ASSERT.

Here is the call graph for this function:

◆ GoUp()

void MemoryInitializationWriterBase::GoUp ( )
overridevirtual

Ends the initialization of the current aggregated data structure.

Second, according to the type let's how many elements have to have been processed

parameters cannot have this type, but global variables can

Actually the expected size is unknown

Actual size depends on the pointed type

Implements CInitializationParserFunctor.

Definition at line 96 of file memory_initialization_writer_base.cpp.

References CASE_BINARY_EXPRESSION, CASE_CPP_NODES, CASE_CST_NODES, CASE_DECL_NODES, CASE_FAKE_NODES, CASE_GIMPLE_NODES, CASE_PRAGMA_NODES, CASE_QUATERNARY_EXPRESSION, CASE_TERNARY_EXPRESSION, CASE_UNARY_EXPRESSION, tree_helper::CGetFieldTypes(), CInitializationParserFunctor::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_CONST_NODE, tree_helper::GetArrayDimensions(), INDENT_DBG_MEX, NODE_NOT_YET_SUPPORTED_EC, PrintStatus(), status, STR, THROW_ASSERT, THROW_ERROR, and THROW_ERROR_CODE.

Here is the call graph for this function:

◆ PrintStatus()

const std::string MemoryInitializationWriterBase::PrintStatus ( ) const
protected

Print the current status.

Definition at line 250 of file memory_initialization_writer_base.cpp.

References GET_CONST_NODE, level, status, and STR.

Referenced by CheckEnd(), GoDown(), GoNext(), and GoUp().

Here is the caller graph for this function:

Field Documentation

◆ behavioral_helper

const BehavioralHelperConstRef MemoryInitializationWriterBase::behavioral_helper
protected

The behavioral helper.

Definition at line 72 of file memory_initialization_writer_base.hpp.

Referenced by MemoryInitializationCWriter::Process(), and MemoryInitializationWriter::Process().

◆ function_parameter

const tree_nodeConstRef MemoryInitializationWriterBase::function_parameter
protected

◆ reserved_mem_bytes

const unsigned long int MemoryInitializationWriterBase::reserved_mem_bytes
protected

The number of bytes to be written.

Definition at line 75 of file memory_initialization_writer_base.hpp.

Referenced by CheckEnd().

◆ status

std::vector<std::pair<const tree_nodeConstRef, size_t> > MemoryInitializationWriterBase::status
protected

The stack representing the current status of the parser; the content is the last dumped element.

First element of the pair is the tree node describing the type, the second element of the pair is the number of the field (for struct/union) or of the element (for array) Second element is the number of seen elements (index of the last element + 1) Note that storing last element dumped is equivalent to store next element to be dumped, but this approach make easier check of closes parenthesis

Definition at line 85 of file memory_initialization_writer_base.hpp.

Referenced by CheckEnd(), GoDown(), GoNext(), GoUp(), MemoryInitializationWriterBase(), PrintStatus(), MemoryInitializationCWriter::Process(), and MemoryInitializationWriter::Process().

◆ testbench_generation_memory_type

const TestbenchGeneration_MemoryType MemoryInitializationWriterBase::testbench_generation_memory_type
protected

The type of initialization being written.

Definition at line 91 of file memory_initialization_writer_base.hpp.

Referenced by MemoryInitializationCWriter::Process(), and MemoryInitializationWriter::Process().

◆ TM

const tree_managerConstRef MemoryInitializationWriterBase::TM
protected

The tree manager.

Definition at line 69 of file memory_initialization_writer_base.hpp.

◆ written_bytes

unsigned long int MemoryInitializationWriterBase::written_bytes
protected

The number of bytes currently written.

Definition at line 78 of file memory_initialization_writer_base.hpp.

Referenced by CheckEnd(), MemoryInitializationCWriter::Process(), and MemoryInitializationWriter::Process().


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

Generated on Mon Feb 12 2024 13:03:57 for PandA-2024.02 by doxygen 1.8.13