Commit ae33ed08 authored by rmrf's avatar rmrf

Signal and SignalContainer needs updates

parent b091b359
...@@ -4,47 +4,35 @@ ...@@ -4,47 +4,35 @@
using namespace scpar; using namespace scpar;
FindSignals::~FindSignals() { FindSignals::~FindSignals() {
// _os << "[[ Destructor FindSignals ]]\n";
//for (FindSignals::signalMapType::iterator sit = signalcontainer_map_->begin();
//sit != signalcontainer_map_->end(); sit++) {
for ( auto const & sit : signalcontainer_map_ ) { for ( auto const & sit : signalcontainer_map_ ) {
delete sit.second; delete sit.second;
} }
signalcontainer_map_.clear(); signalcontainer_map_.clear();
//delete signalcontainer_map_;
} }
FindSignals::FindSignals(CXXRecordDecl *d, llvm::raw_ostream &os) : _os(os) { FindSignals::FindSignals(CXXRecordDecl *d, llvm::raw_ostream &os) : os_(os) {
//signalcontainer_map_ = new FindSignals::signalMapType();
TraverseDecl(d); TraverseDecl(d);
} }
bool FindSignals::VisitFieldDecl(FieldDecl *fd) { bool FindSignals::VisitFieldDecl(FieldDecl *fd) {
QualType q = fd->getType(); QualType q {fd->getType() };
if (IdentifierInfo *info = fd->getIdentifier()) { if (IdentifierInfo *info = fd->getIdentifier()) {
// fname = info->getNameStart();
// _os << "\n+ Name: " << info->getNameStart();
// _os << "\n+ Type: " << q.getAsString();
// _os << "\n+ also name: " << fd->getNameAsString();
/// We are going to store these. So use pointers. /// We are going to store these. So use pointers.
const Type *tp = q.getTypePtr(); const Type *tp{ q.getTypePtr() };
FindTemplateTypes *te = new FindTemplateTypes(); FindTemplateTypes *te { new FindTemplateTypes() };
te->Enumerate(tp); te->Enumerate(tp);
// te->printTemplateArguments(_os); string tt{ te->getTemplateType() };
string tt = te->getTemplateType();
// _os << "OUTPUT ============ " << tt << "\n"; // If string is not found
if ((signed)tt.find("sc_signal") == -1) { if ( tt.find( "sc_signal") == string::npos ) {
delete te; delete te;
return true; return true;
} }
SignalContainer *sc = new SignalContainer(fd->getNameAsString(), te, fd);
SignalContainer *sc = new SignalContainer(fd->getNameAsString(), te, fd);
signalcontainer_map_.insert(FindSignals::signalPairType(fd->getNameAsString(), sc)); signalcontainer_map_.insert(FindSignals::signalPairType(fd->getNameAsString(), sc));
} }
return true; return true;
...@@ -53,13 +41,10 @@ bool FindSignals::VisitFieldDecl(FieldDecl *fd) { ...@@ -53,13 +41,10 @@ bool FindSignals::VisitFieldDecl(FieldDecl *fd) {
FindSignals::signalMapType FindSignals::getSignals() const { return signalcontainer_map_; } FindSignals::signalMapType FindSignals::getSignals() const { return signalcontainer_map_; }
void FindSignals::dump() { void FindSignals::dump() {
_os << "\n================= Find Signals ================\n"; os_ << "\n================= Find Signals ================\n";
//for (FindSignals::signalMapType::iterator sit = signalcontainer_map_->begin();
//sit != signalcontainer_map_->end(); sit++) {
for (auto const & sit : signalcontainer_map_ ) { for (auto const & sit : signalcontainer_map_ ) {
_os << sit.second; os_ << sit.second;
sit.second->dump(_os); sit.second->dump(os_);
} }
_os << "\n================= END Find Ports ================\n\n"; os_ << "\n================= END Find Ports ================\n\n";
} }
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
void dump(); void dump();
private: private:
llvm::raw_ostream &_os; llvm::raw_ostream &os_;
//int state_; //int state_;
signalMapType signalcontainer_map_; signalMapType signalcontainer_map_;
}; };
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
SC_MODULE( test ){ SC_MODULE( test ){
sc_in<int> in; sc_in<int> in;
sc_out<int> out; sc_out<int> out;
sc_signal<int> test_signal;
void entry_function_1() { void entry_function_1() {
while(true) { while(true) {
// do nothing // do nothing
......
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