[10] | 1 | #ifdef VHDL |
---|
| 2 | /* |
---|
| 3 | * $Id: Select_Priority_Fixed_vhdl_body.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
[15] | 9 | #include "Behavioural/Generic/Select/Select_Priority_Fixed/include/Select_Priority_Fixed.h" |
---|
[10] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace generic { |
---|
| 14 | namespace select { |
---|
[15] | 15 | namespace select_priority_fixed { |
---|
[10] | 16 | |
---|
| 17 | |
---|
[29] | 18 | void Select_Priority_Fixed::vhdl_body (Vhdl * & vhdl) |
---|
[10] | 19 | { |
---|
[15] | 20 | log_printf(FUNC,Select_Priority_Fixed,"vhdl_body","Begin"); |
---|
[29] | 21 | vhdl->set_body (""); |
---|
[10] | 22 | |
---|
[29] | 23 | vhdl->set_body("internal_entity <="); |
---|
[57] | 24 | for (uint32_t i=0; i<_param->_nb_entity; i++) |
---|
[10] | 25 | { |
---|
[57] | 26 | vhdl->set_body("\t"+std_logic_conv(_param->_size_entity+1,i)+" when in_VAL_"+toString(i)+"='1' else"); |
---|
[10] | 27 | } |
---|
[57] | 28 | vhdl->set_body("\t"+std_logic_conv(_param->_size_entity+1,1<<_param->_size_entity)+";"); |
---|
[29] | 29 | vhdl->set_body (""); |
---|
[10] | 30 | |
---|
[57] | 31 | if (_param->_encoding_one_hot) |
---|
[10] | 32 | { |
---|
[57] | 33 | for (uint32_t i=0; i<_param->_nb_entity; i++) |
---|
| 34 | vhdl->set_body("out_ACK_"+toString(i)+" <= '1' when internal_entity"+std_logic_range(_param->_size_entity+1)+" = "+std_logic_conv(_param->_size_entity+1,i)+" else '0';"); |
---|
[29] | 35 | vhdl->set_body (""); |
---|
[10] | 36 | } |
---|
| 37 | |
---|
[57] | 38 | if (_param->_encoding_compact) |
---|
[10] | 39 | { |
---|
[75] | 40 | std::string range = ((_param->_size_entity-1)==0)?"(0)":std_logic_range(_param->_size_entity-1,0); |
---|
[59] | 41 | |
---|
| 42 | vhdl->set_body ("out_ENTITY <= internal_entity"+range+";"); |
---|
[57] | 43 | vhdl->set_body ("out_ENTITY_ACK <= not internal_entity"+std_logic_range(_param->_size_entity ,_param->_size_entity)+";"); |
---|
[10] | 44 | } |
---|
| 45 | |
---|
[15] | 46 | log_printf(FUNC,Select_Priority_Fixed,"vhdl_body","End"); |
---|
[10] | 47 | }; |
---|
| 48 | |
---|
[15] | 49 | }; // end namespace select_priority_fixed |
---|
[10] | 50 | }; // end namespace select |
---|
| 51 | }; // end namespace generic |
---|
| 52 | |
---|
| 53 | }; // end namespace behavioural |
---|
| 54 | }; // end namespace morpheo |
---|
| 55 | #endif |
---|