|
| VerilogBackend () |
|
virtual void | help () |
|
virtual void | execute (std::ostream *&f, std::string filename, std::vector< std::string > args, RTLIL::Design *design) |
|
virtual void | run_register () |
|
virtual void | execute (std::vector< std::string > args, RTLIL::Design *design) YS_OVERRIDE YS_FINAL |
|
void | extra_args (std::ostream *&f, std::string &filename, std::vector< std::string > args, size_t argidx) |
|
void | extra_args (std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true) |
|
pre_post_exec_state_t | pre_execute () |
|
void | post_execute (pre_post_exec_state_t state) |
|
void | cmd_log_args (const std::vector< std::string > &args) |
|
void | cmd_error (const std::vector< std::string > &args, size_t argidx, std::string msg) |
|
|
static void | backend_call (RTLIL::Design *design, std::ostream *f, std::string filename, std::string command) |
|
static void | backend_call (RTLIL::Design *design, std::ostream *f, std::string filename, std::vector< std::string > args) |
|
static void | call (RTLIL::Design *design, std::string command) |
|
static void | call (RTLIL::Design *design, std::vector< std::string > args) |
|
static void | call_on_selection (RTLIL::Design *design, const RTLIL::Selection &selection, std::string command) |
|
static void | call_on_selection (RTLIL::Design *design, const RTLIL::Selection &selection, std::vector< std::string > args) |
|
static void | call_on_module (RTLIL::Design *design, RTLIL::Module *module, std::string command) |
|
static void | call_on_module (RTLIL::Design *design, RTLIL::Module *module, std::vector< std::string > args) |
|
static void | init_register () |
|
static void | done_register () |
|
Definition at line 1020 of file verilog_backend.cc.
VerilogBackend::VerilogBackend |
( |
| ) |
|
|
inline |
Definition at line 1021 of file verilog_backend.cc.
1021 :
Backend(
"verilog",
"write design to verilog file") { }
Backend(std::string name, std::string short_help="** document me **")
void Backend::backend_call |
( |
RTLIL::Design * |
design, |
|
|
std::ostream * |
f, |
|
|
std::string |
filename, |
|
|
std::string |
command |
|
) |
| |
|
staticinherited |
Definition at line 479 of file register.cc.
481 std::vector<std::string>
args;
482 char *s = strdup(command.c_str());
483 for (
char *p = strtok(s,
" \t\r\n"); p; p = strtok(
NULL,
" \t\r\n"))
static void backend_call(RTLIL::Design *design, std::ostream *f, std::string filename, std::string command)
void Backend::backend_call |
( |
RTLIL::Design * |
design, |
|
|
std::ostream * |
f, |
|
|
std::string |
filename, |
|
|
std::vector< std::string > |
args |
|
) |
| |
|
staticinherited |
Definition at line 489 of file register.cc.
491 if (
args.size() == 0)
502 }
else if (filename ==
"-") {
503 std::ostream *f_cout = &std::cout;
508 if (!filename.empty())
509 args.push_back(filename);
std::vector< RTLIL::Selection > selection_stack
void log_cmd_error(const char *format,...)
std::map< std::string, Backend * > backend_register
Definition at line 146 of file register.cc.
148 std::vector<std::string>
args;
150 std::string cmd_buf = command;
151 std::string tok =
next_token(cmd_buf,
" \t\r\n");
153 if (tok.empty() || tok[0] ==
'#')
157 cmd_buf = command.substr(command.find(
'!') + 1);
158 while (!cmd_buf.empty() && (cmd_buf.back() ==
' ' || cmd_buf.back() ==
'\t' ||
159 cmd_buf.back() ==
'\r' || cmd_buf.back() ==
'\n'))
160 cmd_buf.resize(cmd_buf.size()-1);
161 log_header(
"Shell command: %s\n", cmd_buf.c_str());
164 log_cmd_error(
"Shell command returned error code %d.\n", retCode);
168 while (!tok.empty()) {
171 if (tok.back() ==
';') {
172 int num_semikolon = 0;
173 while (!tok.empty() && tok.back() ==
';')
174 tok.resize(tok.size()-1), num_semikolon++;
179 if (num_semikolon == 2)
180 call(design,
"clean");
181 if (num_semikolon == 3)
182 call(design,
"clean -purge");
static std::string next_token(bool pass_newline=false)
void log_header(const char *format,...)
int run_command(const std::string &command, std::function< void(const std::string &)> process_line)
void log_cmd_error(const char *format,...)
static void call(RTLIL::Design *design, std::string command)
void Pass::call |
( |
RTLIL::Design * |
design, |
|
|
std::vector< std::string > |
args |
|
) |
| |
|
staticinherited |
Definition at line 191 of file register.cc.
193 if (
args.size() == 0 ||
args[0][0] ==
'#')
198 for (
size_t i = 0; i <
args.size(); i++)
199 log(
"%s%s", i ?
" " :
"",
args[i].c_str());
204 log_cmd_error(
"No such command: %s (type 'help' for a command overview)\n",
args[0].c_str());
std::vector< RTLIL::Selection > selection_stack
const char * create_prompt(RTLIL::Design *design, int recursion_counter)
void log_cmd_error(const char *format,...)
void log(const char *format,...)
std::map< std::string, Pass * > pass_register
Definition at line 240 of file register.cc.
std::vector< RTLIL::Selection > selection_stack
std::string selected_active_module
static void call(RTLIL::Design *design, std::string command)
Definition at line 253 of file register.cc.
std::vector< RTLIL::Selection > selection_stack
std::string selected_active_module
static void call(RTLIL::Design *design, std::string command)
Definition at line 216 of file register.cc.
std::vector< RTLIL::Selection > selection_stack
std::string selected_active_module
static void call(RTLIL::Design *design, std::string command)
Definition at line 228 of file register.cc.
std::vector< RTLIL::Selection > selection_stack
std::string selected_active_module
static void call(RTLIL::Design *design, std::string command)
void Pass::cmd_error |
( |
const std::vector< std::string > & |
args, |
|
|
size_t |
argidx, |
|
|
std::string |
msg |
|
) |
| |
|
inherited |
Definition at line 110 of file register.cc.
112 std::string command_text;
115 for (
size_t i = 0; i <
args.size(); i++) {
117 error_pos +=
args[i].size() + 1;
118 command_text = command_text + (command_text.empty() ?
"" :
" ") +
args[i];
121 log(
"\nSyntax error in command `%s':\n", command_text.c_str());
125 msg.c_str(), command_text.c_str(), error_pos,
"");
void log_cmd_error(const char *format,...)
void log(const char *format,...)
void Pass::cmd_log_args |
( |
const std::vector< std::string > & |
args | ) |
|
|
inherited |
Definition at line 100 of file register.cc.
102 if (
args.size() <= 1)
104 log(
"Full command line:");
105 for (
size_t i = 0; i <
args.size(); i++)
void log(const char *format,...)
void Pass::done_register |
( |
| ) |
|
|
staticinherited |
Definition at line 62 of file register.cc.
std::map< std::string, Frontend * > frontend_register
#define log_assert(_assert_expr_)
std::map< std::string, Pass * > pass_register
std::map< std::string, Backend * > backend_register
void Backend::execute |
( |
std::vector< std::string > |
args, |
|
|
RTLIL::Design * |
design |
|
) |
| |
|
virtualinherited |
Implements Pass.
Definition at line 429 of file register.cc.
431 std::ostream *f =
NULL;
virtual void execute(std::vector< std::string > args, RTLIL::Design *design) YS_OVERRIDE YS_FINAL
pre_post_exec_state_t pre_execute()
void post_execute(pre_post_exec_state_t state)
virtual void VerilogBackend::execute |
( |
std::ostream *& |
f, |
|
|
std::string |
filename, |
|
|
std::vector< std::string > |
args, |
|
|
RTLIL::Design * |
design |
|
) |
| |
|
inlinevirtual |
Implements Backend.
Definition at line 1055 of file verilog_backend.cc.
1064 bool blackboxes =
false;
1065 bool selected =
false;
1072 reg_ct.insert(
"$_DFF_N_");
1073 reg_ct.insert(
"$_DFF_P_");
1075 reg_ct.insert(
"$_DFF_NN0_");
1076 reg_ct.insert(
"$_DFF_NN1_");
1077 reg_ct.insert(
"$_DFF_NP0_");
1078 reg_ct.insert(
"$_DFF_NP1_");
1079 reg_ct.insert(
"$_DFF_PN0_");
1080 reg_ct.insert(
"$_DFF_PN1_");
1081 reg_ct.insert(
"$_DFF_PP0_");
1082 reg_ct.insert(
"$_DFF_PP1_");
1084 reg_ct.insert(
"$_DFFSR_NNN_");
1085 reg_ct.insert(
"$_DFFSR_NNP_");
1086 reg_ct.insert(
"$_DFFSR_NPN_");
1087 reg_ct.insert(
"$_DFFSR_NPP_");
1088 reg_ct.insert(
"$_DFFSR_PNN_");
1089 reg_ct.insert(
"$_DFFSR_PNP_");
1090 reg_ct.insert(
"$_DFFSR_PPN_");
1091 reg_ct.insert(
"$_DFFSR_PPP_");
1094 for (argidx = 1; argidx <
args.size(); argidx++) {
1095 std::string arg =
args[argidx];
1096 if (arg ==
"-norename") {
1100 if (arg ==
"-noattr") {
1104 if (arg ==
"-attr2comment") {
1108 if (arg ==
"-noexpr") {
1112 if (arg ==
"-blackboxes") {
1116 if (arg ==
"-selected") {
1125 for (
auto it = design->
modules_.begin(); it != design->
modules_.end(); it++) {
1126 if (it->second->get_bool_attribute(
"\\blackbox") != blackboxes)
1133 log(
"Dumping module `%s'.\n", it->first.c_str());
const char * yosys_version_str
std::string stringf(const char *fmt,...)
bool selected_module(RTLIL::IdString mod_name) const
void log_header(const char *format,...)
void dump_module(std::ostream &f, std::string indent, RTLIL::Module *module)
void extra_args(std::ostream *&f, std::string &filename, std::vector< std::string > args, size_t argidx)
bool selected_whole_module(RTLIL::IdString mod_name) const
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN bool attr2comment
static const char * id2cstr(const RTLIL::IdString &str)
void log_cmd_error(const char *format,...)
std::map< RTLIL::IdString, RTLIL::Module * > modules_
std::set< RTLIL::IdString > reg_ct
void log(const char *format,...)
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN bool norename
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN bool noexpr
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN bool noattr
void Pass::extra_args |
( |
std::vector< std::string > |
args, |
|
|
size_t |
argidx, |
|
|
RTLIL::Design * |
design, |
|
|
bool |
select = true |
|
) |
| |
|
inherited |
Definition at line 128 of file register.cc.
130 for (; argidx <
args.size(); argidx++)
132 std::string arg =
args[argidx];
134 if (arg.substr(0, 1) ==
"-")
135 cmd_error(
args, argidx,
"Unknown option or option in arguments.");
void cmd_error(const std::vector< std::string > &args, size_t argidx, std::string msg)
void handle_extra_select_args(Pass *pass, std::vector< std::string > args, size_t argidx, size_t args_size, RTLIL::Design *design)
void Backend::extra_args |
( |
std::ostream *& |
f, |
|
|
std::string & |
filename, |
|
|
std::vector< std::string > |
args, |
|
|
size_t |
argidx |
|
) |
| |
|
inherited |
Definition at line 439 of file register.cc.
441 bool called_with_fp = f !=
NULL;
443 for (; argidx <
args.size(); argidx++)
445 std::string arg =
args[argidx];
447 if (arg.substr(0, 1) ==
"-" && arg !=
"-")
448 cmd_error(
args, argidx,
"Unknown option or option in arguments.");
450 cmd_error(
args, argidx,
"Extra filename argument in direct file mode.");
453 filename =
"<stdout>";
459 std::ofstream *ff =
new std::ofstream;
460 ff->open(filename.c_str(), std::ofstream::trunc);
463 log_cmd_error(
"Can't open output file `%s' for writing: %s\n", filename.c_str(), strerror(errno));
469 args.push_back(filename);
474 filename =
"<stdout>";
void cmd_error(const std::vector< std::string > &args, size_t argidx, std::string msg)
void log_cmd_error(const char *format,...)
virtual void VerilogBackend::help |
( |
| ) |
|
|
inlinevirtual |
Reimplemented from Pass.
Definition at line 1022 of file verilog_backend.cc.
1026 log(
" write_verilog [options] [filename]\n");
1028 log(
"Write the current design to a verilog file.\n");
1030 log(
" -norename\n");
1031 log(
" without this option all internal object names (the ones with a dollar\n");
1032 log(
" instead of a backslash prefix) are changed to short names in the\n");
1033 log(
" format '_<number>_'.\n");
1036 log(
" with this option no attributes are included in the output\n");
1038 log(
" -attr2comment\n");
1039 log(
" with this option attributes are included as comments in the output\n");
1042 log(
" without this option all internal cells are converted to verilog\n");
1043 log(
" expressions.\n");
1045 log(
" -blackboxes\n");
1046 log(
" usually modules with the 'blackbox' attribute are ignored. with\n");
1047 log(
" this option set only the modules with the 'blackbox' attribute\n");
1048 log(
" are written to the output file.\n");
1050 log(
" -selected\n");
1051 log(
" only write selected modules. modules must be selected entirely or\n");
1052 log(
" not at all.\n");
void log(const char *format,...)
void Pass::init_register |
( |
| ) |
|
|
staticinherited |
Definition at line 54 of file register.cc.
virtual void run_register()
Definition at line 74 of file register.cc.
76 pre_post_exec_state_t state;
void Backend::run_register |
( |
| ) |
|
|
virtualinherited |
Reimplemented from Pass.
Definition at line 416 of file register.cc.
#define log_assert(_assert_expr_)
std::map< std::string, Pass * > pass_register
std::map< std::string, Backend * > backend_register
std::string Backend::backend_name |
|
inherited |
Pass* Pass::next_queued_pass |
|
inherited |
std::string Pass::pass_name |
|
inherited |
std::string Pass::short_help |
|
inherited |
The documentation for this struct was generated from the following file: