Changeset 113 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/src/main.cpp
- Timestamp:
- Apr 14, 2009, 8:39:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/src/main.cpp
r101 r113 2 2 * $Id$ 3 3 * 4 * [ 4 * [ Description ] 5 5 * 6 6 */ 7 7 8 #include "Behavioural/Generic/Queue/SelfTest/include/t est.h"8 #include "Behavioural/Generic/Queue/SelfTest/include/top.h" 9 9 10 #define NB_PARAMS 5 10 #ifndef MTI_SYSTEMC 11 # ifndef SYSTEMC 12 int main (int argc, char * argv[]) 13 # else 14 int sc_main (int argc, char * argv[]) 15 # endif 16 { 17 int _return = EXIT_SUCCESS; 11 18 12 void usage (int argc, char * argv[])13 {14 cerr << "<Usage> " << argv[0] << " name_instance list_params" << endl15 << "list_params is :" << endl16 << " - size_queue (uint32_t)" << endl17 << " - size_data (uint32_t)" << endl18 << " - nb_port_slot (uint32_t)" << endl19 << " - have_port_write (bool )" << endl20 << " - have_port_read (bool )" << endl21 << "" << endl;22 23 for (int i=0; i<argc; i++)24 cerr << argv[i] << " ";25 cerr << endl;26 27 exit (1);28 }29 30 #ifndef SYSTEMC31 int main (int argc, char * argv[])32 #else33 int sc_main (int argc, char * argv[])34 #endif35 {36 if (argc != 2+NB_PARAMS)37 usage (argc, argv);38 39 uint32_t x = 1;40 41 const string name = argv[x++];42 const uint32_t size_queue = fromString<uint32_t>(argv[x++]);43 const uint32_t size_data = fromString<uint32_t>(argv[x++]);44 const uint32_t nb_port_slot = fromString<uint32_t>(argv[x++]);45 const bool have_port_write = fromString<bool>(argv[x++]);46 const bool have_port_read = fromString<bool>(argv[x++]);47 19 try 48 20 { 49 morpheo::behavioural::generic::queue::Parameters * param = new morpheo::behavioural::generic::queue::Parameters 50 (size_queue, 51 size_data , 52 nb_port_slot, 53 have_port_write, 54 have_port_read 55 ); 56 57 cout << param->print(1); 58 59 test (name,param); 21 top * my_top = new top ("my_top",argc,argv); 22 23 my_top->test(); 24 25 delete my_top; 60 26 } 61 27 catch (morpheo::ErrorMorpheo & error) 62 28 { 63 cout << "<" << name << "> : " << error.what ();64 exit (EXIT_FAILURE);29 msgError(_("%s\n"),error.what ()); 30 _return = EXIT_FAILURE; 65 31 } 66 catch (...) 32 33 try 67 34 { 68 cerr << "<" << name << "> : This test must generate a error" << endl; 69 exit (EXIT_FAILURE); 35 if (_return == EXIT_SUCCESS) 36 TEST_OK("Queue : no error"); 37 else 38 TEST_KO("Queue : a lot of error"); 39 } 40 catch (morpheo::ErrorMorpheo & error) 41 { 42 // msgError(_("<%s> :\n%s"),name.c_str(), error.what ()); 43 _return = EXIT_FAILURE; 70 44 } 71 45 72 return (EXIT_SUCCESS);46 return _return; 73 47 } 74 48 #endif
Note: See TracChangeset
for help on using the changeset viewer.