vpr7_x2p/vpr/SRC/device/decoder_library_utils.cpp
/***************************************************************************************
 * NOTE: This function is mainly designed for local decoders inside multiplexers
 * Find the size of address lines for a decoder with a given data output size
 *                   Addr lines 
 *                   | | ... | 
 *                   v v     v
 *                 +-----------+
 *                /    Local    \
 *               /    Decoder    \
 *              +-----------------+
 *                | | | ... | | |
 *                v v v     v v v
 *                   Data outputs
 *               
 *  The outputs are assumes to be one-hot codes (at most only one '1' exist)
 *  Considering this fact, there are only num_of_outputs + 1 conditions to be encoded.
 *  Therefore, the number of inputs is ceil(log(num_of_outputs+1)/log(2))
 *  We plus 1, which is all-zero condition for outputs
 ***************************************************************************************/
This function is mainly designed for local decoders inside multiplexers
Find the size of address lines for a decoder with a given data output size
Addr lines
| | ...

The outputs are assumes to be one-hot codes (at most only one '1' exist)
Considering this fact, there are only num_of_outputs + 1 conditions to be encoded.
Therefore, the number of inputs is ceil(log(num_of_outputs+1)/log(2))
We plus 1, which is all-zero condition for outputs
This function is mainly designed for local decoders inside multiplexers Find the size of address lines for a decoder with a given data output size Addr lines | | ... The outputs are assumes to be one - hot codes ( at most only one ' 1 ' exist ) Considering this fact there are only num_of_outputs + 1 conditions to be encoded . Therefore the number of inputs is ceil ( log ( num_of_outputs + 1 ) / log ( 2 )) We plus 1 which is all - zero condition for outputs
size_t find_mux_local_decoder_addr_size(const size_t& data_size) {
  if (1 == data_size) {
    return 1;
  }
  VTR_ASSERT (2 <= data_size);
  return ceil(log(data_size) / log(2));
}
size_t find_mux_local_decoder_addr_size ( const size_t & data_size ) { if ( 1 == data_size ) { return 1 ; } VTR_ASSERT ( 2 <= data_size ) ; return ceil ( log ( data_size ) / log ( 2 ) ) ; }
NOTE: This function is mainly designed for local decoders inside multiplexers
 Find the size of address lines for a decoder with a given data output size
                   Addr lines
                   | | ... |
                   v v     v
                 +-----------+
                /    Local    \
               /    Decoder    \
              +-----------------+
                | | | ... | | |
                v v v     v v v
                   Data outputs
NOTE : This function is mainly designed for local decoders inside multiplexers Find the size of address lines for a decoder with a given data output size Addr lines | | ... | v v v + ----------- + / Local \ / Decoder \ + ----------------- + | | | ... | | | v v v v v v Data outputs
/* if data size is 1, it is an corner case for the decoder (addr = 1) */