openfpga/src/fabric/build_top_module_memory.cpp
/********************************************************************
 * Generate a list of ports that are used for SRAM configuration 
 * to the top-level module
 * 1. Standalone SRAMs: 
 *    use the suggested port_size 
 * 2. Scan-chain Flip-flops:
 *    IMPORTANT: the port size will be limited by the number of configurable regions
 * 3. Memory decoders:
 *    use the suggested port_size 
 ********************************************************************/
Generate a list of ports that are used for SRAM configuration
to the top-level module
1. Standalone SRAMs:
use the suggested port_size
2. Scan-chain Flip-flops:
IMPORTANT: the port size will be limited by the number of configurable regions
3. Memory decoders:
use the suggested port_size
Generate a list of ports that are used for SRAM configuration to the top - level module 1 . Standalone SRAMs : use the suggested port_size 2 . Scan - chain Flip - flops : IMPORTANT : the port size will be limited by the number of configurable regions 3 . Memory decoders : use the suggested port_size
static 
size_t generate_top_module_sram_port_size(const ConfigProtocol& config_protocol,
                                          const size_t& num_config_bits) {
  size_t sram_port_size = num_config_bits;
  switch (config_protocol.type()) {
  case CONFIG_MEM_STANDALONE: 
    break;
  case CONFIG_MEM_SCAN_CHAIN: 
  case CONFIG_MEM_MEMORY_BANK:
  case CONFIG_MEM_FRAME_BASED:
    sram_port_size = config_protocol.num_regions();
    break;
  default:
    VTR_LOGF_ERROR(__FILE__, __LINE__,
                   "Invalid type of SRAM organization!\n");
    exit(1);
  }
  return sram_port_size;
}
static size_t generate_top_module_sram_port_size ( const ConfigProtocol & config_protocol , const size_t & num_config_bits ) { size_t sram_port_size = num_config_bits ; switch ( config_protocol . type ( ) ) { case CONFIG_MEM_STANDALONE : break ; case CONFIG_MEM_SCAN_CHAIN : case CONFIG_MEM_MEMORY_BANK : case CONFIG_MEM_FRAME_BASED : sram_port_size = config_protocol . num_regions ( ) ; break ; default : VTR_LOGF_ERROR ( __FILE__ , __LINE__ , " \n " ) ; exit ( 1 ) ; } return sram_port_size ; }
Generate a list of ports that are used for SRAM configuration
 to the top-level module
 1.
Generate a list of ports that are used for SRAM configuration to the top - level module 1 .
/* CCFF head/tail, data input could be multi-bit ports */