93 bool flag_nounset =
false, flag_nomap =
false;
94 std::string set_lhs, set_rhs, unset_expr;
95 std::string port_cell, port_port, port_expr;
98 for (argidx = 1; argidx <
args.size(); argidx++)
100 std::string arg =
args[argidx];
101 if (arg ==
"-nounset") {
105 if (arg ==
"-nomap") {
109 if (arg ==
"-set" && argidx+2 <
args.size()) {
110 set_lhs =
args[++argidx];
111 set_rhs =
args[++argidx];
114 if (arg ==
"-unset" && argidx+1 <
args.size()) {
115 unset_expr =
args[++argidx];
118 if (arg ==
"-port" && argidx+3 <
args.size()) {
119 port_cell =
args[++argidx];
120 port_port =
args[++argidx];
121 port_expr =
args[++argidx];
130 std::vector<RTLIL::SigBit> lhs = it.first.to_sigbit_vector();
131 std::vector<RTLIL::SigBit> rhs = it.first.to_sigbit_vector();
132 for (
size_t i = 0; i < lhs.size(); i++)
133 if (rhs[i].wire !=
NULL)
134 sigmap.
add(lhs[i], rhs[i]);
137 if (!set_lhs.empty())
139 if (!unset_expr.empty() || !port_cell.empty())
140 log_cmd_error(
"Cant use -set together with -unset and/or -port.\n");
144 log_cmd_error(
"Failed to parse set lhs expression `%s'.\n", set_lhs.c_str());
146 log_cmd_error(
"Failed to parse set rhs expression `%s'.\n", set_rhs.c_str());
148 sigmap.
apply(sig_lhs);
149 sigmap.
apply(sig_rhs);
157 if (!unset_expr.empty())
159 if (!port_cell.empty() || flag_nounset)
160 log_cmd_error(
"Cant use -unset together with -port and/or -nounset.\n");
164 log_cmd_error(
"Failed to parse unset expression `%s'.\n", unset_expr.c_str());
170 if (!port_cell.empty())
180 log_cmd_error(
"Failed to parse port expression `%s'.\n", port_expr.c_str());
bool selected(T1 *module) const
static bool parse_sel(RTLIL::SigSpec &sig, RTLIL::Design *design, RTLIL::Module *module, std::string str)
const std::vector< RTLIL::SigSig > & connections() const
USING_YOSYS_NAMESPACE static PRIVATE_NAMESPACE_BEGIN void unset_drivers(RTLIL::Design *design, RTLIL::Module *module, SigMap &sigmap, RTLIL::SigSpec &sig)
void apply(RTLIL::SigBit &bit) const
static std::string escape_id(std::string str)
void connect(const RTLIL::SigSig &conn)
static const char * id2cstr(const RTLIL::IdString &str)
void log_cmd_error(const char *format,...)
std::map< RTLIL::IdString, RTLIL::Process * > processes
std::map< RTLIL::IdString, RTLIL::Module * > modules_
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
static bool parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str)
void add(RTLIL::SigSpec from, RTLIL::SigSpec to)
std::pair< SigSpec, SigSpec > SigSig