openfpga/src/utils/lut_utils.cpp
/********************************************************************
 * Complete a line in truth table with a given lut size
 * Due to the size of truth table may be less than the lut size.
 * i.e. in LUT-6 architecture, there exists LUT1-6 in technology-mapped netlists
 * So, in truth table line, there may be 10- 1
 * In this case, we should complete it by --10- 1
 *******************************************************************/
Complete a line in truth table with a given lut size
Due to the size of truth table may be less than the lut size.
Complete a line in truth table with a given lut size Due to the size of truth table may be less than the lut size .
static 
std::vector<vtr::LogicValue> complete_truth_table_line(const size_t& lut_size,
                                                       const std::vector<vtr::LogicValue>& tt_line) {
  std::vector<vtr::LogicValue> ret;
  VTR_ASSERT(0 < tt_line.size());
  size_t cover_len = tt_line.size() - 1; 
  VTR_ASSERT(cover_len <= lut_size);
  ret = tt_line;
  ret.pop_back();
  for (size_t j = cover_len; j < lut_size; ++j) {
    ret.push_back(vtr::LogicValue::DONT_CARE);
  }
  ret.push_back(tt_line.back());
  VTR_ASSERT(lut_size + 1 == ret.size());
  return ret;
}
static std :: vector < vtr :: LogicValue > complete_truth_table_line ( const size_t & lut_size , const std :: vector < vtr :: LogicValue > & tt_line ) { std :: vector < vtr :: LogicValue > ret ; VTR_ASSERT ( 0 < tt_line . size ( ) ) ; size_t cover_len = tt_line . size ( ) - 1 ; VTR_ASSERT ( cover_len <= lut_size ) ; ret = tt_line ; ret . pop_back ( ) ; for ( size_t j = cover_len ; j < lut_size ; ++ j ) { ret . push_back ( vtr :: LogicValue :: DONT_CARE ) ; } ret . push_back ( tt_line . back ( ) ) ; VTR_ASSERT ( lut_size + 1 == ret . size ( ) ) ; return ret ; }
Complete a line in truth table with a given lut size
 Due to the size of truth table may be less than the lut size.
Complete a line in truth table with a given lut size Due to the size of truth table may be less than the lut size .
/* Complete the truth table line*/ /* Copy the original truth table line */ /* Kick out the last value for now as it is the output value */ /* Add the number of '-' we should add in the back !!! */ /* Copy the original truth table line */ /* Check if the size of ret matches our expectation */