ae33ed08 by rmrf

Signal and SignalContainer needs updates

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