openfpga/src/utils/mux_utils.cpp
/**************************************************
 * Find the number of reserved configuration bits for a multiplexer
 * The reserved configuration bits is only used by ReRAM-based multiplexers
 * It is actually the shared BL/WLs among ReRAMs
 *************************************************/
Find the number of reserved configuration bits for a multiplexer
The reserved configuration bits is only used by ReRAM-based multiplexers
It is actually the shared BL/WLs among ReRAMs
Find the number of reserved configuration bits for a multiplexer The reserved configuration bits is only used by ReRAM - based multiplexers It is actually the shared BL / WLs among ReRAMs
size_t find_mux_num_reserved_config_bits(const CircuitLibrary& circuit_lib,
                                         const CircuitModelId& mux_model,
                                         const MuxGraph& mux_graph) {
  if (CIRCUIT_MODEL_DESIGN_RRAM != circuit_lib.design_tech_type(mux_model)) {
    return 0;
  }
  std::vector<size_t> mux_branch_sizes = mux_graph.branch_sizes(); 
  if ( (1 == mux_branch_sizes.size()) 
    && (2 == mux_branch_sizes[0]) ) {
    return mux_branch_sizes[0];
  }
  if ( 1 == mux_graph.num_levels() ) {
    return mux_graph.num_inputs();
  }
  std::vector<size_t>::iterator max_mux_branch_size = std::max_element(mux_branch_sizes.begin(), mux_branch_sizes.end());
  return mux_graph.num_levels() * (*max_mux_branch_size);
}
size_t find_mux_num_reserved_config_bits ( const CircuitLibrary & circuit_lib , const CircuitModelId & mux_model , const MuxGraph & mux_graph ) { if ( CIRCUIT_MODEL_DESIGN_RRAM != circuit_lib . design_tech_type ( mux_model ) ) { return 0 ; } std :: vector < size_t > mux_branch_sizes = mux_graph . branch_sizes ( ) ; if ( ( 1 == mux_branch_sizes . size ( ) ) && ( 2 == mux_branch_sizes [ 0 ] ) ) { return mux_branch_sizes [ 0 ] ; } if ( 1 == mux_graph . num_levels ( ) ) { return mux_graph . num_inputs ( ) ; } std :: vector < size_t > :: iterator max_mux_branch_size = std :: max_element ( mux_branch_sizes . begin ( ) , mux_branch_sizes . end ( ) ) ; return mux_graph . num_levels ( ) * ( * max_mux_branch_size ) ; }
Find the number of reserved configuration bits for a multiplexer
 The reserved configuration bits is only used by ReRAM-based multiplexers
 It is actually the shared BL/WLs among ReRAMs
Find the number of reserved configuration bits for a multiplexer The reserved configuration bits is only used by ReRAM - based multiplexers It is actually the shared BL / WLs among ReRAMs
/* For tree-like multiplexers: they have two shared configuration bits */ /* One-level multiplexer */ /* Multi-level multiplexers: TODO: This should be better tested and clarified 
   * Now the multi-level multiplexers are treated as cascaded one-level multiplexers 
   * Use the maximum branch sizes and multiply it by the number of levels 
   */