65 log(
" setundef [options] [selection]\n");
67 log(
"This command replaced undef (x) constants with defined (0/1) constants.\n");
70 log(
" also set undriven nets to constant values\n");
73 log(
" replace with bits cleared (0)\n");
76 log(
" replace with bits set (1)\n");
78 log(
" -random <seed>\n");
79 log(
" replace with random bits using the specified integer als seed\n");
80 log(
" value for the random number generator.\n");
85 bool got_value =
false;
86 bool undriven_mode =
false;
90 for (argidx = 1; argidx < args.size(); argidx++)
92 if (args[argidx] ==
"-undriven") {
96 if (args[argidx] ==
"-zero") {
101 if (args[argidx] ==
"-one") {
106 if (args[argidx] ==
"-random" && !got_value && argidx+1 < args.size()) {
110 for (
int i = 0; i < 10; i++)
119 log_cmd_error(
"One of the options -zero, -one, or -random <seed> must be specified.\n");
121 for (
auto &mod_it : design->
modules_)
130 log_error(
"The 'setundef' command can't operate in -undriven mode on modules with processes. Run 'proc' first.\n");
135 for (
auto &it : module->
wires_)
136 if (!it.second->port_input)
137 undriven_signals.
add(sigmap(it.second));
140 for (
auto &it : module->
cells_)
141 for (
auto &conn : it.second->connections())
143 undriven_signals.
del(sigmap(conn.second));
146 for (
auto &c : sig.
chunks()) {
148 for (
int i = 0; i < c.width; i++)
bool selected(T1 *module) const
std::map< RTLIL::IdString, RTLIL::Wire * > wires_
void rewrite_sigspecs(T functor)
virtual void execute(std::vector< std::string > args, RTLIL::Design *design)
void log_error(const char *format,...)
bool cell_known(RTLIL::IdString type)
void connect(const RTLIL::SigSig &conn)
SetundefPass SetundefPass
#define PRIVATE_NAMESPACE_BEGIN
bool cell_output(RTLIL::IdString type, RTLIL::IdString port)
#define log_assert(_assert_expr_)
RTLIL::SigSpec export_all()
#define PRIVATE_NAMESPACE_END
void log_cmd_error(const char *format,...)
std::map< RTLIL::IdString, RTLIL::Process * > processes
void add(RTLIL::SigSpec sig)
#define USING_YOSYS_NAMESPACE
std::map< RTLIL::IdString, RTLIL::Module * > modules_
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
void log(const char *format,...)
void append(const RTLIL::SigSpec &signal)
void del(RTLIL::SigSpec sig)
void extra_args(std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true)
void operator()(RTLIL::SigSpec &sig)
std::pair< SigSpec, SigSpec > SigSig
const std::vector< RTLIL::SigChunk > & chunks() const