yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
rename.cc File Reference
#include "kernel/register.h"
#include "kernel/rtlil.h"
#include "kernel/log.h"
+ Include dependency graph for rename.cc:

Go to the source code of this file.

Data Structures

struct  RenamePass
 

Functions

USING_YOSYS_NAMESPACE static
PRIVATE_NAMESPACE_BEGIN void 
rename_in_module (RTLIL::Module *module, std::string from_name, std::string to_name)
 

Variables

RenamePass RenamePass
 

Function Documentation

USING_YOSYS_NAMESPACE static PRIVATE_NAMESPACE_BEGIN void rename_in_module ( RTLIL::Module module,
std::string  from_name,
std::string  to_name 
)
static

Definition at line 27 of file rename.cc.

28 {
29  from_name = RTLIL::escape_id(from_name);
30  to_name = RTLIL::escape_id(to_name);
31 
32  if (module->count_id(to_name))
33  log_cmd_error("There is already an object `%s' in module `%s'.\n", to_name.c_str(), module->name.c_str());
34 
35  for (auto &it : module->wires_)
36  if (it.first == from_name) {
37  log("Renaming wire %s to %s in module %s.\n", log_id(it.second), log_id(to_name), log_id(module));
38  module->rename(it.second, to_name);
39  if (it.second->port_id)
40  module->fixup_ports();
41  return;
42  }
43 
44  for (auto &it : module->cells_)
45  if (it.first == from_name) {
46  log("Renaming cell %s to %s in module %s.\n", log_id(it.second), log_id(to_name), log_id(module));
47  module->rename(it.second, to_name);
48  return;
49  }
50 
51  log_cmd_error("Object `%s' not found!\n", from_name.c_str());
52 }
const char * c_str() const
Definition: rtlil.h:178
std::map< RTLIL::IdString, RTLIL::Wire * > wires_
Definition: rtlil.h:595
static std::string escape_id(std::string str)
Definition: rtlil.h:251
void fixup_ports()
Definition: rtlil.cc:1312
RTLIL::IdString name
Definition: rtlil.h:599
void log_cmd_error(const char *format,...)
Definition: log.cc:211
virtual size_t count_id(RTLIL::IdString id)
Definition: rtlil.cc:472
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
Definition: rtlil.h:596
void log(const char *format,...)
Definition: log.cc:180
const char * log_id(RTLIL::IdString str)
Definition: log.cc:283
void rename(RTLIL::Wire *wire, RTLIL::IdString new_name)
Definition: rtlil.cc:1185

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation