PandA-2024.02
|
Functor used to write initialization of the memory throw C instructions added to values.c. More...
#include <memory_initialization_c_writer.hpp>
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... | |
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.
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.
indented_output_stream | is where the C code will be written |
TM | is the tree manager |
behavioral_helper | is the behavioral helper |
reserved_mem_bytes | is the number of bytes to be written |
function_parameter | is the function parameter whose initialization is being printed |
testbench_generation_memory_type | is the type of initialization being printed |
parameters | is 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.
|
overridevirtual |
In case the test_v has a size over a threshold write the tests on a file.
filename | is 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.
|
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.
|
overridevirtual |
Process an element.
content | is the string assocated with the string |
Second, according to the type let's how many elements have to have been processed
Implements CInitializationParserFunctor.
Definition at line 84 of file memory_initialization_c_writer.cpp.
References IndentedOutputStream::Append(), MemoryInitializationWriterBase::behavioral_helper, 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, ConvertInBinary(), CInitializationParserFunctor::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, MemoryInitializationWriterBase::function_parameter, GET_CONST_NODE, INDENT_DBG_MEX, indented_output_stream, INPUT_PARAMETER, is_all_8zeros(), tree_helper::IsUnsignedIntegerType(), memory_init_file, MEMORY_INITIALIZATION, NODE_NOT_YET_SUPPORTED_EC, OUTPUT_PARAMETER, BehavioralHelper::PrintVariable(), RETURN, tree_helper::Size(), MemoryInitializationWriterBase::status, STR, MemoryInitializationWriterBase::testbench_generation_memory_type, THROW_ASSERT, THROW_ERROR, THROW_ERROR_CODE, THROW_UNREACHABLE, CInitializationParserFunctor::write_in_a_file, and MemoryInitializationWriterBase::written_bytes.
|
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().
|
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().