Changeset 55 for sources/test_regression/30032005b
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/30032005b
- Files:
-
- 22 deleted
- 2 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/30032005b/Makefile
r15 r55 1 include ../env.mk2 1 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) 2 include ../30032005a/Makefile 10 3 11 PREFIX = $(SYSTEM:.cpp=)12 13 #DIFF = $(SYSTEM:.cpp=.diff)14 15 .SECONDARY:16 17 #%.diff : %_module_graph_reference.dot %_module_graph.dot18 # diff $*_module_graph_reference.dot $*_module_graph.dot19 # diff $*_signal_graph_reference.dot $*_signal_graph.dot20 # diff $*_module_order_reference.dot $*_module_order.dot21 # diff $*_signal_order_reference.dot $*_signal_order.dot22 23 #%_signal_graph_reference.dot %_signal_graph.dot \24 # %_module_order_reference.dot %_module_order.dot \25 # %_signal_order_reference.dot %_signal_order.dot26 27 #%_module_graph.dot : %_systemcass.x28 # $*_systemcass.x --t29 # mv module_graph.dot $*_module_graph.dot30 31 #%_module_order.dot %_signal_graph.dot %_signal_order.dot : %_systemcass.x32 # $*_systemcass.x --t --p33 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 done52 (./system_systemc.x) || eval ${failcom}53 (./system2_systemc.x) || eval ${failcom}54 (./system3_systemc.x) || eval ${failcom}55 @echo Test OK.56 57 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/30032005b/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" 4 6 5 7 using namespace std; 6 7 struct M1_3i3o : sc_module {8 sc_in_clk clk;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;15 8 16 sc_signal<bool> reg; 9 struct M1_1i1o : sc_module { 10 sc_in_clk clk; 11 sc_in<bool> i1; 12 sc_out<bool> o1; 17 13 18 void eval_mealy1() {19 o1 = ~i1;20 } 14 void eval_mealy1() { 15 o1 = ~i1; 16 }; 21 17 22 void eval_mealy2 () { 23 o2 = ~i2; 24 } 18 SC_CTOR (M1_1i1o) : clk("clk"), i1("i1"), o1("o1") { 19 SC_METHOD(eval_mealy1); 20 sensitive << clk.neg(); 21 sensitive << i1; 22 dont_initialize(); 23 #ifdef SYSTEMCASS_SPECIFIC 24 o1(i1); 25 #endif 26 } 25 27 26 void tr_moore () {27 reg = i3;28 }29 30 void gen_moore () {31 o3 = ~reg;32 }33 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;39 #ifdef SYSTEMCASS_SPECIFIC40 o1(i1);41 #endif42 SC_METHOD(eval_mealy2);43 sensitive << clk.neg();44 sensitive << i2;45 #ifdef SYSTEMCASS_SPECIFIC46 o2(i2);47 #endif48 SC_METHOD(tr_moore);49 sensitive << clk.pos();50 #ifdef SYSTEMCASS_SPECIFIC51 #endif52 SC_METHOD(gen_moore);53 sensitive << clk.neg();54 #ifdef SYSTEMCASS_SPECIFIC55 #endif56 };57 28 }; 58 29 59 30 60 struct M2_4i4o : sc_module { 61 sc_in_clk clk; 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; 31 struct M2_1i1o : sc_module { 32 sc_in_clk clk; 33 sc_in<bool> i1; 34 sc_out<bool> o1; 71 35 72 void tr_moore () { 73 reg = ((i1.read() & i3.read())?2:0) + (i2.read() | i4.read()); 74 } 36 sc_signal<bool> reg; 75 37 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 } 38 void tr_moore1() { 39 reg = ~i1; 40 } 82 41 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 needs 88 #endif 89 SC_METHOD(gen_moore); 90 sensitive << clk.neg(); 91 #ifdef SYSTEMCASS_SPECIFIC 92 #endif 93 }; 42 void gen_moore1() { 43 o1 = ~reg; 44 } 45 46 SC_CTOR (M2_1i1o) : clk("clk"), i1("i1"), o1("o1") { 47 SC_METHOD(tr_moore1); 48 sensitive << clk.pos(); 49 dont_initialize(); 50 51 SC_METHOD(gen_moore1); 52 sensitive << clk.neg(); 53 dont_initialize(); 54 } 94 55 }; 95 56 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 57 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); 58 int sc_main (int argc, char * argv[]) { 59 sc_clock signal_clk("my_clock"); 60 sc_signal<bool> s1 ("s01"), 61 s2 ("s02"), 62 s3 ("s03"), 63 s4 ("s04"), 64 s5 ("s05"), 65 s6 ("s06"), 66 s7 ("s07"), 67 s8 ("s08"), 68 s9 ("s09"), 69 s10("s10"), 70 s11("s11"), 71 s12("s12"), 72 s13("s13"), 73 s14("s14"), 74 s15("s15"); 126 75 127 a.o1 (s2);128 b.i1 (s2);129 130 b.o1 (s3);131 Moore.i1 (s3);132 76 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 (); 77 M1_1i1o a("a"); 78 M1_1i1o b("b"); 79 M1_1i1o c("c"); 80 M1_1i1o d("d"); 81 M1_1i1o e("e"); 82 M2_1i1o f("f"); 83 M1_1i1o g("g"); 156 84 157 if (argc == 1) 158 { 159 cout << "Usage :\n" << argv[0] << " [#cycles]\n"; 85 a.clk(signal_clk); 86 b.clk(signal_clk); 87 c.clk(signal_clk); 88 d.clk(signal_clk); 89 e.clk(signal_clk); 90 f.clk(signal_clk); 91 g.clk(signal_clk); 92 93 a.i1(s1); 94 95 a.o1(s2); 96 b.i1(s2); 97 d.i1(s2); 98 99 b.o1(s3); 100 c.i1(s3); 101 102 c.o1(s4); 103 104 d.o1(s5); 105 e.i1(s5); 106 107 e.o1(s6); 108 f.i1(s6); 109 110 f.o1(s7); 111 g.i1(s7); 112 113 g.o1(s8); 114 115 // Init & run 116 sc_start(sc_time(0, sc_core::SC_NS)); 117 160 118 return EXIT_SUCCESS; 161 119 } 162 120 163 chrono_t chrono;164 chrono.start ();165 121 166 sc_start (atoi(argv[1])); 122 /* 123 # Local Variables: 124 # tab-width: 4; 125 # c-basic-offset: 4; 126 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 127 # indent-tabs-mode: nil; 128 # End: 129 # 130 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 131 */ 167 132 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.