Changeset 55 for sources/test_regression/16122005
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/16122005
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/16122005/Makefile
r15 r55 1 1 2 include ../env.mk 3 RESULTS = results.txt 4 ERASE = $(RESULTS) 5 include ../Makefile.common 2 6 3 SYSTEM = system.cpp 4 EXE_SCASS = $(SYSTEM:.cpp=_systemcass.x) 5 EXE_SC = $(SYSTEM:.cpp=_systemc.x) 6 EXE = ${EXE_SCASS} ${EXE_SC} 7 OBJECTS = $(EXE:.x=.o) 8 LINKS = $(OBJECTS:.o=.cpp) 7 RESULTS_REF = results_ref.txt 9 8 10 .SECONDARY: 9 test : $(EXE_SCASS) 10 @echo -ne "| Testing $$(basename $$(pwd)): " ; 11 @./$(EXE_SCASS) 2> /dev/null 12 @if diff $(RESULTS) $(RESULTS_REF) > /dev/null ; then \ 13 echo "OK" ; \ 14 else echo "KO" ; \ 15 fi ; 11 16 12 main : $(EXE)13 17 14 test : main15 ./system_systemcass.x16 diff results.txt results_reference.txt17 @echo Test OK.18 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) -MM $*_systemc.cpp >> Makefile.deps38 $(CXX) $(CFLAGS_SYSTEMC) -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 results.txt48 -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/16122005/system.cpp
r35 r55 1 #include <systemc.h> 1 2 2 #include <iostream> 3 3 #include <fstream> … … 5 5 #include <cstring> //strcmp 6 6 7 #define ASSERT(x) { if (!(x)) { \ 8 cerr << "ASSERT : " #x \ 9 << " in function '" << __FUNCTION__ \ 10 << "'\n"; exit (-1); \ 11 } \ 12 } 7 #include <systemc.h> 8 #include "test.h" 13 9 14 10 15 11 using namespace std; 16 12 17 struct D : sc_module 18 { 19 D (sc_module_name n) 20 { 21 } 13 14 struct D : sc_module { 15 D (sc_module_name n) {} 22 16 }; 23 17 24 struct C : sc_module 25 { 26 C (sc_module_name n) 27 { 28 } 18 19 struct C : sc_module { 20 C(sc_module_name n) {} 29 21 }; 30 22 31 struct B : sc_module 32 { 33 D d1; 34 D d2; 35 C c; 36 B (sc_module_name n) : d1("d1"), d2("d2"), c("c") 37 { 38 } 23 24 struct B : sc_module { 25 D d1; 26 D d2; 27 C c; 28 B(sc_module_name n) : d1("d1"), d2("d2"), c("c") {} 39 29 }; 40 30 41 struct A : sc_module 42 { 43 B b; 44 C c; 45 A (sc_module_name n) : b("b"), c("c") 46 { 47 } 31 32 struct A : sc_module { 33 B b; 34 C c; 35 A(sc_module_name n) : b("b"), c("c") {} 48 36 }; 49 37 50 struct top_level1 : sc_module 51 { 52 A a; 53 D d; 54 top_level1(sc_module_name insname) : sc_module (insname), a("a"), d("d") 55 { 56 ASSERT(strcmp ((const char*)insname,"top1") == 0); 57 } 38 39 struct top_level1 : sc_module { 40 A a; 41 D d; 42 top_level1(sc_module_name insname) : sc_module (insname), a("a"), d("d") { 43 ASSERT(strcmp((const char *) insname, "top1") == 0); 44 } 58 45 }; 59 46 60 struct top_level2 : sc_module 61 { 62 B b1; 63 B b2; 64 C c; 65 top_level2(sc_module_name insname) : b1("b1"), b2("b2"), c("c") 66 { 67 ASSERT(strcmp ((const char*)insname,"top2") == 0); 68 ofstream o; 69 o.open ("results.txt"); 70 o << (const char*)insname << endl; 71 o << insname << endl; 72 o.close (); 73 } 47 48 struct top_level2 : sc_module { 49 B b1; 50 B b2; 51 C c; 52 top_level2(sc_module_name insname) : b1("b1"), b2("b2"), c("c") { 53 ASSERT(strcmp ((const char *) insname, "top2") == 0); 54 ofstream o; 55 o.open("results.txt"); 56 o << (const char *) insname << endl; 57 o << insname << endl; 58 o.close(); 59 } 74 60 }; 75 61 76 int77 sc_main (int argc, char ** argv)78 {79 if (argc < 1)80 {81 cerr << "Usage : " << argv[0] << "\n";82 exit (-1);83 }84 62 85 sc_clock clk("clock"); 86 top_level1 top1("top1"); 87 top_level2 top2("top2"); 63 int sc_main (int argc, char ** argv) { 64 if (argc < 1) { 65 cerr << "Usage : " << argv[0] << "\n"; 66 exit(-1); 67 } 88 68 89 sc_start(0); 69 sc_clock clk("clock"); 70 top_level1 top1("top1"); 71 top_level2 top2("top2"); 90 72 91 return 0; 73 sc_start(sc_time(0, sc_core::SC_NS)); 74 75 return 0; 92 76 } 93 77 78 79 /* 80 # Local Variables: 81 # tab-width: 4; 82 # c-basic-offset: 4; 83 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 84 # indent-tabs-mode: nil; 85 # End: 86 # 87 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 88 */ 89
Note: See TracChangeset
for help on using the changeset viewer.