53 #define YYSTYPE AadlParserNode 56 static std::string
GetFile(
const std::string& directory,
const std::string&
file)
58 std::string ret =
file;
59 ret = ret.at(0) ==
'"' ? ret.substr(1, ret.size() - 2) : ret;
62 if(!std::filesystem::exists(ret))
68 if(std::filesystem::exists(ret))
72 if(std::filesystem::exists(directory +
"/" + ret))
74 return directory +
"/" + ret;
81 :
parameters(_parameters), debug_level(_parameters->get_class_debug_level(
"AadlParser"))
97 const auto directory = std::filesystem::path(
file_name).parent_path().string();
106 std::set<std::string> input_files;
107 const auto aadl_information = GetPointer<HLS_manager>(
AppM)->aadl_information;
108 for(
const auto& system : data->system_properties)
110 if(system.second.find(
"Source_Language") != system.second.end() and
111 system.second.find(
"Source_Language")->second ==
"VHDL")
113 if(system.second.find(
"Source_Text") != system.second.end())
115 const auto input_file =
GetFile(directory, system.second.find(
"Source_Text")->second);
116 input_files.insert(input_file);
118 if(data->system_features.find(system.first) != data->system_features.end())
120 const auto features = data->system_features.find(system.first)->second;
121 for(
const auto& feature : features)
123 if(feature.second.find(
"Taste::InterfaceName") != feature.second.end())
125 const auto top_functions =
127 const auto function_name = feature.second.find(
"Taste::InterfaceName")->second;
128 const auto without_quota_function_name =
129 function_name.at(0) ==
'"' ? function_name.substr(1, function_name.size() - 2) : function_name;
130 aadl_information->top_functions_names.push_back(without_quota_function_name);
132 ->setOption(OPT_top_functions_names, top_functions + without_quota_function_name);
134 "---Adding top function " + without_quota_function_name);
140 for(
const auto& property : data->package_properties)
142 if(property.second.find(
"Taste::dataViewPath") !=
property.second.end())
144 const auto data_view_file =
GetFile(directory, property.second.find(
"Taste::dataViewPath")->second);
146 input_files.insert(data_view_file);
149 for(
const auto& property : data->data_properties)
151 if(property.second.find(
"Source_Text") !=
property.second.end())
153 const auto data_view_file =
GetFile(directory, property.second.find(
"Source_Text")->second);
155 input_files.insert(data_view_file);
158 for(
const auto& subprogram : data->subprogram_features)
161 for(
const auto& feature : subprogram.second)
167 aadl_parameter.
name = feature.first;
180 aadl_information->function_parameters[subprogram.first].push_back(aadl_parameter);
186 AppM->input_files.insert(
AppM->input_files.end(), input_files.begin(), input_files.end());
187 if(
parameters->getOption<std::list<std::string>>(OPT_top_functions_names).size() > 1)
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
Data structure representing the entire HLS information.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
const std::string file_name
The name of the file to be parsed.
File containing functions and utilities to support the printing of debug messagges.
#define STR_CST_string_separator
The character used to separate concatenated string.
~AadlParser() override
Destuctor.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Definition of the class representing a generic C application.
Specification of the aadl parsing interface function.
AadlParserData(const ParameterConstRef parameters)
Constructor.
Auxiliary methods for manipulating string.
enum ParserFlowStep_Type { } ParserFlowStep_Type
Autoheader include.
void YYParse(const AadlParserDataRef data, const AadlFlexLexerRef lexer) const
Wrapper to yyparse.
#define STR_CST_aadl_parameter_direction
The type of the property storing the direction of a parameter.
utility function used to read files.
header file for LEX based lexer for aadl file.
DesignFlowStep_Status Exec() override
Execute the step.
constants used in aadl parser
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
This file collects some utility functions and macros.
#define STR_CST_aadl_data_view
The name of the package containing type definition.
fileIO_istreamRef fileIO_istream_open(const std::string &name)
this function returns an istream compressed or not.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
#define STR_CST_aadl_parameter_type
The type of the property storing the type of a parameter.
Specification of the data structure associated with a node during aadl parsing.
static std::string GetFile(const std::string &directory, const std::string &file)
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
const application_managerRef AppM
The application manager.
this class is used to manage the command-line or XML options.
AadlParser(const DesignFlowManagerConstRef design_flow_manager, const std::string &file_name, const application_managerRef AppM, const ParameterConstRef parameters)
Constructor.
int debug_level
The debug level.
#define STR_CST_aadl_parameter_endianess
The name of the property storing the endianess of a parameter.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...