Changeset 55 for sources/test_regression/16112005a
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/16112005a
- Files:
-
- 2 deleted
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/16112005a/Makefile
r15 r55 1 1 include ../env.mk 2 include ../Makefile.common 2 3 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) 4 test : all 5 @echo -ne "| Testing $$(basename $$(pwd)): " ; 6 @./$(EXE_SCASS) > $(LOG_SCASS) 2> /dev/null 7 @./$(EXE_SC) > $(LOG_SC) 2> /dev/null 8 @if diff $(LOG_SC) $(LOG_SCASS) > /dev/null ; then \ 9 echo "OK" ; \ 10 else echo "KO" ; \ 11 fi ; 10 12 11 .SECONDARY:12 13 13 main : $(EXE) 14 15 test : main 16 ./system_systemcass.x || eval ${failcom} ; \ 14 #./system_systemcass.x || eval ${failcom} ; \ 17 15 ./system2_systemcass.x ; \ 18 16 if [ $$? -ne 29 ] ; then eval ${failcom} ; fi ; \ … … 21 19 echo Test OK. 22 20 23 %.gif : %.dot24 dot -Tgif -o $*.gif $*.dot25 26 %_systemc.x : %_systemc.o $(SYSTEMC_LIB)27 $(CXX) -o $@ $*_systemc.o $(LFLAGS_SYSTEMC) 2>&1 | $(CPPFILT)28 29 %_systemcass.x : %_systemcass.o $(SYSTEMCASS_LIB)30 $(CXX) -o $@ $*_systemcass.o $(LFLAGS_SYSTEMCASS) 2>&1 | $(CPPFILT)31 32 -include Makefile.deps33 34 %_systemc.cpp : %.cpp35 ln -s $*.cpp $*_systemc.cpp36 37 %_systemcass.cpp : %.cpp38 ln -s $*.cpp $*_systemcass.cpp39 40 %_systemc.o : %_systemc.cpp41 $(CXX) $(CFLAGS_SYSTEMC) -Wno-deprecated -MM $*_systemc.cpp >> Makefile.deps42 $(CXX) $(CFLAGS_SYSTEMC) -Wno-deprecated -c $*_systemc.cpp -o $*_systemc.o43 44 %_systemcass.o : %_systemcass.cpp45 $(CXX) $(CFLAGS_SYSTEMCASS) -MM $*_systemcass.cpp >> Makefile.deps46 $(CXX) $(CFLAGS_SYSTEMCASS) -c $*_systemcass.cpp -o $*_systemcass.o47 48 clean :49 rm -f Makefile.deps50 -rm -f *.o gmon.out *~51 -rm -f ${LOG}52 -rm -f signal_order.txt module_order.dot signal_graph.dot53 -rm -f module_order.gif signal_graph.gif54 -rm -f $(EXE) $(OBJECTS)55 -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null56 -rm -f core*57 -rm -rf generated_by_systemcass58 -rm -rf system_systemcass.x.vcd system_systemc.x.vcd59 -
sources/test_regression/16112005a/system.cpp
r35 r55 1 #include <systemc.h> 1 2 2 #include <iostream> 3 3 #include <string> 4 4 5 #define ASSERT(x) \ 6 { errnum++; \ 7 if (!(x)) \ 8 { \ 9 cerr << "ASSERT : " #x "\n"; \ 10 exit (errnum); \ 11 } \ 12 } 5 #include "systemc.h" 6 #include "test.h" 7 13 8 14 9 using namespace std; 15 10 16 static int errnum = 0;17 11 18 struct internal_model : sc_module 19 { 20 sc_in<int> i; 21 sc_out<int> o; 22 internal_model (sc_module_name n) : sc_module (n), 23 i("i"), 24 o("o") 25 { 26 } 12 struct internal_model : sc_module { 13 sc_in<int> i; 14 sc_out<int> o; 15 internal_model (sc_module_name n) : sc_module (n), i("i"), o("o") {} 27 16 }; 28 17 29 struct model : sc_module30 {31 sc_in<int> i1, i2, i3;32 sc_out<int> o1, o2, o3;33 sc_signal<int> r1, r2;34 internal_model internal;35 18 36 model (sc_module_name n) : sc_module (n), 19 struct model : sc_module { 20 sc_in<int> i1, i2, i3; 21 sc_out<int> o1, o2, o3; 22 sc_signal<int> r1, r2; 23 internal_model internal; 24 25 model(sc_module_name n) : sc_module(n), 37 26 i1("i1"), i2("i2"), i3("i3"), 38 27 o1("o1"), o2("o2"), o3("o3"), 39 28 r1("r1"), r2("r2"), 40 29 internal ("internal") 41 { 42 internal.o (o3); 43 internal.i (i3); 44 // o3 (internal.o); 45 } 30 { 31 internal.o(o3); 32 internal.i(i3); 33 } 46 34 }; 47 35 48 int49 sc_main (int argc, char ** argv)50 {51 model m("m");52 sc_clock clk ("clock");53 sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4");54 36 55 m.i1 (s1); 56 m.i2 (s1); // 57 m.i3 (s1); 58 m.o1 (s4); // 59 m.o2 (s2); 60 m.o3 (s3); 37 int sc_main (int argc, char ** argv) { 38 model m("m"); 39 sc_clock clk("clock"); 40 sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4"); 61 41 62 sc_start (0); 42 m.i1 (s1); 43 m.i2 (s1); 44 m.i3 (s1); 45 m.o1 (s4); 46 m.o2 (s2); 47 m.o3 (s3); 63 48 64 sc_start (1); 65 sc_start (10); 49 sc_start(sc_time(0, sc_core::SC_NS)); 66 50 67 cerr << "Test OK.\n"; 68 return 0; 51 sc_start(sc_time(1, sc_core::SC_NS)); 52 sc_start(sc_time(10, sc_core::SC_NS)); 53 54 cout << "OK" << endl; 55 56 return 0; 69 57 } 70 58 59 60 /* 61 # Local Variables: 62 # tab-width: 4; 63 # c-basic-offset: 4; 64 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 65 # indent-tabs-mode: nil; 66 # End: 67 # 68 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 69 */ 70
Note: See TracChangeset
for help on using the changeset viewer.