Changeset 55 for sources/test_regression/14092005
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/14092005
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/14092005/Makefile
r15 r55 1 1 2 include ../env.mk 3 TRACE1 = trace_file_scass.vcd 4 TRACE2 = trace_file_systemc.vcd 5 ERASE = $(TRACE1) $(TRACE2) 6 include ../Makefile.common 2 7 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) 8 TRACE = trace_file.vcd 9 TRACE_REF = trace_file_reference.vcd 10 10 11 .SECONDARY: 11 test: all 12 @echo -ne "| Testing $$(basename $$(pwd)): " ; 13 @./$(EXE_SCASS) > $(LOG_SCASS) 2> /dev/null 14 @mv $(TRACE) $(TRACE1) 15 @./$(EXE_SC) > $(LOG_SC) 2> /dev/null 16 @mv $(TRACE) $(TRACE2) 17 @if tail -n +11 $(TRACE1) | diff $(TRACE_REF) - > /dev/null ; then \ 18 if tail -n +11 $(TRACE2) | diff $(TRACE_REF) - > /dev/null ; then \ 19 echo "OK" ; \ 20 else \ 21 echo "KO" ; \ 22 fi ; \ 23 else \ 24 echo "KO" ; \ 25 fi ; 12 26 13 main : $(EXE)14 27 15 test : trace_file_scass.vcd trace_file_systemc.vcd trace_file_reference.vcd16 -diff trace_file_systemc.vcd trace_file_scass.vcd17 diff trace_file_reference.vcd trace_file_scass.vcd18 19 trace_file_scass.vcd : system_systemcass.x20 ./system_systemcass.x21 tail -n +11 trace_file.vcd > trace_file_temp.vcd22 mv trace_file_temp.vcd trace_file_scass.vcd23 24 trace_file_systemc.vcd : system_systemc.x25 ./system_systemc.x26 tail -n +11 trace_file.vcd > trace_file_temp.vcd27 mv trace_file_temp.vcd trace_file_systemc.vcd28 29 %.gif : %.dot30 dot -Tgif -o $*.gif $*.dot31 32 %_systemc.x : %_systemc.o $(SYSTEMC_LIB)33 $(CXX) -o $@ $*_systemc.o $(LFLAGS_SYSTEMC) 2>&1 | $(CPPFILT)34 35 %_systemcass.x : %_systemcass.o $(SYSTEMCASS_LIB)36 $(CXX) -o $@ $*_systemcass.o $(LFLAGS_SYSTEMCASS) 2>&1 | $(CPPFILT)37 38 -include Makefile.deps39 40 %_systemc.cpp : %.cpp41 ln -s $*.cpp $*_systemc.cpp42 43 %_systemcass.cpp : %.cpp44 ln -s $*.cpp $*_systemcass.cpp45 46 %_systemc.o : %_systemc.cpp47 $(CXX) $(CFLAGS_SYSTEMC) -MM $*_systemc.cpp >> Makefile.deps48 $(CXX) $(CFLAGS_SYSTEMC) -c $*_systemc.cpp -o $*_systemc.o49 50 %_systemcass.o : %_systemcass.cpp51 $(CXX) $(CFLAGS_SYSTEMCASS) -MM $*_systemcass.cpp >> Makefile.deps52 $(CXX) $(CFLAGS_SYSTEMCASS) -c $*_systemcass.cpp -o $*_systemcass.o53 54 clean :55 rm -f Makefile.deps56 -rm -f *.o gmon.out *~57 -rm -f ${LOG}58 -rm -f signal_order.txt module_order.dot signal_graph.dot59 -rm -f module_order.gif signal_graph.gif60 -rm -f $(EXE) $(OBJECTS)61 -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null62 -rm -f core*63 -rm -rf generated_by_systemcass64 -rm -rf trace_file.vcd65 -
sources/test_regression/14092005/system.cpp
r1 r55 1 // Le test échoue 2 // Par ailleurs, la référence est la trace de systemcass ; je pense qu'il faudrait changer ça 3 1 4 #include "systemc.h" 2 5 3 #define ASSERT(x) \ 4 { errnum++; \ 5 if (!(x)) \ 6 { \ 7 cerr << "ASSERT : " #x "\n"; \ 8 exit (errnum); \ 9 } \ 10 } 6 #include "test.h" 7 11 8 12 9 using namespace std; 13 10 14 struct hard : sc_module 15 { 16 sc_in_clk clk; 17 sc_in<bool> resetn; 18 sc_in <int> i1; 19 sc_out<int> o1; 20 sc_signal <int> r1; 11 struct hard : sc_module { 12 sc_in_clk clk; 13 sc_in<bool> resetn; 14 sc_in <int> i1; 15 sc_out<int> o1; 16 sc_signal <int> r1; 21 17 22 void fg () 23 { 24 o1 = r1; 25 } 18 void fg() { 19 o1 = r1; 20 } 26 21 27 void ft () 28 { 29 if (resetn.read()) 30 r1 = i1; 31 else 32 r1 = 0x0; 33 } 22 void ft() { 23 if (resetn.read()) { 24 r1 = i1; 25 } 26 else { 27 r1 = 0x0; 28 } 29 } 34 30 35 SC_HAS_PROCESS(hard); 36 hard(sc_module_name) 37 { 38 SC_METHOD(ft); 39 dont_initialize(); 40 sensitive << clk.pos(); 41 SC_METHOD(fg); 42 dont_initialize(); 43 sensitive << clk.neg(); 44 #ifdef SYSTEMCASS_SPECIFIC 45 #endif 46 } 31 SC_HAS_PROCESS(hard); 32 33 hard(sc_module_name) { 34 SC_METHOD(ft); 35 sensitive << clk.pos(); 36 dont_initialize(); 37 38 SC_METHOD(fg); 39 sensitive << clk.neg(); 40 dont_initialize(); 41 } 47 42 }; 48 43 49 int50 sc_main (int argc, char ** argv)51 {52 int errnum = 0;53 sc_clock clk1("clk1", 1, 0.5,0,true);54 sc_signal<bool> resetn;55 sc_signal<int> s[10];56 hard a("a");57 44 58 a.clk (clk1); 59 a.resetn (resetn); 45 int sc_main (int argc, char ** argv) { 46 sc_clock clk1("clk1", 1, 0.5, 0, true); 47 sc_signal<bool> resetn; 48 sc_signal<int> s[10]; 49 hard a("a"); 60 50 61 a.i1 (s[0]);62 a.o1 (s[1]);51 a.clk (clk1); 52 a.resetn(resetn); 63 53 64 /* Open trace file */ 65 sc_trace_file *system_trace_file; 66 system_trace_file = sc_create_vcd_trace_file ("trace_file"); 67 68 /* clks waveforms are always useful */ 69 sc_trace(system_trace_file, resetn, "resetn"); 70 sc_trace(system_trace_file, s[0], "i1"); 71 sc_trace(system_trace_file, s[1], "o1"); 72 sc_trace(system_trace_file, clk1, "clk1"); 54 a.i1(s[0]); 55 a.o1(s[1]); 73 56 74 /* initilization */ 75 sc_initialize (); 57 /* Open trace file */ 58 sc_trace_file *system_trace_file; 59 system_trace_file = sc_create_vcd_trace_file ("trace_file"); 76 60 77 s[0] = 0; 78 resetn = 0; 61 /* clks waveforms are always useful */ 62 sc_trace(system_trace_file, resetn, "resetn"); 63 sc_trace(system_trace_file, s[0], "i1"); 64 sc_trace(system_trace_file, s[1], "o1"); 65 sc_trace(system_trace_file, clk1, "clk1"); 79 66 80 sc_start (5); 67 /* initilization */ 68 sc_start(sc_time(0, sc_core::SC_NS)); 81 69 82 s[0] = 0x7B;83 resetn = 1;70 s[0] = 0; 71 resetn = 0; 84 72 85 sc_start (1);73 sc_start(sc_time(5, sc_core::SC_NS)); 86 74 87 for (int i = 0; i < 10; i++) 88 { 89 s[0] = i; 90 sc_start (1); 91 // cout << i << " " << s[1].read() << " " << a.o1.read() << endl; 92 //ASSERT(((i > 0) && (s[1].read() == i - 1)) || ((i == 0) && (s[1].read() == 0x7B))); 93 ASSERT(s[1].read() == i); 94 } 75 s[0] = 0x7B; 76 resetn = 1; 95 77 96 cout << "Test OK\n"; 97 return 0; 78 sc_start(sc_time(1, sc_core::SC_NS)); 79 80 for (int i = 0; i < 10; i++) { 81 s[0] = i; 82 sc_start(sc_time(1, sc_core::SC_NS)); 83 ASSERT(s[1].read() == i); 84 } 85 86 return 0; 98 87 } 99 88 89 90 /* 91 # Local Variables: 92 # tab-width: 4; 93 # c-basic-offset: 4; 94 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 95 # indent-tabs-mode: nil; 96 # End: 97 # 98 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 99 */ 100
Note: See TracChangeset
for help on using the changeset viewer.