[29] | 1 | /* |
---|
| 2 | * $Id: Interface_get_signal.cpp 94 2008-12-15 11:04:03Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/include/Interface.h" |
---|
[94] | 9 | #include "Common/include/Tabulation.h" |
---|
[29] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | |
---|
[75] | 14 | std::string Interface::get_signal (void) |
---|
[29] | 15 | { |
---|
[38] | 16 | log_printf(FUNC,Behavioural,"get_signal","Begin"); |
---|
[40] | 17 | |
---|
[29] | 18 | uint32_t depth = 0; |
---|
[75] | 19 | std::string separator = ",\n"; |
---|
[29] | 20 | bool last_separator = false; |
---|
| 21 | |
---|
| 22 | |
---|
[75] | 23 | std::list<Signal*>::iterator i = _list_signal->begin(); |
---|
| 24 | bool empty = _list_signal->empty(); |
---|
[29] | 25 | |
---|
[94] | 26 | std::string tab = morpheo::tab(depth); |
---|
[75] | 27 | std::ostringstream text; |
---|
[29] | 28 | |
---|
| 29 | if (not empty) |
---|
| 30 | { |
---|
| 31 | // First |
---|
[31] | 32 | if (i != _list_signal->end()) |
---|
[29] | 33 | { |
---|
[38] | 34 | text << tab << **i; |
---|
[29] | 35 | ++i; |
---|
| 36 | } |
---|
| 37 | |
---|
[31] | 38 | while (i != _list_signal->end()) |
---|
[29] | 39 | { |
---|
| 40 | text << separator; |
---|
[38] | 41 | text << tab << **i; |
---|
[29] | 42 | ++i; |
---|
| 43 | } |
---|
| 44 | if (last_separator) |
---|
| 45 | text << separator; |
---|
| 46 | } |
---|
| 47 | |
---|
[38] | 48 | log_printf(FUNC,Behavioural,"get_signal","End"); |
---|
| 49 | |
---|
[29] | 50 | return text.str(); |
---|
| 51 | }; |
---|
| 52 | |
---|
[41] | 53 | #ifdef VHDL |
---|
| 54 | # ifdef VHDL_TESTBENCH |
---|
[43] | 55 | |
---|
| 56 | #undef FUNCTION |
---|
| 57 | #define FUNCTION "Interface::get_signal" |
---|
[75] | 58 | void Interface::get_signal (std::list<std::string> * & list_signal) |
---|
[41] | 59 | { |
---|
[43] | 60 | log_printf(FUNC,Behavioural,FUNCTION,"Begin"); |
---|
| 61 | |
---|
[41] | 62 | if (not _list_signal->empty()) |
---|
| 63 | { |
---|
[75] | 64 | std::list<Signal*>::iterator i = _list_signal->begin(); |
---|
[41] | 65 | |
---|
| 66 | while (i != _list_signal->end()) |
---|
| 67 | { |
---|
| 68 | (*i)->get_name_vhdl (list_signal); |
---|
| 69 | ++i; |
---|
| 70 | } |
---|
| 71 | } |
---|
[43] | 72 | |
---|
| 73 | log_printf(FUNC,Behavioural,FUNCTION,"End"); |
---|
[41] | 74 | }; |
---|
| 75 | # endif |
---|
| 76 | #endif |
---|
| 77 | |
---|
[43] | 78 | #undef FUNCTION |
---|
| 79 | #define FUNCTION "Interface::get_signal_list" |
---|
[75] | 80 | std::list<Signal *> * Interface::get_signal_list (void) |
---|
[42] | 81 | { |
---|
[43] | 82 | log_printf(FUNC,Behavioural,FUNCTION,"Begin"); |
---|
[75] | 83 | std::list<Signal *> * _return = _list_signal; |
---|
[43] | 84 | log_printf(FUNC,Behavioural,FUNCTION,"End"); |
---|
| 85 | |
---|
| 86 | return _return; |
---|
[42] | 87 | } |
---|
| 88 | |
---|
[29] | 89 | }; // end namespace behavioural |
---|
| 90 | }; // end namespace morpheo |
---|