Changeset 55 for sources/test_regression/21062005
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/21062005
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/21062005/Makefile
r13 r55 1 1 2 include ../env.mk 3 include ../Makefile.common 2 4 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) 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 echo "OK" ; \ 11 else echo "KO" ; \ 12 fi ; 10 13 11 .SECONDARY:12 14 13 main : $(EXE)14 15 15 test : main16 ./system_systemcass.x || eval ${failcom} ; \17 echo Test OK.18 19 %.gif : %.dot20 dot -Tgif -o $*.gif $*.dot21 22 %_systemc.x : %_systemc.o $(SYSTEMC_LIB)23 $(CXX) -o $@ $*_systemc.o $(LFLAGS_SYSTEMC) 2>&1 | $(CPPFILT)24 25 %_systemcass.x : %_systemcass.o $(SYSTEMCASS_LIB)26 $(CXX) -o $@ $*_systemcass.o $(LFLAGS_SYSTEMCASS) 2>&1 | $(CPPFILT)27 28 -include Makefile.deps29 30 %_systemc.cpp : %.cpp31 ln -s $*.cpp $*_systemc.cpp32 33 %_systemcass.cpp : %.cpp34 ln -s $*.cpp $*_systemcass.cpp35 36 %_systemc.o : %_systemc.cpp37 $(CXX) $(CFLAGS_SYSTEMC) -Wno-deprecated -MM $*_systemc.cpp >> Makefile.deps38 $(CXX) $(CFLAGS_SYSTEMC) -Wno-deprecated -c $*_systemc.cpp -o $*_systemc.o39 40 %_systemcass.o : %_systemcass.cpp41 $(CXX) $(CFLAGS_SYSTEMCASS) -MM $*_systemcass.cpp >> Makefile.deps42 $(CXX) $(CFLAGS_SYSTEMCASS) -c $*_systemcass.cpp -o $*_systemcass.o43 44 clean :45 -rm -f Makefile.deps46 -rm -f *.o gmon.out *~47 -rm -f ${LOG}48 -rm -f signal_order.txt module_order.dot signal_graph.dot49 -rm -f module_order.gif signal_graph.gif50 -rm -f $(EXE) $(OBJECTS)51 -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null52 -rm -f core*53 -rm -rf generated_by_systemcass54 -rm -rf system_systemcass.x.vcd system_systemc.x.vcd55 -
sources/test_regression/21062005/system.cpp
r1 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 13 struct internal_model : sc_module { 14 sc_in<int> i; 15 sc_out<int> o; 16 internal_model(sc_module_name n) : sc_module(n), i("i"), o("o") {} 27 17 }; 28 18 29 struct model : sc_module 30 {31 sc_in<int>i1, i2, i3;32 sc_out<int>o1, o2, o3;33 34 internal_model internal1,internal2;35 sc_signal<int> internal_signal;36 model (sc_module_name n) : sc_module(n),19 20 struct model : sc_module { 21 sc_in<int> i1, i2, i3; 22 sc_out<int> o1, o2, o3; 23 sc_signal<int> r1, r2; 24 internal_model internal1,internal2; 25 sc_signal<int> internal_signal; 26 model(sc_module_name n) : sc_module(n), 37 27 i1("i1"), i2("i2"), i3("i3"), 38 o1("o1"), o2("o2"), o3("o3"), 39 r1("r1"), r2("r2"), 40 internal1 ("internal1"), 41 internal2 ("internal2"), 42 internal_signal ("internal_signal") 43 { 44 internal1.i (i3); 45 internal2.i (internal1.o); 46 internal1.o (internal_signal); 28 o1("o1"), o2("o2"), o3("o3"), 29 r1("r1"), r2("r2"), 30 internal1("internal1"), 31 internal2("internal2"), 32 internal_signal("internal_signal") { 33 internal1.i(i3); 34 internal2.i(internal1.o); 35 internal1.o(internal_signal); 47 36 #if defined(ERROR) 48 internal1.o(internal2.i); // SystemC 2.0.1 & 2.1.v1 error: no match for call to `(sc_out<int>) (sc_in<int>&)'37 internal1.o(internal2.i); // SystemC 2.0.1 & 2.1.v1 error: no match for call to `(sc_out<int>) (sc_in<int>&)' 49 38 #endif 50 internal2.o (o3); 51 } 39 internal2.o(o3); 40 } 41 52 42 }; 53 43 54 int55 sc_main (int argc, char ** argv)56 {57 model m("m");58 sc_clock clk ("clock");59 sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4");60 44 61 m.i1 (s1); 62 m.i2 (s1); // 63 m.i3 (s1); 64 m.o1 (s4); // 65 m.o2 (s2); 66 m.o3 (s3); 45 int sc_main (int argc, char ** argv) { 46 model m("m"); 47 sc_clock clk("clock"); 48 sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4"); 67 49 68 sc_start (0); 50 m.i1 (s1); 51 m.i2 (s1); 52 m.i3 (s1); 53 m.o1 (s4); 54 m.o2 (s2); 55 m.o3 (s3); 69 56 70 sc_start (1); 71 sc_start (10); 57 sc_start(sc_time(0, sc_core::SC_NS)); 72 58 73 cerr << "Test OK.\n"; 74 return 0; 59 sc_start(sc_time(1, sc_core::SC_NS)); 60 sc_start(sc_time(10, sc_core::SC_NS)); 61 62 cout << "OK" << endl; 63 return 0; 75 64 } 76 65 66 67 /* 68 # Local Variables: 69 # tab-width: 4; 70 # c-basic-offset: 4; 71 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 72 # indent-tabs-mode: nil; 73 # End: 74 # 75 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 76 */ 77
Note: See TracChangeset
for help on using the changeset viewer.