Commit bab83327 authored by Twiga's avatar Twiga
Browse files

Rename private/protected variable.

parent cb3f09bd
#!/bin/bash
##===================================================================
##
## It is important to use this script to set all the necessary paths.
......
......@@ -5,9 +5,6 @@
using namespace scpar;
using namespace std;
//#include "json.hpp"
//using json = nlohmann:json;
Model::Model() {
}
......@@ -15,34 +12,34 @@ Model::Model() {
Model::~Model() {
// llvm::errs() << "\n[[ Destructor Model ]]\n";
// Delete all ModuleDecl pointers.
for (Model::moduleMapType::iterator mit = _modules.begin();
mit != _modules.end(); mit++) {
for (Model::moduleMapType::iterator mit = modules_.begin();
mit != modules_.end(); mit++) {
// Second is the ModuleDecl type.
delete mit->second;
}
_modules.clear();
modules_.clear();
}
Model::Model( const Model & from ) {
_modules = from._modules;
modules_ = from.modules_;
}
void Model::addModuleDecl( ModuleDecl * md ) {
_modules.insert( Model::modulePairType( md->getName(), md ) );
modules_.insert( Model::modulePairType( md->getName(), md ) );
}
void Model::addModuleDeclInstances( ModuleDecl* md, vector<ModuleDecl*> mdVec ) {
_moduleInstanceMap.insert(moduleInstancePairType(md, mdVec));
module_instance_map_.insert(moduleInstancePairType(md, mdVec));
}
void Model::addSimulationTime(FindSimTime::simulationTimeMapType simTime) {
_simTime = simTime;
simulation_time_ = simTime;
}
void Model::addEntryFunctionGPUMacroMap(entryFunctionGPUMacroMapType e) {
//_entryFunctionGPUMacroMap.insert(e.begin(), e.end());
_entryFunctionGPUMacroMap = e;
llvm::errs()<<" \n Size : " <<_entryFunctionGPUMacroMap.size()<<" " <<e.size();
//entry_function_gpu_macro_map_.insert(e.begin(), e.end());
entry_function_gpu_macro_map_ = e;
llvm::errs()<<" \n Size : " <<entry_function_gpu_macro_map_.size()<<" " <<e.size();
}
......@@ -52,34 +49,34 @@ void Model::addGlobalEvents(FindGlobalEvents::globalEventMapType eventMap) {
string eventName = it->first;
EventContainer *event = new EventContainer(eventName, it->second);
_eventMap.insert(eventPairType(eventName, event));
event_map_.insert(eventPairType(eventName, event));
}
}
void Model::addSCMain(FunctionDecl *fnDecl) {
_scmainFcDecl = fnDecl;
scmain_function_decl_ = fnDecl;
}
void Model::addNetlist( FindNetlist &n ) {
_instanceModuleMap = n.getInstanceModuleMap();
_portSignalMap = n.getPortSignalMap();
_instancePortSignalMap = n.getInstancePortSignalMap();
_instanceListModuleMap = n.getInstanceListModuleMap();
instance_module_map_ = n.getInstanceModuleMap();
port_signal_map_ = n.getPortSignalMap();
port_signal_instance_map_ = n.getInstancePortSignalMap();
module_instance_list_ = n.getInstanceListModuleMap();
updateModuleDecl();
}
void Model::updateModuleDecl() {
for (moduleMapType::iterator it = _modules.begin(), eit = _modules.end();
for (moduleMapType::iterator it = modules_.begin(), eit = modules_.end();
it != eit; it++) {
string moduleName = it->first;
ModuleDecl *md = it->second;
vector<string> instanceList;
llvm::errs() << "Finding instances for " << moduleName << " declaration: ";
if ( _instanceListModuleMap.find(moduleName) != _instanceListModuleMap.end() ) {
FindNetlist::instanceListModuleMapType::iterator instanceListModuleMapFind = _instanceListModuleMap.find(moduleName);
if ( module_instance_list_.find(moduleName) != module_instance_list_.end() ) {
FindNetlist::instanceListModuleMapType::iterator instanceListModuleMapFind = module_instance_list_.find(moduleName);
md->addInstances(instanceListModuleMapFind->second);
// Print the names of all the instances
......@@ -89,8 +86,8 @@ void Model::updateModuleDecl() {
llvm::errs() << "\n";
for (size_t i = 0 ; i < instanceListModuleMapFind->second.size(); i++) {
if (_instancePortSignalMap.find(instanceListModuleMapFind->second.at(i)) != _instancePortSignalMap.end()) {
FindNetlist::instancePortSignalMapType::iterator portSignalMapFound = _instancePortSignalMap.find(instanceListModuleMapFind->second.at(i));
if (port_signal_instance_map_.find(instanceListModuleMapFind->second.at(i)) != port_signal_instance_map_.end()) {
FindNetlist::instancePortSignalMapType::iterator portSignalMapFound = port_signal_instance_map_.find(instanceListModuleMapFind->second.at(i));
FindNetlist::portSignalMapType portSignalMap = portSignalMapFound->second;
md->addSignalBinding(portSignalMap);
......@@ -116,36 +113,36 @@ void Model::addSCModules(SCModules * m)
Model::moduleMapType Model::getModuleDecl()
{
return _modules;
return modules_;
}
Model::entryFunctionGPUMacroMapType Model::getEntryFunctionGPUMacroMap() {
llvm::errs()<<"\n return Size : " <<_entryFunctionGPUMacroMap.size();
return _entryFunctionGPUMacroMap;
llvm::errs()<<"\n return Size : " <<entry_function_gpu_macro_map_.size();
return entry_function_gpu_macro_map_;
}
Model::moduleInstanceMapType Model::getModuleInstanceMap() {
return _moduleInstanceMap;
return module_instance_map_;
}
Model::eventMapType Model::getEventMapType()
{
return _eventMap;
return event_map_;
}
unsigned int Model::getNumEvents() {
return (_eventMap.size() - 3);
return (event_map_.size() - 3);
}
void Model::dump( llvm::raw_ostream & os ) {
os << "\n# Number of modules : " << _modules.size();
os << "\n# Number of modules : " << modules_.size();
for (Model::moduleMapType::iterator mit = _modules.begin();
mit != _modules.end(); mit++) {
for (Model::moduleMapType::iterator mit = modules_.begin();
mit != modules_.end(); mit++) {
// Second is the ModuleDecl type.
vector<ModuleDecl*> instanceVec = _moduleInstanceMap[mit->second];
vector<ModuleDecl*> instanceVec = module_instance_map_[mit->second];
os << "\n# Module " << mit->first << ": " << instanceVec.size() << " instances.";
for (size_t i = 0; i < instanceVec.size(); i++) {
// os <<", instance: " << i + 1 << " ";
......@@ -154,28 +151,28 @@ void Model::dump( llvm::raw_ostream & os ) {
}
os << "\n\n";
os << "# Global events:\n";
for (Model::eventMapType::iterator it = _eventMap.begin(), ite =
_eventMap.end(); it != ite; it++) {
for (Model::eventMapType::iterator it = event_map_.begin(), ite =
event_map_.end(); it != ite; it++) {
os << " Event: " << it->first << " VarDecl: " << it->second << "\n";
}
os << "\n";
os << "# Simulation time: ";
for (FindSimTime::simulationTimeMapType::iterator it =
_simTime.begin(), eit = _simTime.end(); it != eit; it++) {
simulation_time_.begin(), eit = simulation_time_.end(); it != eit; it++) {
os << it->first << " " << it->second;
}
os << "\n\n";
os <<"# Netlist: " ;
for (FindNetlist::instanceModuleMapType::iterator it = _instanceModuleMap.begin(), eit = _instanceModuleMap.end(); it != eit; it++) {
for (FindNetlist::instanceModuleMapType::iterator it = instance_module_map_.begin(), eit = instance_module_map_.end(); it != eit; it++) {
os << "\n";
os << "Instance Name: " << it->first << ", module name : " << it->second;
string instanceName = it->first;
if (_instancePortSignalMap.find(instanceName) !=
_instancePortSignalMap.end()) {
if (port_signal_instance_map_.find(instanceName) !=
port_signal_instance_map_.end()) {
FindNetlist::instancePortSignalMapType::iterator instancePortSignalMapFound =
_instancePortSignalMap.find(instanceName);
port_signal_instance_map_.find(instanceName);
FindNetlist::portSignalMapType portSignalMap =
instancePortSignalMapFound->second;
for (FindNetlist::portSignalMapType::iterator pit =
......
......@@ -20,14 +20,14 @@ namespace scpar {
class Model {
public:
typedef pair < string, ModuleDecl * >modulePairType;
typedef map < string, ModuleDecl * >moduleMapType;
typedef pair < string, ModuleDecl * > modulePairType;
typedef map < string, ModuleDecl * > moduleMapType;
typedef pair < string, EventContainer * >eventPairType;
typedef map < string, EventContainer * >eventMapType;
typedef pair < string, EventContainer * > eventPairType;
typedef map < string, EventContainer * > eventMapType;
typedef pair<ModuleDecl*, vector<ModuleDecl*> >moduleInstancePairType;
typedef map<ModuleDecl*, vector<ModuleDecl*> >moduleInstanceMapType;
typedef pair<ModuleDecl*, vector<ModuleDecl*> > moduleInstancePairType;
typedef map<ModuleDecl*, vector<ModuleDecl*> > moduleInstanceMapType;
typedef pair<EntryFunctionContainer*, FindGPUMacro::forStmtGPUMacroMapType> entryFunctionGPUMacroPairType;
typedef map<EntryFunctionContainer*, FindGPUMacro::forStmtGPUMacroMapType> entryFunctionGPUMacroMapType;
......@@ -57,16 +57,16 @@ namespace scpar {
Model(const Model &);
protected:
moduleMapType _modules;
moduleInstanceMapType _moduleInstanceMap;
FindSimTime::simulationTimeMapType _simTime;
eventMapType _eventMap;
FunctionDecl *_scmainFcDecl;
FindNetlist::instanceModuleMapType _instanceModuleMap;
FindNetlist::portSignalMapType _portSignalMap;
FindNetlist::instancePortSignalMapType _instancePortSignalMap;
FindNetlist::instanceListModuleMapType _instanceListModuleMap;
entryFunctionGPUMacroMapType _entryFunctionGPUMacroMap;
moduleMapType modules_;
moduleInstanceMapType module_instance_map_;
FindSimTime::simulationTimeMapType simulation_time_;
eventMapType event_map_;
FunctionDecl *scmain_function_decl_;
FindNetlist::instanceModuleMapType instance_module_map_;
FindNetlist::portSignalMapType port_signal_map_;
FindNetlist::instancePortSignalMapType port_signal_instance_map_;
FindNetlist::instanceListModuleMapType module_instance_list_;
entryFunctionGPUMacroMapType entry_function_gpu_macro_map_;
};
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment