70 const unsigned long int _reserved_mem_bytes,
const tree_nodeConstRef _function_parameter,
73 behavioral_helper(_behavioral_helper),
74 reserved_mem_bytes(_reserved_mem_bytes),
76 function_parameter(_function_parameter),
77 testbench_generation_memory_type(_testbench_generation_memory_type)
80 status.push_back(std::make_pair(parameter_type, 0));
101 size_t expected_size = 0;
111 expected_size = array_dims.front();
120 case reference_type_K:
128 if(expected_size > 1)
135 case enumeral_type_K:
138 case function_type_K:
143 case qual_union_type_K:
145 case template_type_parm_K:
146 case typename_type_K:
147 case type_argument_pack_K:
148 case type_pack_expansion_K:
151 THROW_ERROR(
"Unexpected type in initializing parameter/variable: " +
154 case aggr_init_expr_K:
158 case case_label_expr_K:
161 case identifier_node_K:
163 case statement_list_K:
165 case target_mem_ref_K:
166 case target_mem_ref461_K:
184 if(expected_size != 0 && (expected_size !=
status.back().second))
186 THROW_ERROR(
"Missing data in C initialization for node of type " +
201 return fields[
status.back().second];
215 status.push_back(std::make_pair(new_type, 0));
223 const auto& upper_type =
status[
status.size() - 2].first;
232 const auto read_fields =
status[
status.size() - 2].second;
237 const auto new_type = record_fields[
status[
status.size() - 1].second];
238 status.push_back(std::make_pair(new_type, 0));
static std::vector< tree_nodeConstRef > CGetFieldTypes(const tree_nodeConstRef &type)
Return the fields type of a variable of type struct.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
static bool IsUnionType(const tree_nodeConstRef &type)
Return if treenode is an union.
int debug_level
The debug level.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
static std::vector< unsigned long long > GetArrayDimensions(const tree_nodeConstRef &node)
Return the dimension of the array.
File containing functions and utilities to support the printing of debug messagges.
const tree_nodeConstRef function_parameter
The variable/parameter being printed.
#define CASE_BINARY_EXPRESSION
This macro collects all case labels for binary_expr objects.
const unsigned long int reserved_mem_bytes
The number of bytes to be written.
void GoUp() override
Ends the initialization of the current aggregated data structure.
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...
static bool IsArrayEquivType(const tree_nodeConstRef &type)
Return true if treenode is an array or it is equivalent to an array (record recursively having a sing...
#define CASE_DECL_NODES
NOTE that cast_expr is a unary expression but it could not be included in the CASE_UNARY_EXPRESSION b...
static tree_nodeConstRef CGetElements(const tree_nodeConstRef &type)
Given an array or a vector return the element type.
Generate HDL testbench for the top-level kernel testing.
exceptions managed by PandA
const std::string PrintStatus() const
Print the current status.
unsigned long int written_bytes
The number of bytes currently written.
#define STR(s)
Macro which performs a lexical_cast to a string.
static bool IsArrayType(const tree_nodeConstRef &type)
Return true if treenode is an array.
#define CASE_QUATERNARY_EXPRESSION
This macro collects all case labels for quaternary_expr objects.
#define CASE_UNARY_EXPRESSION
This macro collects all case labels for unary_expr objects.
Abstract base class for functor used to write initialization of the memory.
#define GET_CONST_NODE(t)
refcount< const tree_node > tree_nodeConstRef
Classes specification of the tree_node data structures.
This file collects some utility functions and macros.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
This file collects some utility functions.
void CheckEnd() override
Check that all the necessary information was present in the initialization string.
#define CASE_CST_NODES
This macro collects all case labels for cast nodes.
struct definition of the type node structures.
Class specification of the tree_reindex support class.
#define CASE_FAKE_NODES
This macro collects all case labels for fake or empty nodes.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
static tree_nodeConstRef CGetType(const tree_nodeConstRef &node)
Return the treenode of the type of node.
static bool IsStructType(const tree_nodeConstRef &type)
Return true if treenode is a record.
#define THROW_ERROR_CODE(code, str_expr)
helper function used to throw an error with a code error
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.
static tree_nodeConstRef CGetPointedType(const tree_nodeConstRef &pointer)
Return the pointed type of a pointer object.
this class is used to manage the command-line or XML options.
#define CASE_CPP_NODES
This macro collects all case labels for cpp nodes.
#define CASE_GIMPLE_NODES
This macro collects all cases labels for gimple nodes.
static bool IsPointerType(const tree_nodeConstRef &type)
Return true if treenode index is a pointer.
void GoNext() override
Consume an element of an aggregated data structure.
TestbenchGeneration_MemoryType
Enum class used to specify which type of content has to be printed for memory initialization.
#define CASE_TERNARY_EXPRESSION
This macro collects all case labels for ternary_expr objects.
Class specification of the manager of the tree structures extracted from the raw file.
void GoDown() override
Start the initialization of a new aggregated data structure.
#define CASE_PRAGMA_NODES
This macro collects all case labels for pragma objects.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...