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