Changeset 55 for sources/test_regression/30032005a
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/30032005a
- Files:
-
- 22 deleted
- 2 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/30032005a/Makefile
r15 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 SYSTEM = system.cpp system2.cpp system3.cpp 4 EXE_SCASS = $(SYSTEM:.cpp=_systemcass.x) 5 EXE_SC = $(SYSTEM:.cpp=_systemc.x) 6 EXE = ${EXE_SCASS} ${EXE_SC} 7 LOG = $(SYSTEM:.cpp=.log) 8 OBJECTS = $(EXE:.x=.o) 9 LINKS = $(OBJECTS:.o=.cpp) 11 SIGNAL_GRAPH_REF = signal_graph_ref.dot 12 PROCESS_ORDER_REF = process_order_ref.dot 13 SIGNAL_ORDER_REF = signal_order_ref.txt 14 MODULE_GRAPH_REF = module_graph_ref.dot 10 15 11 PREFIX = $(SYSTEM:.cpp=) 12 13 #DIFF = $(SYSTEM:.cpp=.diff) 14 15 .SECONDARY: 16 17 #%.diff : %_module_graph_reference.dot %_module_graph.dot 18 # diff $*_module_graph_reference.dot $*_module_graph.dot 19 # diff $*_signal_graph_reference.dot $*_signal_graph.dot 20 # diff $*_module_order_reference.dot $*_module_order.dot 21 # diff $*_signal_order_reference.dot $*_signal_order.dot 22 23 #%_signal_graph_reference.dot %_signal_graph.dot \ 24 # %_module_order_reference.dot %_module_order.dot \ 25 # %_signal_order_reference.dot %_signal_order.dot 26 27 #%_module_graph.dot : %_systemcass.x 28 # $*_systemcass.x --t 29 # mv module_graph.dot $*_module_graph.dot 30 31 #%_module_order.dot %_signal_graph.dot %_signal_order.dot : %_systemcass.x 32 # $*_systemcass.x --t --p 33 34 main : $(EXE) 35 36 #diff : ${DIFF} 37 38 test : ${EXE} 39 for i in ${PREFIX} ; do \ 40 echo Testing $$i... ; \ 41 (./$${i}_systemcass.x --t) || eval ${failcom}; \ 42 tail -n +3 module_graph.dot | diff $${i}_module_graph_reference.dot - || eval ${failcom}; \ 43 ./$${i}_systemcass.x --p --t || eval ${failcom}; \ 44 tail -n +3 signal_graph.dot | diff $${i}_signal_graph_reference.dot - \ 45 || tail -n +3 signal_graph.dot | diff $${i}_signal_graph_reference2.dot - \ 46 || eval ${failcom}; \ 47 tail -n +3 process_order.dot | diff $${i}_process_order_reference.dot - || eval ${failcom}; \ 48 diff signal_order.txt $${i}_signal_order_reference.txt \ 49 || diff signal_order.txt $${i}_signal_order_reference2.txt \ 50 || eval ${failcom}; \ 51 done 52 (./system_systemc.x) || eval ${failcom} 53 (./system2_systemc.x) || eval ${failcom} 54 (./system3_systemc.x) || eval ${failcom} 55 @echo Test OK. 16 test : $(EXE_SCASS) 17 @echo -ne "| Testing $$(basename $$(pwd)): " ; \ 18 ./$(EXE_SCASS) --t 2> /dev/null || res=1 ; \ 19 (tail -n +3 $(MODULE_GRAPH) | diff $(MODULE_GRAPH_REF) -) > /dev/null || res=1 ; \ 20 ./$(EXE_SCASS) --p --t 2> /dev/null || res=1 ; \ 21 (tail -n +3 $(SIGNAL_GRAPH) | diff $(SIGNAL_GRAPH_REF) -) > /dev/null || res=1 ; \ 22 (tail -n +3 $(PROCESS_ORDER) | diff $(PROCESS_ORDER_REF) -) > /dev/null || res=1 ; \ 23 diff $(SIGNAL_ORDER_REF) $(SIGNAL_ORDER) > /dev/null || res=1 ; \ 24 if [ x"$$res" = x ] ; then echo "OK" ; else echo "KO" ; fi ; 25 56 26 57 27 58 59 %.gif : %.dot60 dot -Tgif -o $*.gif $*.dot61 62 %_systemc.x : %_systemc.o $(SYSTEMC_LIB)63 $(CXX) -o $@ $*_systemc.o $(LFLAGS_SYSTEMC) 2>&1 | $(CPPFILT)64 65 %_systemcass.x : %_systemcass.o $(SYSTEMCASS_LIB)66 $(CXX) -o $@ $*_systemcass.o $(LFLAGS_SYSTEMCASS) 2>&1 | $(CPPFILT)67 68 -include Makefile.deps69 70 %_systemc.cpp : %.cpp71 ln -s $*.cpp $*_systemc.cpp72 73 %_systemcass.cpp : %.cpp74 ln -s $*.cpp $*_systemcass.cpp75 76 %_systemc.o : %_systemc.cpp77 $(CXX) $(CFLAGS_SYSTEMC) -MM $*_systemc.cpp >> Makefile.deps78 $(CXX) $(CFLAGS_SYSTEMC) -c $*_systemc.cpp -o $*_systemc.o79 80 %_systemcass.o : %_systemcass.cpp81 $(CXX) $(CFLAGS_SYSTEMCASS) -MM $*_systemcass.cpp >> Makefile.deps82 $(CXX) $(CFLAGS_SYSTEMCASS) -c $*_systemcass.cpp -o $*_systemcass.o83 84 clean :85 rm -f Makefile.deps86 -rm -f *.o gmon.out87 -rm -f *~88 -rm -f ${LOG}89 -rm -f signal_order.txt module_order.dot signal_graph.dot90 -rm -f module_order.gif signal_graph.gif91 -rm -f $(EXE) $(OBJECTS)92 -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null93 -rm -f core*94 -rm -rf generated_by_systemcass95 -rm -rf tracesystem_systemcass.x.vcd tracesystem_systemc.x.vcd96 -
sources/test_regression/30032005a/system.cpp
r1 r55 1 #include <systemc.h>2 1 #include <signal.h> 3 #include "chrono.h" 2 3 #include "systemc.h" 4 #include "test.h" 5 4 6 5 7 using namespace std; 6 8 7 9 struct M1_3i3o : sc_module { 8 sc_in_clkclk;9 sc_in<bool>i1;10 sc_in<bool>i2;11 sc_in<bool>i3;12 sc_out<bool>o1;13 sc_out<bool>o2;14 sc_out<bool>o3;10 sc_in_clk clk; 11 sc_in<bool> i1; 12 sc_in<bool> i2; 13 sc_in<bool> i3; 14 sc_out<bool> o1; 15 sc_out<bool> o2; 16 sc_out<bool> o3; 15 17 16 sc_signal<bool>reg;18 sc_signal<bool> reg; 17 19 18 void eval_mealy1() {19 o1 = ~i1;20 20 void eval_mealy1() { 21 o1 = ~i1; 22 } 21 23 22 void eval_mealy2() {23 o2 = ~i2;24 24 void eval_mealy2() { 25 o2 = ~i2; 26 } 25 27 26 void tr_moore() {27 reg = i3;28 28 void tr_moore() { 29 reg = i3; 30 } 29 31 30 void gen_moore() {31 o3 = ~reg;32 32 void gen_moore() { 33 o3 = ~reg; 34 } 33 35 34 SC_CTOR (M1_3i3o) : clk("clk"), i1("i1"), o1("o1"), i2("i2"), o2("o2"), 35 i3("i3"), o3("o3") { 36 SC_METHOD(eval_mealy1); 37 sensitive << clk.neg(); 38 sensitive << i1; 36 SC_CTOR (M1_3i3o) : clk("clk"), i1("i1"), i2("i2"), i3("i3"), o1("o1"), 37 o2("o2"), o3("o3") { 38 SC_METHOD(eval_mealy1); 39 sensitive << clk.neg(); 40 sensitive << i1; 41 dont_initialize(); 39 42 #ifdef SYSTEMCASS_SPECIFIC 40 43 o1(i1); 41 44 #endif 42 SC_METHOD(eval_mealy2); 43 sensitive << clk.neg(); 44 sensitive << i2; 45 46 SC_METHOD(eval_mealy2); 47 sensitive << clk.neg(); 48 sensitive << i2; 49 dont_initialize(); 50 45 51 #ifdef SYSTEMCASS_SPECIFIC 46 52 o2(i2); 47 53 #endif 48 49 50 #ifdef SYSTEMCASS_SPECIFIC 51 #endif 52 53 54 #ifdef SYSTEMCASS_SPECIFIC 55 #endif 56 }; 54 SC_METHOD(tr_moore); 55 sensitive << clk.pos(); 56 dont_initialize(); 57 58 SC_METHOD(gen_moore); 59 sensitive << clk.neg(); 60 dont_initialize(); 61 } 62 57 63 }; 58 64 59 65 60 66 struct M2_4i4o : sc_module { 61 sc_in_clkclk;62 sc_in<bool>i1;63 sc_in<bool>i2;64 sc_in<bool>i3;65 sc_in<bool>i4;66 sc_out<bool>o1;67 sc_out<bool>o2;68 sc_out<bool>o3;69 sc_out<bool>o4;70 sc_signal<sc_uint<2> >reg;67 sc_in_clk clk; 68 sc_in<bool> i1; 69 sc_in<bool> i2; 70 sc_in<bool> i3; 71 sc_in<bool> i4; 72 sc_out<bool> o1; 73 sc_out<bool> o2; 74 sc_out<bool> o3; 75 sc_out<bool> o4; 76 sc_signal<sc_uint<2> > reg; 71 77 72 void tr_moore() {73 reg = ((i1.read() & i3.read())?2:0) + (i2.read() | i4.read());74 78 void tr_moore() { 79 reg = ((i1.read() & i3.read()) ? 2 : 0) + (i2.read() | i4.read()); 80 } 75 81 76 void gen_moore() {77 o1 = reg.read() & 1;78 o2 = reg.read() & 2;79 o3 = ~(reg.read() & 1);80 o4 = ~(reg.read() & 2);81 82 void gen_moore() { 83 o1 = reg.read() & 1; 84 o2 = reg.read() & 2; 85 o3 = ~(reg.read() & 1); 86 o4 = ~(reg.read() & 2); 87 } 82 88 83 SC_CTOR (M2_4i4o) : clk ("clk"), i1 ("i1"), o1("o1"), i2 ("i2"), o2 ("o2"), i3 ("i3"), o3("o3"), i4 ("i4"), o4 ("o4") { 84 SC_METHOD(tr_moore); 85 sensitive << clk.pos();86 #ifdef SYSTEMCASS_SPECIFIC 87 // no needs88 #endif 89 SC_METHOD(gen_moore); 90 sensitive << clk.neg(); 91 #ifdef SYSTEMCASS_SPECIFIC 92 #endif 93 }; 89 90 SC_CTOR (M2_4i4o) : clk("clk"), i1("i1"), i2("i2"), i3("i3"), i4("i4"), o1("o1"), o2("o2"), o3("o3"), o4("o4") { 91 SC_METHOD(tr_moore); 92 sensitive << clk.pos(); 93 dont_initialize(); 94 95 SC_METHOD(gen_moore); 96 sensitive << clk.neg(); 97 dont_initialize(); 98 } 99 94 100 }; 95 101 96 int sc_main (int argc, char *argv[])97 {98 sc_clock signal_clk("my_clock",1, 0.5);99 sc_signal<bool> s1 ("s01"),100 s2 ("s02"),101 s3 ("s03"),102 s4 ("s04"),103 s5 ("s05"),104 s6 ("s06"),105 s7 ("s07"),106 s8 ("s08"),107 s9 ("s09"),108 s10("s10"),109 s11("s11"),110 s12("s12"),111 s13("s13"),112 s14("s14"),113 s15("s15");114 115 102 116 M1_3i3o a ("a"); 117 M1_3i3o b ("b"); 118 M2_4i4o Moore("Moore"); 119 120 a.clk (signal_clk); 121 b.clk (signal_clk); 122 Moore.clk (signal_clk); 123 124 Moore.o1 (s1); 125 a.i1 (s1); 103 int sc_main (int argc, char * argv[]) { 104 sc_clock signal_clk("my_clock"); 105 sc_signal<bool> s1 ("s01"), 106 s2 ("s02"), 107 s3 ("s03"), 108 s4 ("s04"), 109 s5 ("s05"), 110 s6 ("s06"), 111 s7 ("s07"), 112 s8 ("s08"), 113 s9 ("s09"), 114 s10("s10"), 115 s11("s11"), 116 s12("s12"), 117 s13("s13"), 118 s14("s14"), 119 s15("s15"); 126 120 127 a.o1 (s2);128 b.i1 (s2);129 130 b.o1 (s3);131 Moore.i1 (s3);132 121 133 Moore.o2 (s4); 134 b.i2 (s4); 135 136 b.o2 (s5); 137 a.i2 (s5); 138 139 a.o2 (s6); 140 Moore.i2 (s6); 141 142 Moore.o3 (s7); 143 b.i3 (s7); 144 145 Moore.o4 (s8); 146 a.i3 (s8); 147 148 b.o3 (s9); 149 Moore.i4 (s9); 150 151 a.o3 (s10); 152 Moore.i3 (s10); 153 154 // Init & run 155 sc_initialize (); 122 M1_3i3o a("a"); 123 M1_3i3o b("b"); 124 M2_4i4o Moore("Moore"); 156 125 157 if (argc == 1) 158 { 159 cout << "Usage :\n" << argv[0] << " [#cycles]\n"; 126 a.clk(signal_clk); 127 b.clk(signal_clk); 128 Moore.clk(signal_clk); 129 130 Moore.o1(s1); 131 a.i1(s1); 132 133 a.o1(s2); 134 b.i1(s2); 135 136 b.o1(s3); 137 Moore.i1(s3); 138 139 Moore.o2(s4); 140 b.i2(s4); 141 142 b.o2(s5); 143 a.i2(s5); 144 145 a.o2(s6); 146 Moore.i2(s6); 147 148 Moore.o3(s7); 149 b.i3(s7); 150 151 Moore.o4(s8); 152 a.i3(s8); 153 154 b.o3(s9); 155 Moore.i4(s9); 156 157 a.o3(s10); 158 Moore.i3(s10); 159 160 // Init & run 161 sc_start(sc_time(0, sc_core::SC_NS)); 162 160 163 return EXIT_SUCCESS; 161 164 } 162 165 163 chrono_t chrono; 164 chrono.start (); 166 /* 167 # Local Variables: 168 # tab-width: 4; 169 # c-basic-offset: 4; 170 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 171 # indent-tabs-mode: nil; 172 # End: 173 # 174 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 175 */ 165 176 166 sc_start (atoi(argv[1]));167 168 chrono.stop ();169 unsigned int t = chrono;170 cout << "Time elapsed (sec) : " << t << endl;171 cout << "Cycles done : " << sc_simulation_time () << endl;172 cout << "Performance : " << sc_simulation_time () / t << endl;173 return EXIT_SUCCESS;174 }
Note: See TracChangeset
for help on using the changeset viewer.