29 size_t pos = port1.find_first_of(
':');
30 if (pos != std::string::npos) {
31 port2 = port1.substr(pos+1);
32 port1 = port1.substr(0, pos);
41 log(
" iopadmap [options] [selection]\n");
43 log(
"Map module inputs/outputs to PAD cells from a library. This pass\n");
44 log(
"can only map to very simple PAD cells. Use 'techmap' to further map\n");
45 log(
"the resulting cells to more sophisticated PAD cells.\n");
47 log(
" -inpad <celltype> <portname>[:<portname>]\n");
48 log(
" Map module input ports to the given cell type with\n");
49 log(
" the given port name. if a 2nd portname is given, the\n");
50 log(
" signal is passed through the pad call, using the 2nd\n");
51 log(
" portname as output.\n");
53 log(
" -outpad <celltype> <portname>[:<portname>]\n");
54 log(
" -inoutpad <celltype> <portname>[:<portname>]\n");
55 log(
" Similar to -inpad, but for output and inout ports.\n");
57 log(
" -widthparam <param_name>\n");
58 log(
" Use the specified parameter name to set the port width.\n");
60 log(
" -nameparam <param_name>\n");
61 log(
" Use the specified parameter to set the port name.\n");
64 log(
" create individual bit-wide buffers even for ports that\n");
65 log(
" are wider. (the default behavio is to create word-wide\n");
66 log(
" buffers use -widthparam to set the word size on the cell.)\n");
71 log_header(
"Executing IOPADMAP pass (mapping inputs/outputs to IO-PAD cells).\n");
73 std::string inpad_celltype, inpad_portname, inpad_portname2;
74 std::string outpad_celltype, outpad_portname, outpad_portname2;
75 std::string inoutpad_celltype, inoutpad_portname, inoutpad_portname2;
76 std::string widthparam, nameparam;
77 bool flag_bits =
false;
80 for (argidx = 1; argidx < args.size(); argidx++)
82 std::string arg = args[argidx];
83 if (arg ==
"-inpad" && argidx+2 < args.size()) {
84 inpad_celltype = args[++argidx];
85 inpad_portname = args[++argidx];
89 if (arg ==
"-outpad" && argidx+2 < args.size()) {
90 outpad_celltype = args[++argidx];
91 outpad_portname = args[++argidx];
95 if (arg ==
"-inoutpad" && argidx+2 < args.size()) {
96 inoutpad_celltype = args[++argidx];
97 inoutpad_portname = args[++argidx];
101 if (arg ==
"-widthparam" && argidx+1 < args.size()) {
102 widthparam = args[++argidx];
105 if (arg ==
"-nameparam" && argidx+1 < args.size()) {
106 nameparam = args[++argidx];
109 if (arg ==
"-bits") {
121 if (!design->
selected(module) || module->get_bool_attribute(
"\\blackbox"))
124 for (
auto &it2 : module->
wires_)
131 std::string celltype, portname, portname2;
134 if (inpad_celltype.empty()) {
138 celltype = inpad_celltype;
139 portname = inpad_portname;
140 portname2 = inpad_portname2;
143 if (outpad_celltype.empty()) {
147 celltype = outpad_celltype;
148 portname = outpad_portname;
149 portname2 = outpad_portname2;
152 if (inoutpad_celltype.empty()) {
156 celltype = inoutpad_celltype;
157 portname = inoutpad_portname;
158 portname2 = inoutpad_portname2;
162 if (!flag_bits && wire->
width != 1 && widthparam.empty()) {
170 if (!portname2.empty()) {
177 for (
int i = 0; i < wire->
width; i++)
181 if (!portname2.empty())
183 if (!widthparam.empty())
185 if (!nameparam.empty())
194 if (!portname2.empty())
196 if (!widthparam.empty())
198 if (!nameparam.empty())
bool selected(T1 *module) const
std::string stringf(const char *fmt,...)
RTLIL::Cell * addCell(RTLIL::IdString name, RTLIL::IdString type)
void log_header(const char *format,...)
std::map< RTLIL::IdString, RTLIL::Wire * > wires_
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
void swap_names(RTLIL::Wire *w1, RTLIL::Wire *w2)
std::map< RTLIL::IdString, RTLIL::Const > parameters
static std::string escape_id(std::string str)
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN void split_portname_pair(std::string &port1, std::string &port2)
#define PRIVATE_NAMESPACE_BEGIN
IopadmapPass IopadmapPass
RTLIL::Wire * addWire(RTLIL::IdString name, int width=1)
virtual void execute(std::vector< std::string > args, RTLIL::Design *design)
#define PRIVATE_NAMESPACE_END
static const char * id2cstr(const RTLIL::IdString &str)
#define USING_YOSYS_NAMESPACE
std::map< RTLIL::IdString, RTLIL::Module * > modules_
void log(const char *format,...)
void extra_args(std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true)