[112] | 1 | /* |
---|
| 2 | * $Id: main.cpp 116 2009-04-30 13:51:41Z moulu $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Generic/Multiplier/SelfTest/include/test.h" |
---|
[116] | 9 | #include "Behavioural/include/Selftest.h" |
---|
[112] | 10 | |
---|
[116] | 11 | #define NB_PARAMS 4 |
---|
[112] | 12 | |
---|
| 13 | void usage (int argc, char * argv[]) |
---|
| 14 | { |
---|
| 15 | err (_("<Usage> %s name_instance list_params.\n"),argv[0]); |
---|
| 16 | err (_("list_params is :\n")); |
---|
[116] | 17 | err (_(" * size_data (uint32_t)\n")); |
---|
| 18 | err (_(" * sign (bool )\n")); |
---|
| 19 | err (_(" * latency (uint32_t)\n")); |
---|
| 20 | err (_(" * delay (uint32_t)\n")); |
---|
[112] | 21 | |
---|
| 22 | exit (1); |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | #ifndef SYSTEMC |
---|
| 26 | int main (int argc, char * argv[]) |
---|
| 27 | #else |
---|
| 28 | int sc_main (int argc, char * argv[]) |
---|
| 29 | #endif |
---|
| 30 | { |
---|
| 31 | if (argc != static_cast<int>(2+NB_PARAMS)) |
---|
| 32 | usage (argc, argv); |
---|
| 33 | |
---|
| 34 | uint32_t x = 1; |
---|
| 35 | |
---|
[116] | 36 | uint32_t _size_data; |
---|
| 37 | bool _sign ; |
---|
| 38 | uint32_t _latency ; |
---|
| 39 | uint32_t _delay ; |
---|
| 40 | |
---|
[112] | 41 | string name = argv[x++]; |
---|
| 42 | |
---|
[116] | 43 | SELFTEST0(_size_data,uint32_t,argv,x); |
---|
| 44 | SELFTEST0(_sign ,bool ,argv,x); |
---|
| 45 | SELFTEST0(_latency ,uint32_t,argv,x); |
---|
| 46 | SELFTEST0(_delay ,uint32_t,argv,x); |
---|
| 47 | |
---|
[112] | 48 | int _return = EXIT_SUCCESS; |
---|
| 49 | try |
---|
| 50 | { |
---|
| 51 | morpheo::behavioural::generic::multiplier::Parameters * param = new morpheo::behavioural::generic::multiplier::Parameters |
---|
| 52 | ( |
---|
[116] | 53 | _size_data, |
---|
| 54 | _sign , |
---|
| 55 | _latency , |
---|
| 56 | _delay , |
---|
[112] | 57 | true //is_toplevel |
---|
| 58 | ); |
---|
| 59 | |
---|
| 60 | msg(_("%s"),param->print(0).c_str()); |
---|
| 61 | |
---|
| 62 | test (name,param); |
---|
| 63 | } |
---|
| 64 | catch (morpheo::ErrorMorpheo & error) |
---|
| 65 | { |
---|
| 66 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
| 67 | _return = EXIT_FAILURE; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | try |
---|
| 71 | { |
---|
| 72 | if (_return == EXIT_SUCCESS) |
---|
| 73 | TEST_OK("Multiplier : no error"); |
---|
| 74 | else |
---|
| 75 | TEST_KO("Multiplier : a lot of error"); |
---|
| 76 | } |
---|
| 77 | catch (morpheo::ErrorMorpheo & error) |
---|
| 78 | { |
---|
| 79 | // msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
| 80 | _return = EXIT_FAILURE; |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | return (_return); |
---|
| 84 | } |
---|