Ignore:
Timestamp:
May 28, 2013, 11:17:14 AM (11 years ago)
Author:
meunier
Message:

Tried to clean the test_regression directory:

  • Code formatting
  • Supressed warnings
  • Made comprehensible outputs
  • Factorized Makefiles

There's still a lot to do (many tests don't pass for either good or bad reasons)

Location:
sources/test_regression/04052005
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sources/test_regression/04052005/Makefile

    r15 r55  
     1
    12include ../env.mk
     3include ../Makefile.common
    24
    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)
     5test : 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 ;
    1013
    11 .SECONDARY:
    1214
    13 main : $(EXE)
    14 
    15 test : ${EXE}
    16         ./system_systemcass.x || eval ${failcom}
    17 
    18 %.gif : %.dot
    19         dot -Tgif -o $*.gif $*.dot
    20 
    21 %_systemc.x : %_systemc.o $(SYSTEMC_LIB)
    22         $(CXX) -o $@ $*_systemc.o $(LFLAGS_SYSTEMC) 2>&1 | $(CPPFILT)
    23 
    24 %_systemcass.x : %_systemcass.o  $(SYSTEMCASS_LIB)
    25         $(CXX) -o $@ $*_systemcass.o $(LFLAGS_SYSTEMCASS) 2>&1 | $(CPPFILT)
    26 
    27 -include Makefile.deps
    28 
    29 %_systemc.cpp : %.cpp
    30         ln -s $*.cpp $*_systemc.cpp
    31 
    32 %_systemcass.cpp : %.cpp
    33         ln -s $*.cpp $*_systemcass.cpp
    34 
    35 %_systemc.o : %_systemc.cpp
    36         $(CXX) $(CFLAGS_SYSTEMC) -MM $*_systemc.cpp >> Makefile.deps
    37         $(CXX) $(CFLAGS_SYSTEMC) -c $*_systemc.cpp -o $*_systemc.o
    38 
    39 %_systemcass.o : %_systemcass.cpp
    40         $(CXX) $(CFLAGS_SYSTEMCASS) -MM $*_systemcass.cpp >> Makefile.deps
    41         $(CXX) $(CFLAGS_SYSTEMCASS) -c $*_systemcass.cpp -o $*_systemcass.o
    42 
    43 clean :
    44         rm -f Makefile.deps
    45         -rm -f *.o gmon.out *~
    46         -rm -f ${LOG}
    47         -rm -f signal_order.txt module_order.dot signal_graph.dot
    48         -rm -f module_order.gif signal_graph.gif
    49         -rm -f $(EXE) $(OBJECTS)
    50         -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null
    51         -rm -f core*
    52         -rm -rf system_systemcass.x.vcd system_systemc.x.vcd
    53         -rm -rf generated_by_systemcass
    54        
  • sources/test_regression/04052005/system.cpp

    r1 r55  
    1 #include "systemc.h"
     1
    22#include <iostream>
    33
     4#include "systemc.h"
     5#include "test.h"
    46
    57using namespace std;
    68
    79
    8 int
    9 sc_main (int argc, char ** argv)
    10 {
    11   int errnum = 0;
    12  
    13   sc_uint<32> a;
    14   sc_uint<3>  b;
    15   sc_uint<2>  c;
    16   sc_uint<5>  d;
    17   sc_uint<8>  e;
    18   sc_uint<10> f;
     10int sc_main (int argc, char ** argv) {
    1911
    20   a = 0xCFFFFFFF;
    21   b = 0x7;
    22   c = 0x3;
    23   d = 0xA0;
    24   e = 0x11;
    25   f = 0x1A0;
    26  
    27   cerr << "a = 0x" << hex << (unsigned int)a << " = " << a.to_string (SC_BIN) << "\n";
    28   if (a.to_string (SC_BIN) != "0b011001111111111111111111111111111")
    29     exit (errnum);
    30   errnum++;
     12    sc_uint<32> a;
     13    sc_uint<3>  b;
     14    sc_uint<2>  c;
     15    sc_uint<5>  d;
     16    sc_uint<8>  e;
     17    sc_uint<10> f;
    3118
    32   cerr << "b = 0x" << hex << (unsigned int)b << " = " << b.to_string (SC_BIN) << "\n";
    33   if (b.to_string (SC_BIN) != "0b0111")
    34     exit (errnum);
    35   errnum++;
     19    a = 0xCFFFFFFF;
     20    b = 0x7;
     21    c = 0x3;
     22    d = 0xA0;
     23    e = 0x11;
     24    f = 0x1A0;
    3625
    37   cerr << "c = 0x" << hex << (unsigned int)c << " = " << c.to_string (SC_BIN) << "\n";
    38   if (c.to_string (SC_BIN) != "0b011")
    39     exit (errnum);
    40   errnum++;
     26    cout << "a = 0x" << hex << (unsigned int) a << " = " << a.to_string(SC_BIN) << "\n";
     27    ASSERT(a.to_string (SC_BIN) == "0b011001111111111111111111111111111");
    4128
    42   cerr << "d = 0x" << hex << (unsigned int)d << " = " << d.to_string (SC_BIN) << "\n";
    43   if (d.to_string (SC_BIN) != "0b000000")
    44     exit (errnum);
    45   errnum++;
     29    cout << "b = 0x" << hex << (unsigned int) b << " = " << b.to_string(SC_BIN) << "\n";
     30    ASSERT(b.to_string (SC_BIN) == "0b0111");
    4631
    47   cerr << "e = 0x" << hex << (unsigned int)e << " = " << e.to_string (SC_BIN) << "\n";
    48   if (e.to_string (SC_BIN) != "0b000010001")
    49     exit (errnum);
    50   errnum++;
     32    cout << "c = 0x" << hex << (unsigned int) c << " = " << c.to_string(SC_BIN) << "\n";
     33    ASSERT(c.to_string (SC_BIN) == "0b011");
    5134
    52   cerr << "f = 0x" << hex << (unsigned int)f << " = " << f.to_string (SC_BIN) << "\n";
    53   if (f.to_string (SC_BIN) != "0b00110100000")
    54     exit (errnum);
    55   errnum++;
     35    cout << "d = 0x" << hex << (unsigned int) d << " = " << d.to_string(SC_BIN) << "\n";
     36    ASSERT(d.to_string (SC_BIN) == "0b000000");
     37
     38    cout << "e = 0x" << hex << (unsigned int) e << " = " << e.to_string(SC_BIN) << "\n";
     39    ASSERT(e.to_string (SC_BIN) == "0b000010001");
     40
     41    cout << "f = 0x" << hex << (unsigned int) f << " = " << f.to_string(SC_BIN) << "\n";
     42    ASSERT(f.to_string (SC_BIN) == "0b00110100000");
     43
     44    cout << "b,e = 0x" << hex << (unsigned int) (b,e) << " = " << (b, e).to_string(SC_BIN) << "\n";
     45    ASSERT((b, e).to_string (SC_BIN) == "0b011100010001");
     46
     47    cout << "b,c,d,e,f = 0x" << hex << (unsigned int) (b, c, d, e, f) << " = " << (b, c, d, e, f).to_string (SC_BIN) << "\n";
     48    ASSERT((b, c, d, e, f).to_string (SC_BIN) == "0b01111100000000100010110100000");
     49
     50    a = b,c,d,e,f;
     51    cout << "a = b,c,d,e,f; a = 0x" << hex << (unsigned int) a << " = " << a.to_string (SC_BIN) << "\n";
     52    ASSERT(a.to_string (SC_BIN) == "0b000000000000000000000000000000111");
     53
     54    sc_uint<3> tb = b.range (2, 0);
     55    cout << "b.range (2,0) = 0x" << hex << (unsigned int) tb << " = " << tb.to_string (SC_BIN) << "\n";
     56    ASSERT(tb.to_string (SC_BIN) == "0b0111");
     57
     58    sc_uint<5> te = e.range(5, 1);
     59    cout << "e.range (5,1) = 0x" << hex << (unsigned int) te << " = " << te.to_string(SC_BIN) << "\n";
     60    ASSERT(te.to_string(SC_BIN) == "0b001000");
     61
     62    sc_uint<5> tf = f.range(9, 5);
     63    cout << "f.range (9,5) = 0x" << hex << (unsigned int) tf << " = " << tf.to_string (SC_BIN) << "\n";
     64    ASSERT(tf.to_string (SC_BIN) == "0b001101");
     65
     66    sc_uint<5> tf2 = f.range(8, 4);
     67    a = (tf2, b, c, d, e, f);
     68    cout << "a = f.range (7,3),b,c,d,e,f; a = 0x" << hex << (unsigned int) a << " = " << a.to_string (SC_BIN) << "\n";
     69    ASSERT(a.to_string (SC_BIN) == "0b010101111100000000100010110100000");
     70
     71    return 0;
     72}
    5673
    5774
    58   cerr << "b,e = 0x" << hex << (unsigned int)(b,e) << " = " << (b,e).to_string (SC_BIN) << "\n";
    59   if ((b,e).to_string (SC_BIN) != "0b011100010001")
    60     exit (errnum);
    61   errnum++;
     75/*
     76# Local Variables:
     77# tab-width: 4;
     78# c-basic-offset: 4;
     79# c-file-offsets:((innamespace . 0)(inline-open . 0));
     80# indent-tabs-mode: nil;
     81# End:
     82#
     83# vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     84*/
    6285
    63 
    64   cerr << "b,c,d,e,f = 0x" << hex << (unsigned int)(b,c,d,e,f) << " = " << (b,c,d,e,f).to_string (SC_BIN) << "\n";
    65   if ((b,c,d,e,f).to_string (SC_BIN) != "0b01111100000000100010110100000")
    66     exit (errnum);
    67   errnum++;
    68 
    69   a = b,c,d,e,f;
    70   cerr << "a = b,c,d,e,f; a = 0x" << hex << (unsigned int) a << " = " << a.to_string (SC_BIN) << "\n";
    71   if (a.to_string (SC_BIN) != "0b000000000000000000000000000000111")
    72     exit (errnum);
    73   errnum++;
    74 
    75   sc_uint<3> tb = b.range (2,0);
    76   cerr << "b.range (2,0) = 0x" << hex << (unsigned int) tb << " = " << tb.to_string (SC_BIN) << "\n";
    77   if (tb.to_string (SC_BIN) != "0b0111")
    78     exit (errnum);
    79   errnum++;
    80 
    81   sc_uint<5> te = e.range (5,1);
    82   cerr << "e.range (5,1) = 0x" << hex << (unsigned int) te << " = " << te.to_string (SC_BIN) << "\n";
    83   if (te.to_string (SC_BIN) != "0b001000")
    84     exit (errnum);
    85   errnum++;
    86  
    87   sc_uint<5> tf = f.range (9,5);
    88   cerr << "f.range (9,5) = 0x" << hex << (unsigned int) tf << " = " << tf.to_string (SC_BIN) << "\n";
    89   if (tf.to_string (SC_BIN) != "0b001101")
    90     exit (errnum);
    91   errnum++;
    92 
    93   sc_uint<5> tf2 = f.range (8,4);
    94   a = (tf2,b,c,d,e,f);
    95   cerr << "a = f.range (7,3),b,c,d,e,f; a = 0x" << hex << (unsigned int) a << " = " << a.to_string (SC_BIN) << "\n";
    96   if (a.to_string (SC_BIN) != "0b010101111100000000100010110100000")
    97     exit (errnum);
    98   errnum++;
    99 
    100   return 0;
    101 }
    102 
Note: See TracChangeset for help on using the changeset viewer.