Changeset 55 for sources/test_regression/24082009
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/24082009
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/24082009/Makefile
r41 r55 1 1 2 include ../env.mk 3 include ../Makefile.common 2 4 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) 5 test : all 6 @echo -ne "| Testing $$(basename $$(pwd)): " ; 7 @./$(EXE_SCASS) > $(LOG_SCASS) 2> /dev/null 8 @./$(EXE_SC) > $(LOG_SC) 2> /dev/null 9 @if diff $(LOG_SC) $(LOG_SCASS) > /dev/null ; then \ 10 time_scass=$$(/usr/bin/time -f "%e" 2>&1 ./$(EXE_SCASS) --nodynamiclink | tail -n 1) ; \ 11 time_sc=$$(/usr/bin/time -f "%e" 2>&1 ./$(EXE_SC) | tail -n 1) ; \ 12 echo "OK (time SystemCass: $$time_scass - time SystemC : $$time_sc)" ; \ 13 else echo "KO" ; \ 14 fi ; 15 8 16 9 RESULTS = perf10 11 .SECONDARY:12 13 main : $(EXE)14 15 test : ${RESULTS}16 @echo OK17 18 perf : system_systemcass.x19 time (./system_systemcass.x --nobanner --p --nodynamiclink 1000000 )20 21 %_systemc.x : %_systemc.o $(SYSTEMC_LIB)22 $(CXX) -o $@ $*_systemc.o $(LFLAGS_SYSTEMC) 2>&1 | $(CPPFILT)23 24 %_systemcass.x : %_systemcass.o $(SYSTEMCASS_LIB)25 $(CXX) -o $@ $*_systemcass.o $(LFLAGS_SYSTEMCASS) 2>&1 | $(CPPFILT)26 27 -include Makefile.deps28 29 %_systemc.cpp : %.cpp30 ln -s $*.cpp $*_systemc.cpp31 32 %_systemcass.cpp : %.cpp33 ln -s $*.cpp $*_systemcass.cpp34 35 %_systemc.o : %_systemc.cpp36 $(CXX) $(CFLAGS_SYSTEMC) -MM $*_systemc.cpp >> Makefile.deps37 $(CXX) $(CFLAGS_SYSTEMC) -c $*_systemc.cpp -o $*_systemc.o38 39 %_systemcass.o : %_systemcass.cpp40 $(CXX) $(CFLAGS_SYSTEMCASS) -MM $*_systemcass.cpp >> Makefile.deps41 $(CXX) $(CFLAGS_SYSTEMCASS) -c $*_systemcass.cpp -o $*_systemcass.o42 43 clean :44 rm -f Makefile.deps45 -rm -f *.o gmon.out46 -rm -f $(EXE) $(OBJECTS)47 -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null48 -rm -f core*49 -rm -rf generated_by_systemcass50 -rm -rf tracesystem_systemcass.x.vcd tracesystem_systemc.x.vcd51 -rm -rf ${RESULTS} -
sources/test_regression/24082009/system.cpp
r41 r55 1 #include <systemc.h> 1 2 2 #include <signal.h> 3 3 4 #include "systemc.h" 5 #include "test.h" 6 4 7 using namespace std; 5 8 6 9 struct A : sc_module { 7 sc_in_clkclk;8 sc_in <int>i1;9 sc_signal <int>r1;10 sc_out <int>o1;10 sc_in_clk clk; 11 sc_in <int> i1; 12 sc_signal <int> r1; 13 sc_out <int> o1; 11 14 12 void transition () { 13 int i; 14 for (i = 0; i < 1000; ++i) 15 ; 16 r1 = i1; 17 } 18 void gen_moore () { 19 int i; 20 for (i = 0; i < 1000; ++i) 21 ; 22 o1 = r1; 23 } 15 void transition() { 16 int i; 17 for (i = 0; i < 1000; ++i); 18 r1 = i1; 19 } 24 20 25 SC_CTOR (A) : clk ("clk"), o1("o1") { 26 SC_METHOD(transition); 27 sensitive << clk.pos(); 28 SC_METHOD(gen_moore); 29 sensitive << clk.neg(); 30 }; 21 void gen_moore() { 22 int i; 23 for (i = 0; i < 1000; ++i); 24 o1 = r1; 25 } 26 27 SC_CTOR (A) : clk("clk"), o1("o1") { 28 SC_METHOD(transition); 29 sensitive << clk.pos(); 30 dont_initialize(); 31 32 SC_METHOD(gen_moore); 33 sensitive << clk.neg(); 34 dont_initialize(); 35 } 36 31 37 }; 32 38 33 int sc_main (int argc, char *argv[])34 {35 sc_clock signal_clk("my_clock",1, 0.5);36 sc_signal<int> s1("s1"),s2("s2"),s3("s3"),s4("s4");37 39 38 A a("a"); 39 A b("b"); 40 41 a.clk (signal_clk); 42 b.clk (signal_clk); 43 44 a.i1 (s1); 45 a.o1 (s2); 40 int sc_main (int argc, char * argv[]) { 41 sc_clock signal_clk("my_clock"); 42 sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4"); 46 43 47 b.i1 (s3);48 b.o1 (s4);44 A a("a"); 45 A b("b"); 49 46 50 // Init & run51 sc_initialize ();47 a.clk(signal_clk); 48 b.clk(signal_clk); 52 49 53 if (argc == 1) 54 { 55 cout << "Usage :\n" << argv[0] << " [#cycles]\n"; 50 a.i1(s1); 51 a.o1(s2); 52 53 b.i1(s3); 54 b.o1(s4); 55 56 // Init & run 57 sc_start(sc_time(0, sc_core::SC_NS)); 58 59 s1.write(1); 60 61 sc_start(sc_time(100000, sc_core::SC_NS)); 62 63 cout << s1.read() << endl; 64 cout << s2.read() << endl; 65 56 66 return EXIT_SUCCESS; 57 67 } 58 68 59 s1.write (1);60 69 61 sc_start (atoi(argv[1])); 70 /* 71 # Local Variables: 72 # tab-width: 4; 73 # c-basic-offset: 4; 74 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 75 # indent-tabs-mode: nil; 76 # End: 77 # 78 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 79 */ 62 80 63 cout << s1.read() << endl;64 cout << s2.read() << endl;65 66 return EXIT_SUCCESS;67 }
Note: See TracChangeset
for help on using the changeset viewer.