Changeset 55 for sources/test_regression/30032005c
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/30032005c
- Files:
-
- 22 deleted
- 2 edited
- 4 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/30032005c/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/30032005c/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" 6 4 7 5 8 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 9 16 sc_signal<bool> reg;17 10 18 void eval_mealy1 () { 19 o1 = ~i1; 20 } 11 struct M1_1i1o : sc_module { 12 sc_in_clk clk; 13 sc_in<bool> i1; 14 sc_out<bool> o1; 21 15 22 void eval_mealy2() {23 o2 = ~i2;24 16 void eval_mealy1() { 17 o1 = ~i1; 18 } 25 19 26 void tr_moore () { 27 reg = i3; 28 } 20 SC_CTOR (M1_1i1o) : clk("clk"), i1("i1"), o1("o1") { 21 SC_METHOD(eval_mealy1); 22 sensitive << clk.neg(); 23 sensitive << i1; 24 dont_initialize(); 25 #ifdef SYSTEMCASS_SPECIFIC 26 o1(i1); 27 #endif 28 } 29 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 30 }; 58 31 59 32 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; 33 struct M1_3i2o : sc_module { 34 sc_in_clk clk; 35 sc_in<bool> i1; 36 sc_in<bool> i2; 37 sc_in<bool> i3; 38 sc_out<bool> o1; 39 sc_out<bool> o2; 71 40 72 void tr_moore () { 73 reg = ((i1.read() & i3.read())?2:0) + (i2.read() | i4.read()); 74 } 41 void eval_mealy1() { 42 o1 = ~i1 & i2; 43 o2 = ~i2 & i3; 44 } 75 45 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 46 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(); 47 SC_CTOR (M1_3i2o) : clk("clk"), i1("i1"), i2("i2"), i3("i3"), o1("o1"), o2("o2") { 48 SC_METHOD(eval_mealy1); 49 sensitive << clk.neg(); 50 sensitive << i1 << i2; 51 sensitive << i3; 52 dont_initialize(); 86 53 #ifdef SYSTEMCASS_SPECIFIC 87 // no needs 54 o1(i1); 55 o1(i2); 56 o2(i2); 57 o2(i3); 88 58 #endif 89 SC_METHOD(gen_moore); 90 sensitive << clk.neg(); 91 #ifdef SYSTEMCASS_SPECIFIC 92 #endif 93 }; 59 } 60 94 61 }; 95 62 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 63 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); 64 struct M2_1i1o : sc_module { 65 sc_in_clk clk; 66 sc_in<bool> i1; 67 sc_out<bool> o1; 126 68 127 a.o1 (s2); 128 b.i1 (s2); 129 130 b.o1 (s3); 131 Moore.i1 (s3); 69 sc_signal<bool> reg; 132 70 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 (); 71 void tr_moore1() { 72 reg = ~i1; 73 } 156 74 157 if (argc == 1) 158 { 159 cout << "Usage :\n" << argv[0] << " [#cycles]\n"; 75 void gen_moore1() { 76 o1 = ~reg; 77 }; 78 79 SC_CTOR (M2_1i1o) : clk("clk"), i1("i1"), o1("o1") { 80 SC_METHOD(tr_moore1); 81 sensitive << clk.pos(); 82 dont_initialize(); 83 84 SC_METHOD(gen_moore1); 85 sensitive << clk.neg(); 86 dont_initialize(); 87 } 88 89 }; 90 91 92 int sc_main (int argc, char * argv[]) { 93 sc_clock signal_clk("my_clock",1, 0.5); 94 sc_signal<bool> s1 ("s01"), 95 s2 ("s02"), 96 s3 ("s03"), 97 s4 ("s04"), 98 s5 ("s05"), 99 s6 ("s06"), 100 s7 ("s07"), 101 s8 ("s08"), 102 s9 ("s09"), 103 s10("s10"), 104 s11("s11"), 105 s12("s12"), 106 s13("s13"), 107 s14("s14"), 108 s15("s15"); 109 110 111 M1_3i2o a("a"); 112 M1_1i1o b("b"); 113 M1_3i2o c("c"); 114 M1_1i1o d("d"); 115 M1_1i1o e("e"); 116 117 a.clk(signal_clk); 118 b.clk(signal_clk); 119 c.clk(signal_clk); 120 d.clk(signal_clk); 121 e.clk(signal_clk); 122 123 a.i1(s1); 124 125 a.o1(s2); 126 b.i1(s2); 127 128 b.o1(s3); 129 c.i1(s3); 130 131 c.o1(s4); 132 133 a.i2(s5); 134 135 a.o2(s6); 136 c.i2(s6); 137 d.i1(s6); 138 139 c.o2(s7); 140 141 a.i3(s8); 142 143 d.o1(s9); 144 e.i1(s9); 145 146 e.o1(s10); 147 c.i3(s10); 148 149 // Init & run 150 sc_start(sc_time(0, sc_core::SC_NS)); 151 160 152 return EXIT_SUCCESS; 161 153 } 162 154 163 chrono_t chrono;164 chrono.start ();165 155 166 sc_start (atoi(argv[1])); 156 /* 157 # Local Variables: 158 # tab-width: 4; 159 # c-basic-offset: 4; 160 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 161 # indent-tabs-mode: nil; 162 # End: 163 # 164 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 165 */ 167 166 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.