Changeset 52 for sources/src/mouchard_scheduling.cc
- Timestamp:
- Jan 22, 2013, 4:23:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/src/mouchard_scheduling.cc
r27 r52 37 37 #include <iostream> 38 38 #include <fstream> 39 39 40 #include "assert.h" 40 41 #include "process_dependency.h" … … 45 46 #include "sc_module.h" 46 47 #include "sc_ver.h" 48 47 49 #ifdef HAVE_CONFIG_H 48 50 #include "config.h" … … 54 56 55 57 typedef set<SignalDependency> signalDependencySet; 56 typedef set<const method_process_t *> processSet;58 typedef set<const method_process_t *> processSet; 57 59 58 static 59 void 60 getSource (signalDependencySet &ss, 61 const SignalDependencyGraph &sig_g) 62 { 63 typedef set<const equi_t *> nonSource_t; 64 nonSource_t nonSource; 65 SignalDependencyGraph::iterator it; 66 for (it = sig_g.begin(); it != sig_g.end(); ++it) 67 { 68 const SignalDependency &sigDep = *it; 69 const equi_t *dest = sigDep.destination; 70 nonSource.insert(dest); 71 } 72 for (it = sig_g.begin(); it != sig_g.end(); ++it) 73 { 74 const SignalDependency &sigDep = *it; 75 const equi_t *src = sigDep.source; 76 if (nonSource.find(src) == nonSource.end()) 77 ss.insert(sigDep); 78 } 60 static void getSource(signalDependencySet &ss, const SignalDependencyGraph &sig_g) { 61 typedef set<const equi_t *> nonSource_t; 62 nonSource_t nonSource; 63 SignalDependencyGraph::iterator it; 64 for (it = sig_g.begin(); it != sig_g.end(); ++it) { 65 const SignalDependency &sigDep = *it; 66 const equi_t * dest = sigDep.destination; 67 nonSource.insert(dest); 68 } 69 70 for (it = sig_g.begin(); it != sig_g.end(); ++it) { 71 const SignalDependency &sigDep = *it; 72 const equi_t * src = sigDep.source; 73 if (nonSource.find(src) == nonSource.end()) { 74 ss.insert(sigDep); 75 } 76 } 79 77 } 80 78 81 static 82 void 83 removeSignals (SignalDependencyGraph &sig_g, 84 signalDependencySet &ss) 85 { 86 SignalDependencyGraph::iterator it = sig_g.begin(); 87 while (it != sig_g.end()) 88 { 89 const SignalDependency &sigDep = *it; 90 if (ss.find(sigDep) != ss.end()) 91 { 92 SignalDependencyGraph::iterator jt = it++; 93 sig_g.erase (jt); 94 } else 95 ++it; 96 } 79 80 static void removeSignals(SignalDependencyGraph &sig_g, signalDependencySet &ss) { 81 SignalDependencyGraph::iterator it = sig_g.begin(); 82 while (it != sig_g.end()) { 83 const SignalDependency &sigDep = *it; 84 if (ss.find(sigDep) != ss.end()) { 85 SignalDependencyGraph::iterator jt = it++; 86 sig_g.erase(jt); 87 } 88 else { 89 ++it; 90 } 91 } 97 92 } 98 93 99 ProcessDependencyList* 100 MakeMouchardScheduling (const SignalDependencyGraph & _sig_g) 101 { 102 if (dump_stage) 103 cerr << "Making process dependency list...\n"; 104 ProcessDependencyList *mod_l = new ProcessDependencyList (); 105 SignalDependencyGraph sig_g = _sig_g; 106 while (!sig_g.empty ()) 107 { 108 signalDependencySet ss; 109 getSource (ss, sig_g); 110 removeSignals (sig_g, ss); 111 processSet ps; 112 signalDependencySet::iterator sit; 113 for (sit = ss.begin(); sit != ss.end(); ++sit) 114 { 115 const SignalDependency &sigdep = *sit; 116 const method_process_t *process = sigdep.method; 117 ps.insert(process); 94 95 ProcessDependencyList * MakeMouchardScheduling(const SignalDependencyGraph & _sig_g) { 96 if (dump_stage) { 97 cerr << "Making process dependency list...\n"; 118 98 } 119 processSet::iterator pit; 120 for (pit = ps.begin(); pit != ps.end(); ++pit) 121 { 122 const method_process_t *process = *pit; 123 mod_l->push_back(process); 124 #if 1 125 cerr << "Process found : " << *process << "\n"; 126 #endif 99 ProcessDependencyList * mod_l = new ProcessDependencyList (); 100 SignalDependencyGraph sig_g = _sig_g; 101 while (!sig_g.empty ()) { 102 signalDependencySet ss; 103 getSource(ss, sig_g); 104 removeSignals(sig_g, ss); 105 processSet ps; 106 signalDependencySet::iterator sit; 107 for (sit = ss.begin(); sit != ss.end(); ++sit) { 108 const SignalDependency & sigdep = *sit; 109 const method_process_t * process = sigdep.method; 110 ps.insert(process); 111 } 112 processSet::iterator pit; 113 for (pit = ps.begin(); pit != ps.end(); ++pit) { 114 const method_process_t * process = *pit; 115 mod_l->push_back(process); 116 if (dump_stage) { 117 cerr << "Process found : " << *process << "\n"; 118 } 119 } 127 120 } 128 } 129 130 return mod_l; 121 122 return mod_l; 131 123 } 132 124 133 125 } // end of sc_core namespace 134 126 127 /* 128 # Local Variables: 129 # tab-width: 4; 130 # c-basic-offset: 4; 131 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 132 # indent-tabs-mode: nil; 133 # End: 134 # 135 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 136 */ 137
Note: See TracChangeset
for help on using the changeset viewer.