Changeset 55 for sources/test_regression/09092005b
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/09092005b
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/09092005b/Makefile
r15 r55 1 1 include ../env.mk 2 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 LOG = $(SYSTEM:.cpp=.log) 8 OBJECTS = $(EXE:.x=.o) 9 LINKS = $(OBJECTS:.o=.cpp) 10 11 .SECONDARY: 12 13 main : $(EXE) 2 include ../Makefile.common 14 3 15 4 test : $(EXE_SCASS) 16 ./system_systemcass.x || eval ${failcom} ; \ 17 tail -n +8 trace_file.vcd | diff trace_file_reference.vcd - || eval ${failcom} 5 @echo -ne "| Testing $$(basename $$(pwd)): " ; \ 6 ./$(EXE_SCASS) 2> /dev/null ; 7 @if tail -n +8 trace_file.vcd | diff trace_file_reference.vcd - ; then \ 8 echo "OK" ; \ 9 else \ 10 echo "KO" ; \ 11 fi ; 18 12 19 %.gif : %.dot20 dot -Tgif -o $*.gif $*.dot21 13 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 ${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 trace_file.vcd55 -
sources/test_regression/09092005b/system.cpp
r1 r55 1 1 2 #include "systemc.h" 2 3 3 #define ASSERT(x) \ 4 { errnum++; \ 5 if (!(x)) \ 6 { \ 7 cerr << "ASSERT : " #x "\n"; \ 8 exit (errnum); \ 9 } \ 10 } 4 #include "test.h" 11 5 12 6 using namespace std; 13 7 14 struct hard : sc_module 15 { 16 sc_in_clk clk; 17 sc_in <int> i1, i2; 18 sc_out<int> o1, o2; 8 struct hard : sc_module { 9 sc_in_clk clk; 10 sc_in <int> i1, i2; 11 sc_out<int> o1, o2; 19 12 20 void f () 21 { 22 o1 = i1; 23 o2 = i2; 24 } 13 void f() { 14 o1 = i1; 15 o2 = i2; 16 } 25 17 26 SC_HAS_PROCESS(hard); 27 hard(sc_module_name) 28 { 29 SC_METHOD(f); 30 dont_initialize(); 31 sensitive << i1 << i2; 18 SC_HAS_PROCESS(hard); 19 20 hard(sc_module_name) { 21 SC_METHOD(f); 22 sensitive << i1 << i2; 23 dont_initialize(); 24 32 25 #ifdef SYSTEMCASS_SPECIFIC 33 o1 (i1);34 o2 (i2);26 o1 (i1); 27 o2 (i2); 35 28 #endif 36 } 29 } 30 37 31 }; 38 32 39 int40 sc_main (int argc, char ** argv)41 {42 sc_clock clk1("clk1");43 sc_clock clk2("clk2", 1, 0.5, 0, false);44 sc_signal<int> s[10];45 hard a("a");46 hard b("b");47 hard c("c");48 33 49 a.clk (clk1); 50 b.clk (clk2); 51 c.clk (clk2); 34 int sc_main (int argc, char ** argv) { 35 sc_clock clk1("clk1"); 36 sc_clock clk2("clk2", 1, 0.5, 0, false); 37 sc_signal<int> s[10]; 38 hard a("a"); 39 hard b("b"); 40 hard c("c"); 52 41 53 a.i1 (s[0]); 42 a.clk(clk1); 43 b.clk(clk2); 44 c.clk(clk2); 54 45 55 a.o1 (s[1]); 56 b.i1 (s[1]); 46 a.i1(s[0]); 57 47 58 b.o1 (s[2]); 48 a.o1(s[1]); 49 b.i1(s[1]); 59 50 60 b.i2 (s[3]);51 b.o1(s[2]); 61 52 62 b.o2 (s[4]); 63 a.i2 (s[4]); 53 b.i2(s[3]); 64 54 65 a.o2 (s[5]); 55 b.o2(s[4]); 56 a.i2(s[4]); 66 57 67 c.i1 (s[6]); 68 c.o1 (s[7]); 69 c.i2 (s[8]); 70 c.o2 (s[9]); 58 a.o2(s[5]); 71 59 72 /* Open trace file */ 73 sc_trace_file *system_trace_file; 74 system_trace_file = sc_create_vcd_trace_file ("trace_file"); 75 76 /* clks waveforms are always useful */ 77 sc_trace(system_trace_file, clk1, "clk1"); 78 sc_trace(system_trace_file, clk2, "clk2"); 60 c.i1(s[6]); 61 c.o1(s[7]); 62 c.i2(s[8]); 63 c.o2(s[9]); 79 64 80 /* others signals */ 81 for (int i = 0; i < 10; ++i) 82 sc_trace(system_trace_file, s[i], sc_gen_unique_name ("s")); 83 84 /* initilization */ 85 sc_initialize (); 65 /* Open trace file */ 66 sc_trace_file *system_trace_file; 67 system_trace_file = sc_create_vcd_trace_file("trace_file"); 86 68 87 s[0] = 1; 88 s[3] = 1; 69 /* clks waveforms are always useful */ 70 sc_trace(system_trace_file, clk1, "clk1"); 71 sc_trace(system_trace_file, clk2, "clk2"); 89 72 90 sc_start (1); 73 /* others signals */ 74 for (int i = 0; i < 10; ++i) { 75 sc_trace(system_trace_file, s[i], sc_gen_unique_name ("s")); 76 } 91 77 92 s[0] = 123;93 s[3] = 321;78 /* initilization */ 79 sc_start(sc_time(0, sc_core::SC_NS)); 94 80 95 sc_start (1); 81 s[0] = 1; 82 s[3] = 1; 96 83 97 return 0; 84 sc_start(sc_time(1, sc_core::SC_NS)); 85 86 s[0] = 123; 87 s[3] = 321; 88 89 sc_start(sc_time(1, sc_core::SC_NS)); 90 91 return 0; 98 92 } 99 93 94 95 /* 96 # Local Variables: 97 # tab-width: 4; 98 # c-basic-offset: 4; 99 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 100 # indent-tabs-mode: nil; 101 # End: 102 # 103 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 104 */ 105
Note: See TracChangeset
for help on using the changeset viewer.