1 | /* |
---|
2 | * $Id: sc_main.cpp 113 2009-04-14 18:39:12Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | * Platforms : Morpheo + Environment |
---|
7 | */ |
---|
8 | |
---|
9 | #include "../include/test.h" |
---|
10 | |
---|
11 | using namespace std; |
---|
12 | using namespace morpheo; |
---|
13 | |
---|
14 | void usage (int argc |
---|
15 | #ifdef MTI_SYSTEMC |
---|
16 | ,const char * const * argv |
---|
17 | #else |
---|
18 | ,char * argv[] |
---|
19 | #endif |
---|
20 | ) |
---|
21 | { |
---|
22 | cerr << "<Usage> " << argv[0] << endl |
---|
23 | << "In input stream : " << endl |
---|
24 | << " * filename_simulator (string )" << endl |
---|
25 | << " * filename_generator (string )" << endl |
---|
26 | << " * filename_instance (string )" << endl |
---|
27 | << " * filename_software (string )" << endl |
---|
28 | << " * nb_cache_dedicated (uint32_t)" << endl |
---|
29 | << " * nb_cache_shared (uint32_t)" << endl |
---|
30 | << " * size cache L1 (byte) (uint32_t)" << endl |
---|
31 | << " * ratio cache (uint32_t)" << endl; |
---|
32 | exit (EXIT_FAILURE); |
---|
33 | } |
---|
34 | |
---|
35 | #ifdef MTI_SYSTEMC |
---|
36 | SC_MODULE_EXPORT(top); |
---|
37 | |
---|
38 | top::top (sc_module_name name) |
---|
39 | #else |
---|
40 | int sc_main (int argc, char * argv[]) |
---|
41 | #endif |
---|
42 | { |
---|
43 | cout << "<sc_main> Begin" << endl; |
---|
44 | |
---|
45 | #ifdef MTI_SYSTEMC |
---|
46 | // accessing command-line arguments with modelsim |
---|
47 | int argc; |
---|
48 | const char * const * argv; |
---|
49 | |
---|
50 | argc = sc_argc (); |
---|
51 | argv = sc_argv (); |
---|
52 | #endif |
---|
53 | |
---|
54 | for (int32_t i=0; i<argc; ++i) |
---|
55 | cout << argv[i] << " "; |
---|
56 | cout << endl; |
---|
57 | |
---|
58 | //============================================================================== |
---|
59 | //===== [ Parameters ]========================================================== |
---|
60 | //============================================================================== |
---|
61 | |
---|
62 | if (argc != 9) |
---|
63 | usage (argc, argv); |
---|
64 | |
---|
65 | uint32_t x = 1; |
---|
66 | string filename_simulator = argv[x++]; |
---|
67 | string filename_generator = argv[x++]; |
---|
68 | string filename_instance = argv[x++]; |
---|
69 | string filename_software = argv[x++]; |
---|
70 | uint32_t nb_cache_dedicated = fromString<uint32_t>(argv[x++]); |
---|
71 | uint32_t nb_cache_shared = fromString<uint32_t>(argv[x++]); |
---|
72 | uint32_t cache_size = fromString<uint32_t>(argv[x++]); |
---|
73 | uint32_t cache_ratio = fromString<uint32_t>(argv[x++]); |
---|
74 | |
---|
75 | // string filename_simulator; |
---|
76 | // string filename_generator; |
---|
77 | // string filename_instance ; |
---|
78 | // string filename_software ; |
---|
79 | // uint32_t nb_cache_dedicated; |
---|
80 | // uint32_t nb_cache_shared ; |
---|
81 | // uint32_t cache_size ; |
---|
82 | // uint32_t cache_ratio ; |
---|
83 | |
---|
84 | // cout << "get filename_simulator ? " << endl; |
---|
85 | // cin >> filename_simulator ; |
---|
86 | |
---|
87 | // cout << "get filename_generator ? " << endl; |
---|
88 | // cin >> filename_generator ; |
---|
89 | |
---|
90 | // cout << "get filename_instance ? " << endl; |
---|
91 | // cin >> filename_instance ; |
---|
92 | |
---|
93 | // cout << "get filename_software ? " << endl; |
---|
94 | // cin >> filename_software ; |
---|
95 | |
---|
96 | // cout << "get nb_cache_dedicated ? " << endl; |
---|
97 | // cin >> nb_cache_dedicated ; |
---|
98 | |
---|
99 | // cout << "get nb_cache_shared ? " << endl; |
---|
100 | // cin >> nb_cache_shared ; |
---|
101 | |
---|
102 | // cout << "get size cache L1 (byte) ? " << endl; |
---|
103 | // cin >> cache_size ; |
---|
104 | |
---|
105 | // cout << "get ratio cache ? " << endl; |
---|
106 | // cin >> cache_ratio ; |
---|
107 | |
---|
108 | morpheo::behavioural::custom::custom_information_t (*get_custom_information) (void) = NULL; |
---|
109 | |
---|
110 | int _return = test (filename_simulator , |
---|
111 | filename_generator , |
---|
112 | filename_instance , |
---|
113 | filename_software , |
---|
114 | nb_cache_dedicated , |
---|
115 | nb_cache_shared , |
---|
116 | cache_size , |
---|
117 | cache_ratio , |
---|
118 | get_custom_information); |
---|
119 | |
---|
120 | cout << " * return : " << _return << endl; |
---|
121 | cout << "<sc_main> End" << endl; |
---|
122 | |
---|
123 | #ifndef MTI_SYSTEMC |
---|
124 | return _return; |
---|
125 | #endif |
---|
126 | } |
---|