openfpga/src/fpga_spice/spice_subckt_writer.cpp
/********************************************************************
 * Write a SPICE sub-circuit to a file
 * This is a key function, maybe most frequently called in our SPICE writer
 * Note that file stream must be valid 
 *******************************************************************/
Write a SPICE sub-circuit to a file
This is a key function, maybe most frequently called in our SPICE writer
Note that file stream must be valid
Write a SPICE sub - circuit to a file This is a key function maybe most frequently called in our SPICE writer Note that file stream must be valid
void write_spice_subckt_to_file(std::fstream& fp,
                                  const ModuleManager& module_manager,
                                  const ModuleId& module_id) {
  VTR_ASSERT(true == valid_file_stream(fp));
  VTR_ASSERT(module_manager.valid_module_id(module_id)); 
  print_spice_subckt_definition(fp, module_manager, module_id);
  fp << std::endl;
  fp << std::endl;
  print_spice_comment(fp, std::string("BEGIN Local short connections"));
  print_spice_subckt_local_short_connections(fp, module_manager, module_id);
  print_spice_comment(fp, std::string("END Local short connections"));
  print_spice_comment(fp, std::string("BEGIN Local output short connections"));
  print_spice_subckt_output_short_connections(fp, module_manager, module_id);
  print_spice_comment(fp, std::string("END Local output short connections"));
  fp << std::endl;
  for (ModuleId child_module : module_manager.child_modules(module_id)) {
    for (size_t instance : module_manager.child_module_instances(module_id, child_module)) {
      write_spice_instance_to_file(fp, module_manager, module_id, child_module, instance); 
      fp << std::endl;
    }
  }
  print_spice_subckt_end(fp, module_manager.module_name(module_id)); 
  fp << std::endl;
}
void write_spice_subckt_to_file ( std :: fstream & fp , const ModuleManager & module_manager , const ModuleId & module_id ) { VTR_ASSERT ( true == valid_file_stream ( fp ) ) ; VTR_ASSERT ( module_manager . valid_module_id ( module_id ) ) ; print_spice_subckt_definition ( fp , module_manager , module_id ) ; fp << std :: endl ; fp << std :: endl ; print_spice_comment ( fp , std :: string ( " " ) ) ; print_spice_subckt_local_short_connections ( fp , module_manager , module_id ) ; print_spice_comment ( fp , std :: string ( " " ) ) ; print_spice_comment ( fp , std :: string ( " " ) ) ; print_spice_subckt_output_short_connections ( fp , module_manager , module_id ) ; print_spice_comment ( fp , std :: string ( " " ) ) ; fp << std :: endl ; for ( ModuleId child_module : module_manager . child_modules ( module_id ) ) { for ( size_t instance : module_manager . child_module_instances ( module_id , child_module ) ) { write_spice_instance_to_file ( fp , module_manager , module_id , child_module , instance ) ; fp << std :: endl ; } } print_spice_subckt_end ( fp , module_manager . module_name ( module_id ) ) ; fp << std :: endl ; }
Write a SPICE sub-circuit to a file
 This is a key function, maybe most frequently called in our SPICE writer
 Note that file stream must be valid
Write a SPICE sub - circuit to a file This is a key function maybe most frequently called in our SPICE writer Note that file stream must be valid
/* Ensure we have a valid module_id */ /* Print module declaration */ /* Print an empty line as splitter */ /* Print an empty line as splitter */ /* Print local connection (from module inputs to output! */ /* Print an empty line as splitter */ /* Print instances */ /* Print an instance */ /* Print an empty line as splitter */ /* Print an end for the module */ /* Print an empty line as splitter */