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