[67] | 1 | /* |
---|
| 2 | * $Id: Queue_allocation.cpp 113 2009-04-14 18:39:12Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Generic/Queue/include/Queue.h" |
---|
[100] | 9 | #include "Behavioural/include/Allocation.h" |
---|
[67] | 10 | |
---|
[113] | 11 | namespace morpheo { |
---|
[67] | 12 | namespace behavioural { |
---|
| 13 | namespace generic { |
---|
| 14 | namespace queue { |
---|
| 15 | |
---|
| 16 | #undef FUNCTION |
---|
| 17 | #define FUNCTION "Queue::allocation" |
---|
| 18 | void Queue::allocation (void) |
---|
| 19 | { |
---|
| 20 | log_printf(FUNC,Queue,FUNCTION,"Begin"); |
---|
| 21 | |
---|
[68] | 22 | _component = new Component (_usage); |
---|
[67] | 23 | |
---|
| 24 | Entity * entity = _component->set_entity (_name |
---|
[113] | 25 | ,_param->_type |
---|
[67] | 26 | #ifdef POSITION |
---|
| 27 | ,COMBINATORY |
---|
| 28 | #endif |
---|
| 29 | ); |
---|
| 30 | |
---|
| 31 | _interfaces = entity->set_interfaces(); |
---|
| 32 | |
---|
| 33 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 34 | { |
---|
| 35 | Interface * interface = _interfaces->set_interface("" |
---|
| 36 | #ifdef POSITION |
---|
| 37 | ,IN |
---|
| 38 | ,SOUTH, |
---|
[100] | 39 | _("Generalist interface") |
---|
[67] | 40 | #endif |
---|
| 41 | ); |
---|
| 42 | |
---|
| 43 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
| 44 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | // ~~~~~[ Interface "insert" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 48 | { |
---|
[112] | 49 | ALLOC0_INTERFACE_BEGIN("insert", IN, WEST, _("Interface of data write.")); |
---|
[67] | 50 | |
---|
[100] | 51 | ALLOC0_VALACK_IN ( in_INSERT_VAL ,VAL); |
---|
| 52 | ALLOC0_VALACK_OUT(out_INSERT_ACK ,ACK); |
---|
| 53 | ALLOC0_SIGNAL_IN ( in_INSERT_DATA ,"data",Tdata_t,_param->_size_data); |
---|
[112] | 54 | |
---|
| 55 | ALLOC0_INTERFACE_END(); |
---|
[67] | 56 | } |
---|
[100] | 57 | |
---|
[67] | 58 | // ~~~~~[ Interface "retire" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 59 | { |
---|
[112] | 60 | ALLOC0_INTERFACE_BEGIN("retire", OUT, EAST, _("Interface of data read.")); |
---|
[67] | 61 | |
---|
[100] | 62 | ALLOC0_VALACK_OUT(out_RETIRE_VAL ,VAL); |
---|
| 63 | ALLOC0_VALACK_IN ( in_RETIRE_ACK ,ACK); |
---|
| 64 | ALLOC0_SIGNAL_OUT(out_RETIRE_DATA ,"data",Tdata_t,_param->_size_data); |
---|
[112] | 65 | |
---|
| 66 | ALLOC0_INTERFACE_END(); |
---|
[67] | 67 | } |
---|
[100] | 68 | |
---|
| 69 | // ~~~~~[ Interface "slot" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 70 | { |
---|
[112] | 71 | ALLOC1_INTERFACE_BEGIN("slot", OUT, NORTH, _("Internal slot."),_param->_nb_port_slot); |
---|
[100] | 72 | |
---|
| 73 | ALLOC1_VALACK_OUT(out_SLOT_VAL ,VAL); |
---|
| 74 | ALLOC1_SIGNAL_OUT(out_SLOT_DATA ,"data",Tdata_t,_param->_size_data); |
---|
[112] | 75 | |
---|
| 76 | ALLOC1_INTERFACE_END(_param->_nb_port_slot); |
---|
[100] | 77 | } |
---|
[101] | 78 | |
---|
| 79 | // ~~~~~[ Interface "ptr" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 80 | if (_param->_have_port_ptr) |
---|
| 81 | { |
---|
[112] | 82 | ALLOC0_INTERFACE_BEGIN("ptr", OUT, SOUTH, _("Internal pointer.")); |
---|
[101] | 83 | |
---|
| 84 | if (_param->_have_port_ptr_write) |
---|
| 85 | ALLOC0_SIGNAL_OUT(out_PTR_WRITE ,"write",Tptr_t,_param->_size_ptr); |
---|
| 86 | if (_param->_have_port_ptr_read ) |
---|
| 87 | ALLOC0_SIGNAL_OUT(out_PTR_READ ,"read" ,Tptr_t,_param->_size_ptr); |
---|
[112] | 88 | |
---|
| 89 | ALLOC0_INTERFACE_END(); |
---|
[101] | 90 | } |
---|
[67] | 91 | |
---|
[88] | 92 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
| 93 | { |
---|
[67] | 94 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 95 | _queue_control = new morpheo::behavioural::generic::queue_control::Queue_Control::Queue_Control(_param->_size_queue); |
---|
| 96 | _queue_data = new Tdata_t [_param->_size_queue]; |
---|
[88] | 97 | } |
---|
[67] | 98 | |
---|
| 99 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 100 | |
---|
| 101 | #ifdef POSITION |
---|
[88] | 102 | if (usage_is_set(_usage,USE_POSITION)) |
---|
| 103 | _component->generate_file(); |
---|
[67] | 104 | #endif |
---|
| 105 | |
---|
| 106 | log_printf(FUNC,Queue,FUNCTION,"End"); |
---|
| 107 | }; |
---|
| 108 | |
---|
| 109 | }; // end namespace queue |
---|
| 110 | }; // end namespace generic |
---|
| 111 | }; // end namespace behavioural |
---|
| 112 | }; // end namespace morpheo |
---|