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

Functor used to write initialization of the memory throw C instructions added to values.c. More...

#include <memory_initialization_c_writer.hpp>

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

Public Member Functions

 MemoryInitializationCWriter (const IndentedOutputStreamRef indented_output_stream, 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 Process (const std::string &content) override
 Process an element. More...
 
void ActivateFileInit (const std::string &filename) override
 In case the test_v has a size over a threshold write the tests on a file. More...
 
void FinalizeFileInit () override
 Copy and close the file. More...
 
- Public Member Functions inherited from 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. 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...
 

Protected Attributes

const IndentedOutputStreamRef indented_output_stream
 The stream where C code has to be written. More...
 
std::ofstream memory_init_file
 temporary file used to store the formatted memory values More...
 
- Protected Attributes inherited from MemoryInitializationWriterBase
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...
 

Additional Inherited Members

- Protected Member Functions inherited from MemoryInitializationWriterBase
const std::string PrintStatus () const
 Print the current status. More...
 

Detailed Description

Functor used to write initialization of the memory throw C instructions added to values.c.

Definition at line 53 of file memory_initialization_c_writer.hpp.

Constructor & Destructor Documentation

◆ MemoryInitializationCWriter()

MemoryInitializationCWriter::MemoryInitializationCWriter ( const IndentedOutputStreamRef  _indented_output_stream,
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
indented_output_streamis where the C code will be written
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 tree includes utility includes

Definition at line 55 of file memory_initialization_c_writer.cpp.

References CInitializationParserFunctor::debug_level, and GET_CLASS.

Member Function Documentation

◆ ActivateFileInit()

void MemoryInitializationCWriter::ActivateFileInit ( const std::string &  filename)
overridevirtual

In case the test_v has a size over a threshold write the tests on a file.

Parameters
filenameis the filename to use

Implements CInitializationParserFunctor.

Definition at line 296 of file memory_initialization_c_writer.cpp.

References CInitializationParserFunctor::file_variable, flopoco::filename, memory_init_file, and CInitializationParserFunctor::write_in_a_file.

◆ FinalizeFileInit()

void MemoryInitializationCWriter::FinalizeFileInit ( )
overridevirtual

Copy and close the file.

Implements CInitializationParserFunctor.

Definition at line 303 of file memory_initialization_c_writer.cpp.

References IndentedOutputStream::Append(), CInitializationParserFunctor::file_variable, and indented_output_stream.

Here is the call graph for this function:

◆ Process()

void MemoryInitializationCWriter::Process ( const std::string &  content)
overridevirtual

Field Documentation

◆ indented_output_stream

const IndentedOutputStreamRef MemoryInitializationCWriter::indented_output_stream
protected

The stream where C code has to be written.

Definition at line 57 of file memory_initialization_c_writer.hpp.

Referenced by FinalizeFileInit(), and Process().

◆ memory_init_file

std::ofstream MemoryInitializationCWriter::memory_init_file
protected

temporary file used to store the formatted memory values

Definition at line 60 of file memory_initialization_c_writer.hpp.

Referenced by ActivateFileInit(), and 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