text
stringlengths
0
252
string_type = split_line[6];
}
permission_flag = 1;
}
else if ((string_finder(line, CAT)) && (permission_flag)){
string_name = line;
split_line = split(string_name,' ');
string_name = replace_first_occurrence(split_line[6],";","");
filter_element(string_name, {"*","&"});
name_type.first = string_name;
name_type.second = string_type;
permission_flag=0;
set_static_data_var ("sc_main", name_type);
}
}
else{
return 1;
}
}
}
else
cout << "\033[1;31mUnable to open Debug Symbol file\033[0m\n";
return 0;
}
//----------------------------------------------------------
bool ScMain::find_scmain (ifstream &debugSymbol){
string line;
bool finish = 0;
unsigned int line_num = 0;
if (debugSymbol.is_open()){
while (getline (debugSymbol,line)){
line_num++;
if (string_finder(line, BLOCK) && string_finder(line, SCMAIN)){
cout << "\033[1;32mStarting sc_main() variables extraction...\033[0m\n";
finish = find_scmain_elements (debugSymbol, line_num);
if (finish){
cout << "\033[1;32msc_main() variables extraction is dine!\033[0m\n";
cout << "\033[1;32mStarting module extraction...\033[0m\n";
find_module (debugSymbol, line_num);
cout << "\033[1;32mModule extraction is done!\033[0m\n";
GotoLine(debugSymbol, 0); //-------start from begining of file
cout << "\033[1;32mStarting local variables extraction...\033[0m\n";
set_func_localVar(debugSymbol);
cout << "\033[1;32mLocal variables extraction is done!\033[0m\n";
return 1;
}
else{
cout << "\033[1;31mCould not find sc_main() function\033[0m\n";
return 0;
}
}
}
}
else{
cout << "\033[1;31mUnable to open Debug Symbol file\033[0m\n";
return 0;
}
}
//----------------------------------------------------------
void ScMain::find_module (ifstream &debugSymbol, unsigned int lineNum){
GotoLine(debugSymbol, lineNum);
string line, module_name;
vector<string> split_line;
if (debugSymbol.is_open()){
while (getline(debugSymbol, line)) {
lineNum++;
if((string_finder(line, STRUCT)) && (string_finder(line, SCMODULE)) && (!string_finder(line, "::_")) && (!string_finder(line, BLOCK)) && (!string_finder(line, CONSTRUCT)) && (!string_finder(line, "*"))){
split_line = split(line,' ');
remove_element_vector(split_line, "");
if (string_finder(line, ">")) //--- for template type
module_name = split_line[1]+" "+split_line[2];
else
module_name = split_line[1];
if ((!string_finder(module_name, CLASS)) && (!string_finder(module_name, CONST)) && (!string_finder(module_name, SCCORE))){ //---ignoring pre-defined systemc module and function
find_module_elements(debugSymbol,lineNum, module_name);
GotoLine(debugSymbol, lineNum); //------------------return back to the line number where module defined
}
}
}
}
else
cout << "\033[1;31mUnable to open Debug Symbol file\033[0m\n";
}
//----------------------------------------------------------
void ScMain::find_module_elements (ifstream &debugSymbol, unsigned int lineNum, string m_name){
NT VarNameType;
NT FuncNameType;
GotoLine(debugSymbol, lineNum);
string line, string_type;