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