Changeset 55 for sources/test_regression/25032005
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/25032005
- Files:
-
- 3 deleted
- 2 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/25032005/Makefile
r18 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 SIGNAL_ORDER = signal_order.txt 7 ERASE = $(SIGNAL_GRAPH) $(PROCESS_ORDER) $(SIGNAL_ORDER) $(MODULE_GRAPH) 8 include ../Makefile.common 2 9 3 EXE_SCASS = system_systemcass.x 4 EXE_SC = system_systemc.x 5 EXE = ${EXE_SCASS} ${EXE_SC} 6 OBJECTS = $(EXE:.x=.o) 7 LINKS = $(OBJECTS:.o=.cpp) 10 SIGNAL_GRAPH_REF = signal_graph_ref.dot 11 PROCESS_ORDER_REF = process_order_ref.dot 12 SIGNAL_ORDER_REF = signal_order_ref.txt 8 13 9 .SECONDARY: 10 11 main : $(EXE) 12 13 test : main 14 ./system_systemc.x ; \ 15 ./system_systemcass.x --p --t || eval ${failcom} ; \ 16 ((tail --lines=+3 signal_graph.dot | diff signal_graph_reference.dot -) || (tail -n +3 signal_graph.dot | diff signal_graph_reference2.dot -)) || eval ${failcom} 17 tail --lines=+3 process_order.dot | diff process_order_reference.dot - 18 diff signal_order_reference.txt signal_order.txt 19 @echo Test OK. 20 21 %_systemc.x : %_systemc.o $(SYSTEMC_LIB) 22 $(CXX) -o $@ $*_systemc.o $(LFLAGS_SYSTEMC) 23 24 %_systemcass.x : %_systemcass.o $(SYSTEMCASS_LIB) 25 $(CXX) -o $@ $*_systemcass.o $(LFLAGS_SYSTEMCASS) 26 27 -include Makefile.deps 28 29 %_systemc.cpp : %.cpp 30 ln -s $*.cpp $*_systemc.cpp 31 32 %_systemcass.cpp : %.cpp 33 ln -s $*.cpp $*_systemcass.cpp 34 35 %_systemc.o : %_systemc.cpp 36 $(CXX) $(CFLAGS_SYSTEMC) -MM $*_systemc.cpp >> Makefile.deps 37 $(CXX) $(CFLAGS_SYSTEMC) -c $*_systemc.cpp -o $*_systemc.o 38 39 %_systemcass.o : %_systemcass.cpp 40 $(CXX) $(CFLAGS_SYSTEMCASS) -MM $*_systemcass.cpp >> Makefile.deps 41 $(CXX) $(CFLAGS_SYSTEMCASS) -c $*_systemcass.cpp -o $*_systemcass.o 42 43 %.gif : %.dot 44 dot -Tgif -o $*.gif $*.dot 45 46 clean : 47 rm -f Makefile.deps 48 -rm -f *.o gmon.out 49 -rm -f port_graph.dot signal_order.txt process_order.dot signal_graph.dot 50 -rm -f $(EXE) $(OBJECTS) 51 -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null 52 -rm -f core* 53 -rm -f *~ 54 -rm -rf generated_by_systemcass 55 -rm -rf tracesystem_systemcass.x.vcd tracesystem_systemc.x.vcd 14 test : all 15 @echo -ne "| Testing $$(basename $$(pwd)): " ; 16 @./$(EXE_SC) 2> /dev/null || res=1 ; \ 17 ./$(EXE_SCASS) --p --t 2> /dev/null || res=1 ; \ 18 (tail -n +3 $(SIGNAL_GRAPH) | diff $(SIGNAL_GRAPH_REF) -) > /dev/null || res=1 ; \ 19 (tail -n +3 $(PROCESS_ORDER) | diff $(PROCESS_ORDER_REF) -) > /dev/null || res=1 ; \ 20 diff $(SIGNAL_ORDER_REF) $(SIGNAL_ORDER) > /dev/null || res=1 ;\ 21 if [ x"$$res" = x ] ; then echo "OK" ; else echo "KO" ; fi ; 56 22 -
sources/test_regression/25032005/system.cpp
r35 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 A : sc_module { 8 sc_in_clkclk;9 sc_out<bool>o1;10 sc_in_clk clk; 11 sc_out<bool> o1; 10 12 11 void eval() {12 o1 = (rand()%2) == 0;13 }13 void eval() { 14 o1 = (rand() % 2) == 0; 15 } 14 16 15 SC_CTOR (A) : clk ("clk"), o1("o1") { 16 SC_METHOD(eval); 17 sensitive << clk.neg(); 18 #ifdef SYSTEMCASS_SPECIFIC 19 // s1(); 20 #endif 21 }; 17 SC_CTOR (A) : clk("clk"), o1("o1") { 18 SC_METHOD(eval); 19 sensitive << clk.neg(); 20 dont_initialize(); 21 } 22 22 }; 23 23 24 24 25 struct B : sc_module { 25 sc_in_clkclk;26 sc_in<bool>i1;27 sc_in<bool> i2;28 sc_out<bool> o1;29 sc_out<bool>o2;26 sc_in_clk clk; 27 sc_in<bool> i1; 28 sc_out<bool> o1; 29 sc_in<bool> i2; 30 sc_out<bool> o2; 30 31 31 void eval1 () { 32 o1 = ~i1; 33 } 34 void eval2 () { 35 o2 = ~i2; 36 } 32 void eval1() { 33 o1 = ~i1; 34 } 37 35 38 SC_CTOR (B) : clk ("clk"), i1 ("i1"), o1("o1"), i2 ("i2"), o2 ("o2") { 39 SC_METHOD(eval1); 40 sensitive << clk.neg(); 41 sensitive << i1; 36 void eval2() { 37 o2 = ~i2; 38 } 39 40 SC_CTOR (B) : clk("clk"), i1("i1"), o1("o1"), i2("i2"), o2("o2") { 41 SC_METHOD(eval1); 42 sensitive << clk.neg(); 43 sensitive << i1; 44 dont_initialize(); 42 45 #ifdef SYSTEMCASS_SPECIFIC 43 o1(i1);46 o1(i1); 44 47 #endif 45 SC_METHOD(eval2); 46 sensitive << clk.neg(); 47 sensitive << i2; 48 SC_METHOD(eval2); 49 sensitive << clk.neg(); 50 sensitive << i2; 51 dont_initialize(); 48 52 #ifdef SYSTEMCASS_SPECIFIC 49 o2(i2);53 o2(i2); 50 54 #endif 51 }; 55 } 56 52 57 }; 53 58 59 54 60 struct C : sc_module { 55 sc_in_clkclk;56 sc_in<bool>i1;57 sc_in<bool> i2;58 sc_out<bool> o1;61 sc_in_clk clk; 62 sc_in<bool> i1; 63 sc_out<bool> o1; 64 sc_in<bool> i2; 59 65 60 void eval1() {61 o1 = i1 ^ i2;62 }66 void eval1() { 67 o1 = i1 ^ i2; 68 } 63 69 64 SC_CTOR (C) : clk ("clk"), i1 ("i1"), o1("o1"), i2 ("i2") { 65 SC_METHOD(eval1); 66 sensitive << clk.neg(); 67 sensitive << i1 << i2; 70 SC_CTOR (C) : clk ("clk"), i1("i1"), o1("o1"), i2("i2") { 71 SC_METHOD(eval1); 72 sensitive << clk.neg(); 73 sensitive << i1 << i2; 74 dont_initialize(); 68 75 #ifdef SYSTEMCASS_SPECIFIC 69 o1(i1);70 o1(i2);76 o1(i1); 77 o1(i2); 71 78 #endif 72 }; 79 } 80 73 81 }; 74 82 83 75 84 struct D : sc_module { 76 sc_in_clkclk;77 sc_out<bool>o1;85 sc_in_clk clk; 86 sc_out<bool> o1; 78 87 79 void eval() {80 o1 = (rand()%2) == 0;81 }88 void eval() { 89 o1 = (rand() % 2) == 0; 90 } 82 91 83 SC_CTOR (D) : clk ("clk"), o1("o1") { 84 SC_METHOD(eval); 85 sensitive << clk.neg(); 86 #ifdef SYSTEMCASS_SPECIFIC 87 // s1(); 88 #endif 89 }; 92 SC_CTOR (D) : clk("clk"), o1("o1") { 93 SC_METHOD(eval); 94 sensitive << clk.neg(); 95 dont_initialize(); 96 } 97 90 98 }; 91 99 92 int sc_main (int argc, char *argv[])93 {94 sc_clock signal_clk("my_clock",1, 0.5);95 sc_signal<bool> s1("s1"),s2("s2"),s3("s3"),s4("s4"),s5("s5");96 100 97 A a("a"); 98 B b("b"); 99 C c("c"); 100 D d("d"); 101 102 a.clk (signal_clk); 103 b.clk (signal_clk); 104 c.clk (signal_clk); 105 d.clk (signal_clk); 106 107 a.o1 (s1); 108 b.i1 (s1); 109 110 d.o1 (s2); 111 c.i2 (s2); 101 int sc_main (int argc, char * argv[]) { 102 sc_clock signal_clk("my_clock"); 103 sc_signal<bool> s1("s1"), s2("s2"), s3("s3"), s4("s4"), s5("s5"); 112 104 113 b.o1 (s3); 114 c.i1 (s3); 115 116 c.o1 (s4); 117 b.i2 (s4); 118 119 b.o2 (s5); 120 121 // Init & run 122 sc_initialize (); 105 A a("a"); 106 B b("b"); 107 C c("c"); 108 D d("d"); 123 109 124 if (argc == 1) 125 { 126 cout << "Usage :\n" << argv[0] << " [#cycles]\n"; 110 a.clk(signal_clk); 111 b.clk(signal_clk); 112 c.clk(signal_clk); 113 d.clk(signal_clk); 114 115 a.o1(s1); 116 b.i1(s1); 117 118 d.o1(s2); 119 c.i2(s2); 120 121 b.o1(s3); 122 c.i1(s3); 123 124 c.o1(s4); 125 b.i2(s4); 126 127 b.o2(s5); 128 129 // Init & run 130 sc_start(sc_time(1, sc_core::SC_NS)); 131 127 132 return EXIT_SUCCESS; 128 133 } 129 134 130 chrono_t chrono;131 chrono.start ();132 135 133 sc_start (atoi(argv[1])); 136 /* 137 # Local Variables: 138 # tab-width: 4; 139 # c-basic-offset: 4; 140 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 141 # indent-tabs-mode: nil; 142 # End: 143 # 144 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 145 */ 134 146 135 chrono.stop ();136 unsigned int t = chrono;137 cout << "Time elapsed (sec) : " << t << endl;138 cout << "Cycles done : " << sc_simulation_time () << endl;139 cout << "Performance : " << sc_simulation_time () / t << endl;140 printf("\nPress <RETURN> to exit simulation.");141 char buf_ret[2];142 cin.getline(buf_ret,1);143 return EXIT_SUCCESS;144 }
Note: See TracChangeset
for help on using the changeset viewer.