Changeset 55 for sources/test_regression/11062007
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/11062007
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/11062007/Makefile
r15 r55 1 1 2 include ../env.mk 3 RES1 = systemcass_a_nodynamiclink_10.txt 4 RES2 = systemcass_p_nodynamiclink_10.txt 5 RES3 = systemcass_m_nodynamiclink_10.txt 6 RES4 = systemcass_dynamiclink_10.txt 7 ERASE = $(RES1) $(RES2) $(RES3) $(RES4) 8 include ../Makefile.common 2 9 3 EXE_SCASS = system_systemcass.x 4 EXE_SC = system_systemc.x 5 EXE = ${EXE_SCASS} 6 OBJECTS = $(EXE:.x=.o) 7 LINKS = $(OBJECTS:.o=.cpp) 10 test: $(SC_CASS) 11 @echo -ne "| Testing $$(basename $$(pwd)): " ; 12 @(./$(EXE_SCASS) --a --nodynamiclink 10 2> /dev/null ) | tail -n 5 > $(RES1) 13 @(./$(EXE_SCASS) --p --nodynamiclink 10 2> /dev/null ) | tail -n 5 > $(RES2) 14 @(./$(EXE_SCASS) --m --nodynamiclink 10 2> /dev/null ) | tail -n 5 > $(RES3) 15 @(./$(EXE_SCASS) 10 2> /dev/null ) | tail -n 5 > $(RES4) 16 @if diff $(RES1) $(RES2) > /dev/null ; then \ 17 if diff $(RES1) $(RES3) > /dev/null ; then \ 18 if diff $(RES1) $(RES4) > /dev/null ; then \ 19 echo "OK" ; \ 20 else \ 21 echo "KO" ; \ 22 fi ; \ 23 else \ 24 echo "KO" ; \ 25 fi ; \ 26 else \ 27 echo "KO" ; \ 28 fi ; 8 29 9 RESULTS = systemcass_dynamiclink_10.txt systemcass_m_nodynamiclink_10.txt systemcass_a_nodynamiclink_10.txt systemcass_p_nodynamiclink_10.txt10 30 11 .SECONDARY:12 13 main : $(EXE)14 15 test : ${RESULTS}16 diff systemcass_dynamiclink_10.txt systemcass_m_nodynamiclink_10.txt || eval ${failcom}17 diff systemcass_a_nodynamiclink_10.txt systemcass_p_nodynamiclink_10.txt || eval ${failcom}18 diff systemcass_dynamiclink_10.txt systemcass_a_nodynamiclink_10.txt || eval ${failcom}19 @echo Test OK.20 21 systemcass_a_nodynamiclink_10.txt : system_systemcass.x22 ((./system_systemcass.x --nobanner --a --nodynamiclink 10 ) | tail -n 5 > systemcass_a_nodynamiclink_10.txt) || eval ${failcom}23 24 systemcass_p_nodynamiclink_10.txt : system_systemcass.x25 ((./system_systemcass.x --nobanner --p --nodynamiclink 10 ) | tail -n 5 > systemcass_p_nodynamiclink_10.txt) || eval ${failcom}26 27 systemcass_m_nodynamiclink_10.txt : system_systemcass.x28 ((./system_systemcass.x --nobanner --m --nodynamiclink 10 ) | tail -n 5 > systemcass_m_nodynamiclink_10.txt) || eval ${failcom}29 30 systemcass_dynamiclink_10.txt : system_systemcass.x31 ((./system_systemcass.x --nobanner 10 ) | tail -n 5 > systemcass_dynamiclink_10.txt) || eval ${failcom}32 33 %.png : %.dot34 dot -Tpng -o $*.png $*.dot35 36 %_systemc.x : %_systemc.o $(SYSTEMC_LIB)37 $(CXX) -o $@ $*_systemc.o $(LFLAGS_SYSTEMC) 2>&1 | $(CPPFILT)38 39 %_systemcass.x : %_systemcass.o $(SYSTEMCASS_LIB)40 $(CXX) -o $@ $*_systemcass.o $(LFLAGS_SYSTEMCASS) 2>&1 | $(CPPFILT)41 42 -include Makefile.deps43 44 %_systemc.cpp : %.cpp45 ln -s $*.cpp $*_systemc.cpp46 47 %_systemcass.cpp : %.cpp48 ln -s $*.cpp $*_systemcass.cpp49 50 %_systemc.o : %_systemc.cpp51 $(CXX) $(CFLAGS_SYSTEMC) -MM $*_systemc.cpp >> Makefile.deps52 $(CXX) $(CFLAGS_SYSTEMC) -c $*_systemc.cpp -o $*_systemc.o53 54 %_systemcass.o : %_systemcass.cpp55 $(CXX) $(CFLAGS_SYSTEMCASS) -MM $*_systemcass.cpp >> Makefile.deps56 $(CXX) $(CFLAGS_SYSTEMCASS) -c $*_systemcass.cpp -o $*_systemcass.o57 58 clean :59 rm -f Makefile.deps60 -rm -f *.o gmon.out61 -rm -f signal_order.txt module_order.dot signal_graph.dot port_graph.dot62 -rm -f module_graph.dot process_order.dot63 -rm -f $(EXE) $(OBJECTS)64 -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null65 -rm -f core*66 -rm -rf generated_by_systemcass67 -rm -rf tracesystem_systemcass.x.vcd tracesystem_systemc.x.vcd68 -rm -rf ${RESULTS}69 -
sources/test_regression/11062007/system.cpp
r1 r55 1 #include <systemc.h> 1 2 2 #include <signal.h> 3 3 4 #include "systemc.h" 5 6 #include "test.h" 7 4 8 using namespace std; 5 9 10 6 11 struct A : sc_module { 7 sc_in_clkclk;8 sc_out<bool>o1;12 sc_in_clk clk; 13 sc_out<bool> o1; 9 14 10 void eval() {11 o1 = (rand()%2) == 0;12 15 void eval() { 16 o1 = (rand() % 2) == 0; 17 } 13 18 14 SC_CTOR (A) : clk ("clk"), o1("o1") { 15 SC_METHOD(eval); 16 sensitive << clk.neg(); 17 #ifdef SYSTEMCASS_SPECIFIC 18 // s1(); 19 #endif 20 }; 19 SC_CTOR(A) : clk ("clk"), o1("o1") { 20 SC_METHOD(eval); 21 sensitive << clk.neg(); 22 dont_initialize(); 23 } 21 24 }; 22 25 26 23 27 struct B : sc_module { 24 sc_in_clkclk;25 sc_in<bool>i1;26 sc_in<bool>i2;27 sc_out<bool>o1;28 sc_out<bool>o2;28 sc_in_clk clk; 29 sc_in<bool> i1; 30 sc_in<bool> i2; 31 sc_out<bool> o1; 32 sc_out<bool> o2; 29 33 30 void eval1 () { 31 o1 = ~i1; 32 } 33 void eval2 () { 34 o2 = ~i2; 35 } 34 void eval1() { 35 o1 = ~i1; 36 } 36 37 37 SC_CTOR (B) : clk ("clk"), i1 ("i1"), o1("o1"), i2 ("i2"), o2 ("o2") { 38 SC_METHOD(eval1); 39 sensitive << clk.neg(); 40 sensitive << i1; 38 void eval2() { 39 o2 = ~i2; 40 } 41 42 SC_CTOR(B) : clk("clk"), i1("i1"), i2("i2"), o1("o1"), o2("o2") { 43 SC_METHOD(eval1); 44 sensitive << clk.neg(); 45 sensitive << i1; 46 dont_initialize(); 41 47 #ifdef SYSTEMCASS_SPECIFIC 42 48 o1(i1); 43 49 #endif 44 SC_METHOD(eval2); 45 sensitive << clk.neg(); 46 sensitive << i2; 50 SC_METHOD(eval2); 51 sensitive << clk.neg(); 52 sensitive << i2; 53 dont_initialize(); 47 54 #ifdef SYSTEMCASS_SPECIFIC 48 55 o2(i2); 49 56 #endif 50 }; 57 } 51 58 }; 52 59 60 53 61 struct C : sc_module { 54 sc_in_clkclk;55 sc_in<bool>i1;56 sc_in<bool>i2;57 sc_out<bool>o1;62 sc_in_clk clk; 63 sc_in<bool> i1; 64 sc_in<bool> i2; 65 sc_out<bool> o1; 58 66 59 void eval1() {60 o1 = i1 ^ i2;61 67 void eval1() { 68 o1 = i1 ^ i2; 69 } 62 70 63 SC_CTOR (C) : clk ("clk"), i1 ("i1"), o1("o1"), i2 ("i2") { 64 SC_METHOD(eval1); 65 sensitive << clk.neg(); 66 sensitive << i1 << i2; 71 SC_CTOR(C) : clk ("clk"), i1 ("i1"), i2("i2"), o1("o1") { 72 SC_METHOD(eval1); 73 sensitive << clk.neg(); 74 sensitive << i1 << i2; 75 dont_initialize(); 67 76 #ifdef SYSTEMCASS_SPECIFIC 68 69 77 o1(i1); 78 o1(i2); 70 79 #endif 71 }; 80 } 81 72 82 }; 73 83 84 74 85 struct D : sc_module { 75 sc_in_clkclk;76 sc_out<bool>o1;86 sc_in_clk clk; 87 sc_out<bool> o1; 77 88 78 79 o1 = (rand()%2) == 0;80 89 void eval () { 90 o1 = (rand() % 2) == 0; 91 } 81 92 82 SC_CTOR (D) : clk ("clk"), o1("o1") { 83 SC_METHOD(eval); 84 sensitive << clk.neg(); 85 #ifdef SYSTEMCASS_SPECIFIC 86 // s1(); 87 #endif 88 }; 93 SC_CTOR(D) : clk ("clk"), o1("o1") { 94 SC_METHOD(eval); 95 sensitive << clk.neg(); 96 dont_initialize(); 97 } 98 89 99 }; 90 100 91 int sc_main (int argc, char *argv[])92 {93 sc_clock signal_clk("my_clock",1, 0.5);94 sc_signal<bool> s1("s1"),s2("s2"),s3("s3"),s4("s4"),s5("s5");95 101 96 A a("a"); 97 B b("b"); 98 C c("c"); 99 D d("d"); 100 101 a.clk (signal_clk); 102 b.clk (signal_clk); 103 c.clk (signal_clk); 104 d.clk (signal_clk); 105 106 a.o1 (s1); 107 b.i1 (s1); 108 109 d.o1 (s2); 110 c.i2 (s2); 102 int sc_main (int argc, char * argv[]) { 103 sc_clock signal_clk("my_clock",1, 0.5); 104 sc_signal<bool> s1("s1"),s2("s2"),s3("s3"),s4("s4"),s5("s5"); 111 105 112 b.o1 (s3); 113 c.i1 (s3); 114 115 c.o1 (s4); 116 b.i2 (s4); 117 118 b.o2 (s5); 119 120 // Init & run 121 sc_initialize (); 106 A a("a"); 107 B b("b"); 108 C c("c"); 109 D d("d"); 122 110 123 if (argc == 1) 124 { 125 cout << "Usage :\n" << argv[0] << " [#cycles]\n"; 111 a.clk(signal_clk); 112 b.clk(signal_clk); 113 c.clk(signal_clk); 114 d.clk(signal_clk); 115 116 a.o1(s1); 117 b.i1(s1); 118 119 d.o1(s2); 120 c.i2(s2); 121 122 b.o1(s3); 123 c.i1(s3); 124 125 c.o1(s4); 126 b.i2(s4); 127 128 b.o2(s5); 129 130 // Init & run 131 sc_start(sc_time(0, sc_core::SC_NS)); 132 133 if (argc == 1) { 134 cout << "Usage :\n" << argv[0] << " [#cycles]\n"; 135 return EXIT_SUCCESS; 136 } 137 138 sc_start(sc_time(atoi(argv[1]), sc_core::SC_NS)); 139 140 cout << s1.read() << endl; 141 cout << s2.read() << endl; 142 cout << s3.read() << endl; 143 cout << s4.read() << endl; 144 cout << s5.read() << endl; 145 126 146 return EXIT_SUCCESS; 127 147 } 128 148 129 sc_start (atoi(argv[1])); 149 /* 150 # Local Variables: 151 # tab-width: 4; 152 # c-basic-offset: 4; 153 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 154 # indent-tabs-mode: nil; 155 # End: 156 # 157 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 158 */ 130 159 131 cout << s1.read() << endl;132 cout << s2.read() << endl;133 cout << s3.read() << endl;134 cout << s4.read() << endl;135 cout << s5.read() << endl;136 137 return EXIT_SUCCESS;138 }
Note: See TracChangeset
for help on using the changeset viewer.