[2] | 1 | /* |
---|
| 2 | * $Id: Counter_allocation.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
| 3 | * |
---|
[88] | 4 | * [ Description ] |
---|
[2] | 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Generic/Counter/include/Counter.h" |
---|
| 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | namespace generic { |
---|
| 13 | namespace counter { |
---|
| 14 | |
---|
| 15 | void Counter::allocation (void) |
---|
| 16 | { |
---|
| 17 | log_printf(FUNC,Counter,"allocation","Begin"); |
---|
| 18 | |
---|
[82] | 19 | _component = new Component (_usage); |
---|
[42] | 20 | |
---|
| 21 | Entity * entity = _component->set_entity (_name |
---|
| 22 | ,"Counter" |
---|
| 23 | #ifdef POSITION |
---|
| 24 | ,COMBINATORY |
---|
[2] | 25 | #endif |
---|
[42] | 26 | ); |
---|
[2] | 27 | |
---|
[42] | 28 | _interfaces = entity->set_interfaces(); |
---|
[2] | 29 | |
---|
[88] | 30 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[42] | 31 | { |
---|
| 32 | Interface * interface = _interfaces->set_interface("" |
---|
| 33 | #ifdef POSITION |
---|
| 34 | , IN |
---|
| 35 | , SOUTH |
---|
| 36 | , "Generalist interface" |
---|
| 37 | #endif |
---|
| 38 | ); |
---|
| 39 | |
---|
| 40 | in_CLOCK = interface->set_signal_clk ("clock" ,1,CLOCK_VHDL_NO); |
---|
| 41 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1,RESET_VHDL_NO); |
---|
| 42 | } |
---|
[2] | 43 | |
---|
[88] | 44 | // ~~~~~[ Interface : "counter" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[42] | 45 | { |
---|
| 46 | in_COUNTER_DATA = new SC_IN (Tdata_t) * [_param._nb_port]; |
---|
| 47 | in_COUNTER_ADDSUB= new SC_IN (Tcontrol_t) * [_param._nb_port]; |
---|
| 48 | out_COUNTER_DATA = new SC_OUT(Tdata_t) * [_param._nb_port]; |
---|
| 49 | |
---|
| 50 | for (uint32_t i=0; i<_param._nb_port; i++) |
---|
| 51 | { |
---|
| 52 | Interface_fifo * interface = _interfaces->set_interface("counter_"+toString(i) |
---|
| 53 | #ifdef POSITION |
---|
| 54 | , IN |
---|
| 55 | , SOUTH |
---|
| 56 | , "Counter interface" |
---|
| 57 | #endif |
---|
| 58 | ); |
---|
| 59 | |
---|
| 60 | in_COUNTER_DATA [i] = interface->set_signal_in <Tdata_t > ("data" , _param._size_data); |
---|
| 61 | in_COUNTER_ADDSUB [i] = interface->set_signal_in <Tcontrol_t> ("addsub", 1 ); |
---|
| 62 | out_COUNTER_DATA [i] = interface->set_signal_out <Tdata_t > ("data" , _param._size_data); |
---|
| 63 | } |
---|
| 64 | } |
---|
[88] | 65 | |
---|
[42] | 66 | #ifdef POSITION |
---|
[88] | 67 | if (usage_is_set(_usage,USE_POSITION)) |
---|
| 68 | _component->generate_file(); |
---|
[42] | 69 | #endif |
---|
[2] | 70 | |
---|
[88] | 71 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[2] | 72 | log_printf(FUNC,Counter,"allocation","End"); |
---|
| 73 | }; |
---|
| 74 | |
---|
| 75 | }; // end namespace counter |
---|
| 76 | }; // end namespace generic |
---|
| 77 | |
---|
| 78 | }; // end namespace behavioural |
---|
| 79 | }; // end namespace morpheo |
---|