70 const unsigned long int _reserved_mem_bytes,
const tree_nodeConstRef _function_parameter,
73 _testbench_generation_memory_type, _parameters),
74 output_stream(_output_stream)
82 "-->Writing " + content +
" in binary form to initialize memory");
94 base_type =
status.back().first;
103 case function_type_K:
108 case qual_union_type_K:
109 case reference_type_K:
111 case template_type_parm_K:
112 case typename_type_K:
113 case type_argument_pack_K:
114 case type_pack_expansion_K:
117 THROW_ERROR(
"Unexpected type in initializing parameter/variable: " +
120 case aggr_init_expr_K:
124 case case_label_expr_K:
127 case identifier_node_K:
129 case statement_list_K:
131 case target_mem_ref_K:
132 case target_mem_ref461_K:
151 std::string binary_value =
"";
152 unsigned long long size = 0;
167 case enumeral_type_K:
171 case function_type_K:
176 case qual_union_type_K:
177 case reference_type_K:
179 case template_type_parm_K:
180 case typename_type_K:
181 case type_argument_pack_K:
182 case type_pack_expansion_K:
185 THROW_ERROR(
"Unexpected type in initializing parameter/variable: " +
188 case aggr_init_expr_K:
192 case case_label_expr_K:
195 case identifier_node_K:
197 case statement_list_K:
199 case target_mem_ref_K:
200 case target_mem_ref461_K:
216 "Not supported node: " +
GET_CONST_NODE(base_type)->get_kind_text());
224 <<
" value: " << content << std::endl;
230 << content << std::endl;
231 for(
size_t bit = 0; bit < binary_value.size(); bit += 8)
233 output_stream <<
"o" << binary_value.substr(binary_value.size() - 8 - bit, 8) << std::endl;
240 for(
size_t bit = 0; bit < binary_value.size(); bit += 8)
242 output_stream <<
"m" << binary_value.substr(binary_value.size() - 8 - bit, 8) << std::endl;
248 output_stream <<
"//expected value for return value" << std::endl;
260 "<--Written " + content +
" (" +
STR(binary_value.size() / 8) +
261 " bytes) in binary form to initialize memory");
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
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;.
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.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
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...
#define CASE_DECL_NODES
NOTE that cast_expr is a unary expression but it could not be included in the CASE_UNARY_EXPRESSION b...
Functor used to write initialization of the memory writer.
Generate HDL testbench for the top-level kernel testing.
exceptions managed by PandA
std::string ConvertInBinary(const std::string &C_value, unsigned long long precision, const bool real_type, bool unsigned_type)
Convert a string storing a number in decimal format into a string in binary format.
unsigned long int written_bytes
The number of bytes currently written.
#define STR(s)
Macro which performs a lexical_cast to a string.
void Process(const std::string &content) override
Process an element.
Functor used to write initialization of the memory.
static bool IsUnsignedIntegerType(const tree_nodeConstRef &type)
Return true if the treenode is of unsigned integer type.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
static unsigned long long Size(const tree_nodeConstRef &tn)
Return the size of a tree object.
#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.
const BehavioralHelperConstRef behavioral_helper
The behavioral helper.
#define GET_CONST_NODE(t)
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
std::string PrintVariable(unsigned int var) const
Print the name of the variable associated to the index.
MemoryInitializationWriter(std::ofstream &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.
This file collects some utility functions.
#define CASE_CST_NODES
This macro collects all case labels for cast nodes.
Class specification of the tree_reindex support class.
#define CASE_FAKE_NODES
This macro collects all case labels for fake or empty nodes.
std::ofstream & output_stream
The stream corresponding to the memory initialization file.
const TestbenchGeneration_MemoryType testbench_generation_memory_type
The type of initialization being written.
#define THROW_ERROR_CODE(code, str_expr)
helper function used to throw an error with a code error
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.
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.
#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 ...