Changeset 55 for sources/test_regression/29032005
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/29032005
- Files:
-
- 8 deleted
- 2 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/29032005/Makefile
r18 r55 1 1 2 include ../env.mk 3 SIGNAL_GRAPH = signal_graph.dot 4 PROCESS_ORDER = process_order.dot 5 MODULE_GRAPH = module_graph.dot 6 PORT_GRAPH = port_graph.dot 7 SIGNAL_ORDER = signal_order.txt 8 ERASE = $(SIGNAL_GRAPH) $(PROCESS_ORDER) $(SIGNAL_ORDER) $(MODULE_GRAPH) $(PORT_GRAPH) 9 include ../Makefile.common 2 10 3 EXE_SCASS = system_systemcass.x 4 EXE_SC = system_systemc.x 5 EXE = ${EXE_SCASS} ${EXE_SC} 6 OBJECTS = $(EXE:.x=.o) 7 LINKS = $(OBJECTS:.o=.cpp) 11 SIGNAL_GRAPH_REF = signal_graph_ref.dot 12 PROCESS_ORDER_REF = process_order_ref.dot 13 PORT_GRAPH_REF = port_graph_ref.dot 14 SIGNAL_ORDER_REF = signal_order_ref.txt 8 15 9 .SECONDARY: 16 test : $(EXE_SCASS) 17 @echo -ne "| Testing $$(basename $$(pwd)): " ; 18 @./$(EXE_SCASS) --p --t --k 2> /dev/null || res=1 ; \ 19 (tail -n +3 $(SIGNAL_GRAPH) | diff $(SIGNAL_GRAPH_REF) -) > /dev/null || res=1 ; \ 20 (tail -n +3 $(PROCESS_ORDER) | diff $(PROCESS_ORDER_REF) -) > /dev/null || res=1 ; \ 21 (tail -n +3 $(PORT_GRAPH) | diff $(PORT_GRAPH_REF) -) > /dev/null || res=1 ; \ 22 diff $(SIGNAL_ORDER_REF) $(SIGNAL_ORDER) > /dev/null || res=1 ; \ 23 if [ x"$$res" = x ] ; then echo "OK" ; else echo "KO" ; fi ; 24 10 25 11 main : $(EXE)12 26 13 test : ${EXE}14 @for i in ${EXE_SCASS} ; do \15 ./$$i --p --t --k; \16 (tail -n +3 port_graph.dot | diff port_graph_reference.dot -) || eval ${failcom} ; \17 ((tail -n +3 signal_graph.dot | diff signal_graph_reference.dot -) \18 || (tail -n +3 signal_graph.dot | diff signal_graph_reference2.dot -) \19 || (tail -n +3 signal_graph.dot | diff signal_graph_reference3.dot -)) \20 || eval ${failcom} ; \21 ((tail -n +3 process_order.dot | diff process_order_reference.dot -) \22 || (tail -n +3 process_order.dot | diff process_order_reference2.dot -) \23 || (tail -n +3 process_order.dot | diff process_order_reference3.dot -)) \24 || eval ${failcom} ; \25 (diff signal_order_reference.txt signal_order.txt) \26 || (diff signal_order_reference2.txt signal_order.txt) \27 || (diff signal_order_reference3.txt signal_order.txt) \28 || eval ${failcom} ; \29 done30 @echo Test OK.31 32 %.gif : %.dot33 dot -Tgif -o $*.gif $*.dot34 35 %_systemc.x : %_systemc.o $(SYSTEMC_LIB)36 $(CXX) -o $@ $*_systemc.o $(LFLAGS_SYSTEMC) 2>&1 | $(CPPFILT)37 38 %_systemcass.x : %_systemcass.o $(SYSTEMCASS_LIB)39 $(CXX) -o $@ $*_systemcass.o $(LFLAGS_SYSTEMCASS) 2>&1 | $(CPPFILT)40 41 -include Makefile.deps42 43 %_systemc.cpp : %.cpp44 ln -s $*.cpp $*_systemc.cpp45 46 %_systemcass.cpp : %.cpp47 ln -s $*.cpp $*_systemcass.cpp48 49 %_systemc.o : %_systemc.cpp50 $(CXX) $(CFLAGS_SYSTEMC) -MM $*_systemc.cpp >> Makefile.deps51 $(CXX) $(CFLAGS_SYSTEMC) -c $*_systemc.cpp -o $*_systemc.o52 53 %_systemcass.o : %_systemcass.cpp54 $(CXX) $(CFLAGS_SYSTEMCASS) -MM $*_systemcass.cpp >> Makefile.deps55 $(CXX) $(CFLAGS_SYSTEMCASS) -c $*_systemcass.cpp -o $*_systemcass.o56 57 clean :58 rm -f Makefile.deps59 -rm -f *.o gmon.out60 -rm -f signal_order.txt module_order.dot signal_graph.dot61 -rm -f $(EXE) $(OBJECTS)62 -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null63 -rm -f core*64 -rm -rf generated_by_systemcass65 -rm -rf tracesystem_systemcass.x.vcd tracesystem_systemc.x.vcd66 -
sources/test_regression/29032005/system.cpp
r1 r55 1 #include <systemc.h> 1 2 2 #include <signal.h> 3 #include "chrono.h" 3 4 #include "systemc.h" 5 #include "test.h" 6 4 7 5 8 using namespace std; 6 9 7 10 struct M_0i1o : sc_module { 8 sc_in_clk clk; 9 sc_out<bool> o1; 10 11 void eval () { 12 o1 = (rand()%2) == 0; 13 } 14 15 SC_CTOR (M_0i1o) : clk ("clk"), o1("o1") { 16 SC_METHOD(eval); 17 sensitive << clk.neg(); 18 #ifdef SYSTEMCASS_SPECIFIC 19 //o1(); /* no need */ 20 #endif 21 }; 11 sc_in_clk clk; 12 sc_out<bool> o1; 13 14 void eval() { 15 o1 = (rand() % 2) == 0; 16 } 17 18 SC_CTOR (M_0i1o) : clk("clk"), o1("o1") { 19 SC_METHOD(eval); 20 sensitive << clk.neg(); 21 dont_initialize(); 22 } 23 22 24 }; 23 25 24 26 struct M_1i1o : sc_module { 25 sc_in_clk clk; 26 sc_in<bool> i1; 27 sc_out<bool> o1; 28 29 void eval1 () { 30 o1 = ~i1; 31 } 32 33 SC_CTOR (M_1i1o) : clk ("clk"), i1 ("i1"), o1("o1") { 34 SC_METHOD(eval1); 35 sensitive << clk.neg(); 36 sensitive << i1; 37 #ifdef SYSTEMCASS_SPECIFIC 38 o1(i1); 39 #endif 40 }; 41 }; 27 sc_in_clk clk; 28 sc_in<bool> i1; 29 sc_out<bool> o1; 30 31 void eval1() { 32 o1 = ~i1; 33 } 34 35 SC_CTOR (M_1i1o) : clk("clk"), i1("i1"), o1("o1") { 36 SC_METHOD(eval1); 37 sensitive << clk.neg(); 38 sensitive << i1; 39 dont_initialize(); 40 #ifdef SYSTEMCASS_SPECIFIC 41 o1(i1); 42 #endif 43 } 44 45 }; 46 42 47 43 48 44 49 struct M_2i2o : sc_module { 45 sc_in_clk clk; 46 sc_in<bool> i1; 47 sc_in<bool> i2; 48 sc_out<bool> o1; 49 sc_out<bool> o2; 50 51 void eval1 () { 52 o1 = ~i1; 53 } 54 void eval2 () { 55 o2 = ~i2; 56 } 57 58 SC_CTOR (M_2i2o) : clk ("clk"), i1 ("i1"), o1("o1"), i2 ("i2"), o2 ("o2") { 59 SC_METHOD(eval1); 60 sensitive << clk.neg(); 61 sensitive << i1; 62 #ifdef SYSTEMCASS_SPECIFIC 63 o1(i1); 64 #endif 65 SC_METHOD(eval2); 66 sensitive << clk.neg(); 67 sensitive << i2; 68 #ifdef SYSTEMCASS_SPECIFIC 69 o2(i2); 70 #endif 71 }; 72 }; 50 sc_in_clk clk; 51 sc_in<bool> i1; 52 sc_in<bool> i2; 53 sc_out<bool> o1; 54 sc_out<bool> o2; 55 56 void eval1() { 57 o1 = ~i1; 58 } 59 void eval2() { 60 o2 = ~i2; 61 } 62 63 SC_CTOR (M_2i2o) : clk("clk"), i1("i1"), i2("i2"), o1("o1"), o2("o2") { 64 SC_METHOD(eval1); 65 sensitive << clk.neg(); 66 sensitive << i1; 67 dont_initialize(); 68 #ifdef SYSTEMCASS_SPECIFIC 69 o1(i1); 70 #endif 71 SC_METHOD(eval2); 72 sensitive << clk.neg(); 73 sensitive << i2; 74 dont_initialize(); 75 #ifdef SYSTEMCASS_SPECIFIC 76 o2(i2); 77 #endif 78 } 79 80 }; 81 73 82 74 83 struct M_4i2o : sc_module { 75 sc_in_clk clk; 76 sc_in<bool> i1; 77 sc_in<bool> i2; 78 sc_in<bool> i3; 79 sc_in<bool> i4; 80 sc_out<bool> o1; 81 sc_out<bool> o2; 82 83 void eval1 () { 84 o1 = ~i1; 85 } 86 void eval2 () { 87 o2 = ~i2; 88 } 89 void eval3 () { 90 cout << i3 << i4 << "\n"; 91 } 92 93 SC_CTOR (M_4i2o) : clk ("clk"), i1 ("i1"), o1("o1"), i2 ("i2"), o2 ("o2"), 94 i3 ("i3"), i4 ("i4") { 95 SC_METHOD(eval1); 96 sensitive << clk.neg(); 97 sensitive << i1; 98 #ifdef SYSTEMCASS_SPECIFIC 99 o1(i1); 100 #endif 101 SC_METHOD(eval2); 102 sensitive << clk.neg(); 103 sensitive << i2; 104 #ifdef SYSTEMCASS_SPECIFIC 105 o2(i2); 106 #endif 107 SC_METHOD(eval3); 108 sensitive << clk.pos(); 109 // sensitive << i3 << i4; 110 #ifdef SYSTEMCASS_SPECIFIC 111 // No port dependency 112 #endif 113 }; 114 }; 84 sc_in_clk clk; 85 sc_in<bool> i1; 86 sc_in<bool> i2; 87 sc_in<bool> i3; 88 sc_in<bool> i4; 89 sc_out<bool> o1; 90 sc_out<bool> o2; 91 92 void eval1() { 93 o1 = ~i1; 94 } 95 96 void eval2() { 97 o2 = ~i2; 98 } 99 100 void eval3() { 101 cout << i3 << i4 << "\n"; 102 } 103 104 SC_CTOR (M_4i2o) : clk("clk"), i1("i1"), i2("i2"), i3("i3"), i4("i4"), 105 o1("o1"), o2("o2") { 106 SC_METHOD(eval1); 107 sensitive << clk.neg(); 108 sensitive << i1; 109 dont_initialize(); 110 #ifdef SYSTEMCASS_SPECIFIC 111 o1(i1); 112 #endif 113 SC_METHOD(eval2); 114 sensitive << clk.neg(); 115 sensitive << i2; 116 dont_initialize(); 117 #ifdef SYSTEMCASS_SPECIFIC 118 o2(i2); 119 #endif 120 SC_METHOD(eval3); 121 sensitive << clk.pos(); 122 dont_initialize(); 123 } 124 125 }; 126 115 127 116 128 struct M_4i3o : sc_module { 117 sc_in_clk clk; 118 sc_in<bool> i1; 119 sc_in<bool> i2; 120 sc_in<bool> i3; 121 sc_in<bool> i4; 122 sc_out<bool> o1; 123 sc_out<bool> o2; 124 sc_out<bool> o3; 125 126 void eval1 () { 127 o1 = ~i1; 128 } 129 void eval2 () { 130 o2 = ~i2; 131 } 132 void eval3 () { 133 o3 = ~i3; 134 } 135 void eval4 () { 136 cout << i4 << "\n"; 137 } 138 139 SC_CTOR (M_4i3o) : clk ("clk"), i1 ("i1"), o1("o1"), i2 ("i2"), o2 ("o2"), i3 ("i3"), i4 ("i4"), o3 ("o3") { 140 SC_METHOD(eval1); 141 sensitive << clk.neg(); 142 sensitive << i1; 143 #ifdef SYSTEMCASS_SPECIFIC 144 o1(i1); 145 #endif 146 SC_METHOD(eval4); 147 sensitive << clk.pos(); 148 // sensitive << i4; 149 #ifdef SYSTEMCASS_SPECIFIC 150 // No port dependency 151 #endif 152 SC_METHOD(eval3); 153 sensitive << clk.neg(); 154 sensitive << i3; 155 #ifdef SYSTEMCASS_SPECIFIC 156 o3(i3); 157 #endif 158 SC_METHOD(eval2); 159 sensitive << clk.neg(); 160 sensitive << i2; 161 #ifdef SYSTEMCASS_SPECIFIC 162 o2(i2); 163 #endif 164 }; 165 }; 129 sc_in_clk clk; 130 sc_in<bool> i1; 131 sc_in<bool> i2; 132 sc_in<bool> i3; 133 sc_in<bool> i4; 134 sc_out<bool> o1; 135 sc_out<bool> o2; 136 sc_out<bool> o3; 137 138 void eval1() { 139 o1 = ~i1; 140 } 141 142 void eval2() { 143 o2 = ~i2; 144 } 145 146 void eval3() { 147 o3 = ~i3; 148 } 149 150 void eval4() { 151 cout << i4 << "\n"; 152 } 153 154 SC_CTOR (M_4i3o) : clk("clk"), i1("i1"), i2("i2"), i3("i3"), i4("i4"), o1("o1"), o2("o2"), o3("o3") { 155 SC_METHOD(eval1); 156 sensitive << clk.neg(); 157 sensitive << i1; 158 dont_initialize(); 159 #ifdef SYSTEMCASS_SPECIFIC 160 o1(i1); 161 #endif 162 SC_METHOD(eval4); 163 sensitive << clk.pos(); 164 dont_initialize(); 165 166 SC_METHOD(eval3); 167 sensitive << clk.neg(); 168 sensitive << i3; 169 dont_initialize(); 170 #ifdef SYSTEMCASS_SPECIFIC 171 o3(i3); 172 #endif 173 SC_METHOD(eval2); 174 sensitive << clk.neg(); 175 sensitive << i2; 176 dont_initialize(); 177 #ifdef SYSTEMCASS_SPECIFIC 178 o2(i2); 179 #endif 180 } 181 }; 182 166 183 167 184 struct M_1i0o : sc_module { 168 sc_in_clk clk; 169 sc_in<bool> i1; 170 171 void eval1 () { 172 cout << i1.read() << "\n"; 173 } 174 175 SC_CTOR (M_1i0o) : clk ("clk"), i1 ("i1") { 176 SC_METHOD(eval1); 177 sensitive << clk.pos(); 178 // sensitive << i1; 179 #ifdef SYSTEMCASS_SPECIFIC 180 // No port dependency 181 #endif 182 }; 183 }; 184 185 int sc_main (int argc, char *argv[]) 186 { 187 sc_clock signal_clk("my_clock",1, 0.5); 188 sc_signal<bool> s1 ("s01"), 189 s2 ("s02"), 190 s3 ("s03"), 191 s4 ("s04"), 192 s5 ("s05"), 193 s6 ("s06"), 194 s7 ("s07"), 195 s8 ("s08"), 196 s9 ("s09"), 197 s10("s10"), 198 s11("s11"), 199 s12("s12"), 200 s13("s13"), 201 s14("s14"), 202 s15("s15"); 203 204 205 M_0i1o a("a"); 206 M_4i2o b("b"); 207 M_1i1o c("c"); 208 M_4i3o d("d"); 209 M_1i1o e("e"); 210 M_1i1o f("f"); 211 M_2i2o g("g"); 212 M_1i1o h("h"); 213 M_1i0o i("i"); 214 M_0i1o j("j"); 215 M_0i1o k("k"); 216 M_0i1o l("l"); 217 218 a.clk (signal_clk); 219 b.clk (signal_clk); 220 c.clk (signal_clk); 221 d.clk (signal_clk); 222 e.clk (signal_clk); 223 f.clk (signal_clk); 224 g.clk (signal_clk); 225 h.clk (signal_clk); 226 i.clk (signal_clk); 227 j.clk (signal_clk); 228 k.clk (signal_clk); 229 l.clk (signal_clk); 230 231 a.o1 (s1); 232 b.i1 (s1); 233 234 b.o2 (s2); 235 c.i1 (s2); 236 237 c.o1 (s3); 238 d.i1 (s3); 239 240 d.o1 (s4); 241 b.i3 (s4); 242 243 d.o2 (s5); 244 b.i4 (s5); 245 246 b.o1 (s6); 247 e.i1 (s6); 248 249 e.o1 (s7); 250 f.i1 (s7); 251 252 f.o1 (s8); 253 b.i2 (s8); 254 255 d.o3 (s9); 256 g.i1 (s9); 257 258 g.o1 (s10); 259 h.i1 (s10); 260 261 h.o1 (s11); 262 d.i4 (s11); 263 264 j.o1 (s12); 265 g.i2 (s12); 266 267 g.o2 (s13); 268 i.i1 (s13); 269 270 l.o1 (s14); 271 d.i3 (s14); 272 273 k.o1 (s15); 274 d.i2 (s15); 275 276 // Init & run 277 sc_initialize (); 278 279 if (argc == 1) 280 { 281 cout << "Usage :\n" << argv[0] << " [#cycles]\n"; 185 sc_in_clk clk; 186 sc_in<bool> i1; 187 188 void eval1() { 189 cout << i1.read() << "\n"; 190 } 191 192 SC_CTOR (M_1i0o) : clk("clk"), i1("i1") { 193 SC_METHOD(eval1); 194 sensitive << clk.pos(); 195 dont_initialize(); 196 } 197 }; 198 199 200 int sc_main (int argc, char * argv[]) { 201 sc_clock signal_clk("my_clock",1, 0.5); 202 sc_signal<bool> s1("s01"), 203 s2 ("s02"), 204 s3 ("s03"), 205 s4 ("s04"), 206 s5 ("s05"), 207 s6 ("s06"), 208 s7 ("s07"), 209 s8 ("s08"), 210 s9 ("s09"), 211 s10("s10"), 212 s11("s11"), 213 s12("s12"), 214 s13("s13"), 215 s14("s14"), 216 s15("s15"); 217 218 219 M_0i1o a("a"); 220 M_4i2o b("b"); 221 M_1i1o c("c"); 222 M_4i3o d("d"); 223 M_1i1o e("e"); 224 M_1i1o f("f"); 225 M_2i2o g("g"); 226 M_1i1o h("h"); 227 M_1i0o i("i"); 228 M_0i1o j("j"); 229 M_0i1o k("k"); 230 M_0i1o l("l"); 231 232 a.clk(signal_clk); 233 b.clk(signal_clk); 234 c.clk(signal_clk); 235 d.clk(signal_clk); 236 e.clk(signal_clk); 237 f.clk(signal_clk); 238 g.clk(signal_clk); 239 h.clk(signal_clk); 240 i.clk(signal_clk); 241 j.clk(signal_clk); 242 k.clk(signal_clk); 243 l.clk(signal_clk); 244 245 a.o1(s1); 246 b.i1(s1); 247 248 b.o2(s2); 249 c.i1(s2); 250 251 c.o1(s3); 252 d.i1(s3); 253 254 d.o1(s4); 255 b.i3(s4); 256 257 d.o2(s5); 258 b.i4(s5); 259 260 b.o1(s6); 261 e.i1(s6); 262 263 e.o1(s7); 264 f.i1(s7); 265 266 f.o1(s8); 267 b.i2(s8); 268 269 d.o3(s9); 270 g.i1(s9); 271 272 g.o1(s10); 273 h.i1(s10); 274 275 h.o1(s11); 276 d.i4(s11); 277 278 j.o1(s12); 279 g.i2(s12); 280 281 g.o2(s13); 282 i.i1(s13); 283 284 l.o1(s14); 285 d.i3(s14); 286 287 k.o1(s15); 288 d.i2(s15); 289 290 // Init & run 291 sc_start(sc_time(0, sc_core::SC_NS)); 292 282 293 return EXIT_SUCCESS; 283 }284 285 chrono_t chrono;286 chrono.start ();287 288 sc_start (atoi(argv[1]));289 290 chrono.stop ();291 unsigned int t = chrono;292 cout << "Time elapsed (sec) : " << t << endl;293 cout << "Cycles done : " << sc_simulation_time () << endl;294 cout << "Performance : " << sc_simulation_time () / t << endl;295 printf("\nPress <RETURN> to exit simulation.");296 char buf_ret[2];297 cin.getline(buf_ret,1);298 return EXIT_SUCCESS;299 294 } 295 296 297 /* 298 # Local Variables: 299 # tab-width: 4; 300 # c-basic-offset: 4; 301 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 302 # indent-tabs-mode: nil; 303 # End: 304 # 305 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 306 */ 307
Note: See TracChangeset
for help on using the changeset viewer.