yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
yosys.cc File Reference
#include "kernel/yosys.h"
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
#include <errno.h>
+ Include dependency graph for yosys.cc:

Go to the source code of this file.

Data Structures

struct  ShellPass
 
struct  ScriptPass
 

Functions

std::string stringf (const char *fmt,...)
 
std::string vstringf (const char *fmt, va_list ap)
 
int readsome (std::istream &f, char *s, int n)
 
std::string next_token (std::string &text, const char *sep)
 
bool patmatch (const char *pattern, const char *string)
 
int run_command (const std::string &command, std::function< void(const std::string &)> process_line)
 
std::string make_temp_file (std::string template_str)
 
std::string make_temp_dir (std::string template_str)
 
bool check_file_exists (std::string filename, bool is_exec)
 
void remove_directory (std::string dirname)
 
int GetSize (RTLIL::Wire *wire)
 
void yosys_setup ()
 
void yosys_shutdown ()
 
RTLIL::IdString new_id (std::string file, int line, std::string func)
 
RTLIL::Designyosys_get_design ()
 
const char * create_prompt (RTLIL::Design *design, int recursion_counter)
 
std::string proc_share_dirname ()
 
bool fgetline (FILE *f, std::string &buffer)
 
static void handle_label (std::string &command, bool &from_to_active, const std::string &run_from, const std::string &run_to)
 
void run_frontend (std::string filename, std::string command, RTLIL::Design *design, std::string *backend_command, std::string *from_to_label)
 
void run_pass (std::string command, RTLIL::Design *design)
 
void run_backend (std::string filename, std::string command, RTLIL::Design *design)
 
void shell (RTLIL::Design *design)
 

Variables

YOSYS_NAMESPACE_BEGIN int autoidx = 1
 
RTLIL::Designyosys_design = NULL
 
ShellPass ShellPass
 
ScriptPass ScriptPass
 

Function Documentation

bool check_file_exists ( std::string  filename,
bool  is_exec 
)

Definition at line 302 of file yosys.cc.

303 {
304  return access(filename.c_str(), is_exec ? X_OK : F_OK) == 0;
305 }

+ Here is the caller graph for this function:

const char* create_prompt ( RTLIL::Design design,
int  recursion_counter 
)

Definition at line 400 of file yosys.cc.

401 {
402  static char buffer[100];
403  std::string str = "\n";
404  if (recursion_counter > 1)
405  str += stringf("(%d) ", recursion_counter);
406  str += "yosys";
407  if (!design->selected_active_module.empty())
408  str += stringf(" [%s]", RTLIL::unescape_id(design->selected_active_module).c_str());
409  if (!design->selection_stack.empty() && !design->selection_stack.back().full_selection) {
410  if (design->selected_active_module.empty())
411  str += "*";
412  else if (design->selection_stack.back().selected_modules.size() != 1 || design->selection_stack.back().selected_members.size() != 0 ||
413  design->selection_stack.back().selected_modules.count(design->selected_active_module) == 0)
414  str += "*";
415  }
416  snprintf(buffer, 100, "%s> ", str.c_str());
417  return buffer;
418 }
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
std::string stringf(const char *fmt,...)
Definition: yosys.cc:58
static std::string unescape_id(std::string str)
Definition: rtlil.h:257
std::string selected_active_module
Definition: rtlil.h:511

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fgetline ( FILE *  f,
std::string &  buffer 
)

Definition at line 564 of file yosys.cc.

565 {
566  buffer = "";
567  char block[4096];
568  while (1) {
569  if (fgets(block, 4096, f) == NULL)
570  return false;
571  buffer += block;
572  if (buffer.size() > 0 && (buffer[buffer.size()-1] == '\n' || buffer[buffer.size()-1] == '\r')) {
573  while (buffer.size() > 0 && (buffer[buffer.size()-1] == '\n' || buffer[buffer.size()-1] == '\r'))
574  buffer.resize(buffer.size()-1);
575  return true;
576  }
577  }
578 }
#define NULL

+ Here is the caller graph for this function:

int GetSize ( RTLIL::Wire wire)

Definition at line 334 of file yosys.cc.

335 {
336  return wire->width;
337 }
int width
Definition: rtlil.h:826
static void handle_label ( std::string &  command,
bool &  from_to_active,
const std::string &  run_from,
const std::string &  run_to 
)
static

Definition at line 580 of file yosys.cc.

581 {
582  int pos = 0;
583  std::string label;
584 
585  while (pos < GetSize(command) && (command[pos] == ' ' || command[pos] == '\t'))
586  pos++;
587 
588  while (pos < GetSize(command) && command[pos] != ' ' && command[pos] != '\t' && command[pos] != '\r' && command[pos] != '\n')
589  label += command[pos++];
590 
591  if (label.back() == ':' && GetSize(label) > 1)
592  {
593  label = label.substr(0, GetSize(label)-1);
594  command = command.substr(pos);
595 
596  if (label == run_from)
597  from_to_active = true;
598  else if (label == run_to || (run_from == run_to && !run_from.empty()))
599  from_to_active = false;
600  }
601 }
int GetSize(RTLIL::Wire *wire)
Definition: yosys.cc:334

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string make_temp_dir ( std::string  template_str)

Definition at line 273 of file yosys.cc.

274 {
275 #ifdef _WIN32
276  template_str = make_temp_file(template_str);
277  mkdir(template_str.c_str());
278  return template_str;
279 #else
280  size_t pos = template_str.rfind("XXXXXX");
281  log_assert(pos != std::string::npos);
282 
283  int suffixlen = GetSize(template_str) - pos - 6;
284  log_assert(suffixlen == 0);
285 
286  char *p = strdup(template_str.c_str());
287  p = mkdtemp(p);
288  log_assert(p != NULL);
289  template_str = p;
290  free(p);
291 
292  return template_str;
293 #endif
294 }
void free(void *)
std::string make_temp_file(std::string template_str)
Definition: yosys.cc:224
int GetSize(RTLIL::Wire *wire)
Definition: yosys.cc:334
#define log_assert(_assert_expr_)
Definition: log.h:85
#define NULL

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string make_temp_file ( std::string  template_str)

Definition at line 224 of file yosys.cc.

225 {
226 #ifdef _WIN32
227  if (template_str.rfind("/tmp/", 0) == 0) {
228 # ifdef __MINGW32__
229  char longpath[MAX_PATH + 1];
230  char shortpath[MAX_PATH + 1];
231 # else
232  WCHAR longpath[MAX_PATH + 1];
233  TCHAR shortpath[MAX_PATH + 1];
234 # endif
235  if (!GetTempPath(MAX_PATH+1, longpath))
236  log_error("GetTempPath() failed.\n");
237  if (!GetShortPathName(longpath, shortpath, MAX_PATH + 1))
238  log_error("GetShortPathName() failed.\n");
239  std::string path;
240  for (int i = 0; shortpath[i]; i++)
241  path += char(shortpath[i]);
242  template_str = stringf("%s\\%s", path.c_str(), template_str.c_str() + 5);
243  }
244 
245  size_t pos = template_str.rfind("XXXXXX");
246  log_assert(pos != std::string::npos);
247 
248  while (1) {
249  for (int i = 0; i < 6; i++) {
250  static std::string y = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
251  static uint32_t x = 314159265 ^ uint32_t(time(NULL));
252  x ^= x << 13, x ^= x >> 17, x ^= x << 5;
253  template_str[pos+i] = y[x % y.size()];
254  }
255  if (_access(template_str.c_str(), 0) != 0)
256  break;
257  }
258 #else
259  size_t pos = template_str.rfind("XXXXXX");
260  log_assert(pos != std::string::npos);
261 
262  int suffixlen = GetSize(template_str) - pos - 6;
263 
264  char *p = strdup(template_str.c_str());
265  close(mkstemps(p, suffixlen));
266  template_str = p;
267  free(p);
268 #endif
269 
270  return template_str;
271 }
std::string stringf(const char *fmt,...)
Definition: yosys.cc:58
void free(void *)
void log_error(const char *format,...)
Definition: log.cc:204
int GetSize(RTLIL::Wire *wire)
Definition: yosys.cc:334
#define log_assert(_assert_expr_)
Definition: log.h:85
#define NULL

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RTLIL::IdString new_id ( std::string  file,
int  line,
std::string  func 
)

Definition at line 378 of file yosys.cc.

379 {
380 #ifdef _WIN32
381  size_t pos = file.find_last_of("/\\");
382 #else
383  size_t pos = file.find_last_of('/');
384 #endif
385  if (pos != std::string::npos)
386  file = file.substr(pos+1);
387 
388  pos = func.find_last_of(':');
389  if (pos != std::string::npos)
390  func = func.substr(pos+1);
391 
392  return stringf("$auto$%s:%d:%s$%d", file.c_str(), line, func.c_str(), autoidx++);
393 }
std::string stringf(const char *fmt,...)
Definition: yosys.cc:58
YOSYS_NAMESPACE_BEGIN int autoidx
Definition: yosys.cc:51

+ Here is the call graph for this function:

std::string next_token ( std::string &  text,
const char *  sep 
)

Definition at line 116 of file yosys.cc.

117 {
118  size_t pos_begin = text.find_first_not_of(sep);
119 
120  if (pos_begin == std::string::npos)
121  pos_begin = text.size();
122 
123  size_t pos_end = text.find_first_of(sep, pos_begin);
124 
125  if (pos_end == std::string::npos)
126  pos_end = text.size();
127 
128  std::string token = text.substr(pos_begin, pos_end-pos_begin);
129  text = text.substr(pos_end);
130  return token;
131 }
bool patmatch ( const char *  pattern,
const char *  string 
)

Definition at line 144 of file yosys.cc.

145 {
146  if (*pattern == 0)
147  return *string == 0;
148 
149  if (*pattern == '\\') {
150  if (pattern[1] == string[0] && patmatch(pattern+2, string+1))
151  return true;
152  }
153 
154  if (*pattern == '?') {
155  if (*string == 0)
156  return false;
157  return patmatch(pattern+1, string+1);
158  }
159 
160  if (*pattern == '*') {
161  while (*string) {
162  if (patmatch(pattern+1, string++))
163  return true;
164  }
165  return pattern[1] == 0;
166  }
167 
168  if (*pattern == '[') {
169  bool found_match = false;
170  bool inverted_list = pattern[1] == '!';
171  const char *p = pattern + (inverted_list ? 1 : 0);
172 
173  while (*++p) {
174  if (*p == ']') {
175  if (found_match != inverted_list && patmatch(p+1, string+1))
176  return true;
177  break;
178  }
179 
180  if (*p == '\\') {
181  if (*++p == *string)
182  found_match = true;
183  } else
184  if (*p == *string)
185  found_match = true;
186  }
187  }
188 
189  if (*pattern == *string)
190  return patmatch(pattern+1, string+1);
191 
192  return false;
193 }
bool patmatch(const char *pattern, const char *string)
Definition: yosys.cc:144

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string proc_share_dirname ( )

Definition at line 543 of file yosys.cc.

544 {
545  std::string proc_self_path = proc_self_dirname();
546 #ifdef _WIN32
547  std::string proc_share_path = proc_self_path + "share\\";
548  if (check_file_exists(proc_share_path, true))
549  return proc_share_path;
550  proc_share_path = proc_self_path + "..\\share\\";
551  if (check_file_exists(proc_share_path, true))
552  return proc_share_path;
553 #else
554  std::string proc_share_path = proc_self_path + "share/";
555  if (check_file_exists(proc_share_path, true))
556  return proc_share_path;
557  proc_share_path = proc_self_path + "../share/yosys/";
558  if (check_file_exists(proc_share_path, true))
559  return proc_share_path;
560 #endif
561  log_error("proc_share_dirname: unable to determine share/ directory!\n");
562 }
void log_error(const char *format,...)
Definition: log.cc:204
std::string proc_self_dirname()
bool check_file_exists(std::string filename, bool is_exec)
Definition: yosys.cc:302

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int readsome ( std::istream &  f,
char *  s,
int  n 
)

Definition at line 100 of file yosys.cc.

101 {
102  int rc = f.readsome(s, n);
103 
104  // f.readsome() sometimes returns 0 on a non-empty stream..
105  if (rc == 0) {
106  int c = f.get();
107  if (c != EOF) {
108  *s = c;
109  rc = 1;
110  }
111  }
112 
113  return rc;
114 }
tuple n
Definition: fsm/generate.py:59

+ Here is the caller graph for this function:

void remove_directory ( std::string  dirname)

Definition at line 308 of file yosys.cc.

309 {
310 #ifdef _WIN32
311  run_command(stringf("rmdir /s /q \"%s\"", dirname.c_str()));
312 #else
313  struct stat stbuf;
314  struct dirent **namelist;
315  int n = scandir(dirname.c_str(), &namelist, nullptr, alphasort);
316  log_assert(n >= 0);
317  for (int i = 0; i < n; i++) {
318  if (strcmp(namelist[i]->d_name, ".") && strcmp(namelist[i]->d_name, "..")) {
319  std::string buffer = stringf("%s/%s", dirname.c_str(), namelist[i]->d_name);
320  if (!stat(buffer.c_str(), &stbuf) && S_ISREG(stbuf.st_mode)) {
321  log("Removing `%s'.\n", buffer.c_str());
322  remove(buffer.c_str());
323  } else
324  remove_directory(buffer);
325  }
326  free(namelist[i]);
327  }
328  free(namelist);
329  log("Removing `%s'.\n", dirname.c_str());
330  rmdir(dirname.c_str());
331 #endif
332 }
std::string stringf(const char *fmt,...)
Definition: yosys.cc:58
void remove_directory(std::string dirname)
Definition: yosys.cc:308
void free(void *)
tuple n
Definition: fsm/generate.py:59
int run_command(const std::string &command, std::function< void(const std::string &)> process_line)
Definition: yosys.cc:195
#define log_assert(_assert_expr_)
Definition: log.h:85
void log(const char *format,...)
Definition: log.cc:180

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void run_backend ( std::string  filename,
std::string  command,
RTLIL::Design design 
)

Definition at line 703 of file yosys.cc.

704 {
705  if (command == "auto") {
706  if (filename.size() > 2 && filename.substr(filename.size()-2) == ".v")
707  command = "verilog";
708  else if (filename.size() > 3 && filename.substr(filename.size()-3) == ".il")
709  command = "ilang";
710  else if (filename.size() > 5 && filename.substr(filename.size()-5) == ".blif")
711  command = "blif";
712  else if (filename == "-")
713  command = "ilang";
714  else if (filename.empty())
715  return;
716  else
717  log_error("Can't guess backend for output file `%s' (missing -b option)!\n", filename.c_str());
718  }
719 
720  if (filename.empty())
721  filename = "-";
722 
723  if (filename == "-") {
724  log("\n-- Writing to stdout using backend `%s' --\n", command.c_str());
725  } else {
726  log("\n-- Writing to `%s' using backend `%s' --\n", filename.c_str(), command.c_str());
727  }
728 
729  Backend::backend_call(design, NULL, filename, command);
730 }
void log_error(const char *format,...)
Definition: log.cc:204
static void backend_call(RTLIL::Design *design, std::ostream *f, std::string filename, std::string command)
Definition: register.cc:479
#define NULL
void log(const char *format,...)
Definition: log.cc:180

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int run_command ( const std::string &  command,
std::function< void(const std::string &)>  process_line 
)

Definition at line 195 of file yosys.cc.

196 {
197  if (!process_line)
198  return system(command.c_str());
199 
200  FILE *f = popen(command.c_str(), "r");
201  if (f == nullptr)
202  return -1;
203 
204  std::string line;
205  char logbuf[128];
206  while (fgets(logbuf, 128, f) != NULL) {
207  line += logbuf;
208  if (!line.empty() && line.back() == '\n')
209  process_line(line), line.clear();
210  }
211  if (!line.empty())
212  process_line(line);
213 
214  int ret = pclose(f);
215  if (ret < 0)
216  return -1;
217 #ifdef _WIN32
218  return ret;
219 #else
220  return WEXITSTATUS(ret);
221 #endif
222 }
#define NULL

+ Here is the caller graph for this function:

void run_frontend ( std::string  filename,
std::string  command,
RTLIL::Design design,
std::string *  backend_command,
std::string *  from_to_label 
)

Definition at line 603 of file yosys.cc.

604 {
605  if (command == "auto") {
606  if (filename.size() > 2 && filename.substr(filename.size()-2) == ".v")
607  command = "verilog";
608  else if (filename.size() > 2 && filename.substr(filename.size()-3) == ".sv")
609  command = "verilog -sv";
610  else if (filename.size() > 3 && filename.substr(filename.size()-3) == ".il")
611  command = "ilang";
612  else if (filename.size() > 3 && filename.substr(filename.size()-3) == ".ys")
613  command = "script";
614  else if (filename == "-")
615  command = "script";
616  else
617  log_error("Can't guess frontend for input file `%s' (missing -f option)!\n", filename.c_str());
618  }
619 
620  if (command == "script")
621  {
622  std::string run_from, run_to;
623  bool from_to_active = true;
624 
625  if (from_to_label != NULL) {
626  size_t pos = from_to_label->find(':');
627  if (pos == std::string::npos) {
628  run_from = *from_to_label;
629  run_to = *from_to_label;
630  } else {
631  run_from = from_to_label->substr(0, pos);
632  run_to = from_to_label->substr(pos+1);
633  }
634  from_to_active = run_from.empty();
635  }
636 
637  log("\n-- Executing script file `%s' --\n", filename.c_str());
638 
639  FILE *f = stdin;
640 
641  if (filename != "-")
642  f = fopen(filename.c_str(), "r");
643 
644  if (f == NULL)
645  log_error("Can't open script file `%s' for reading: %s\n", filename.c_str(), strerror(errno));
646 
647  FILE *backup_script_file = Frontend::current_script_file;
649 
650  try {
651  std::string command;
652  while (fgetline(f, command)) {
653  while (!command.empty() && command[command.size()-1] == '\\') {
654  std::string next_line;
655  if (!fgetline(f, next_line))
656  break;
657  command.resize(command.size()-1);
658  command += next_line;
659  }
660  handle_label(command, from_to_active, run_from, run_to);
661  if (from_to_active)
662  Pass::call(design, command);
663  }
664 
665  if (!command.empty()) {
666  handle_label(command, from_to_active, run_from, run_to);
667  if (from_to_active)
668  Pass::call(design, command);
669  }
670  }
671  catch (log_cmd_error_exception) {
672  Frontend::current_script_file = backup_script_file;
673  throw log_cmd_error_exception();
674  }
675 
676  Frontend::current_script_file = backup_script_file;
677 
678  if (filename != "-")
679  fclose(f);
680 
681  if (backend_command != NULL && *backend_command == "auto")
682  *backend_command = "";
683 
684  return;
685  }
686 
687  if (filename == "-") {
688  log("\n-- Parsing stdin using frontend `%s' --\n", command.c_str());
689  } else {
690  log("\n-- Parsing `%s' using frontend `%s' --\n", filename.c_str(), command.c_str());
691  }
692 
693  Frontend::frontend_call(design, NULL, filename, command);
694 }
static void handle_label(std::string &command, bool &from_to_active, const std::string &run_from, const std::string &run_to)
Definition: yosys.cc:580
static void frontend_call(RTLIL::Design *design, std::istream *f, std::string filename, std::string command)
Definition: register.cc:375
void log_error(const char *format,...)
Definition: log.cc:204
static FILE * current_script_file
Definition: register.h:69
#define NULL
void log(const char *format,...)
Definition: log.cc:180
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146
bool fgetline(FILE *f, std::string &buffer)
Definition: yosys.cc:564

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void run_pass ( std::string  command,
RTLIL::Design design 
)

Definition at line 696 of file yosys.cc.

697 {
698  log("\n-- Running pass `%s' --\n", command.c_str());
699 
700  Pass::call(design, command);
701 }
void log(const char *format,...)
Definition: log.cc:180
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void shell ( RTLIL::Design design)

Definition at line 812 of file yosys.cc.

813 {
814  static int recursion_counter = 0;
815 
816  recursion_counter++;
817  log_cmd_error_throw = true;
818 
819 #ifdef YOSYS_ENABLE_READLINE
820  rl_readline_name = "yosys";
821  rl_attempted_completion_function = readline_completion;
822  rl_basic_word_break_characters = " \t\n";
823 #endif
824 
825  char *command = NULL;
826 #ifdef YOSYS_ENABLE_READLINE
827  while ((command = readline(create_prompt(design, recursion_counter))) != NULL)
828  {
829 #else
830  char command_buffer[4096];
831  while (1)
832  {
833  fputs(create_prompt(design, recursion_counter), stdout);
834  fflush(stdout);
835  if ((command = fgets(command_buffer, 4096, stdin)) == NULL)
836  break;
837 #endif
838  if (command[strspn(command, " \t\r\n")] == 0)
839  continue;
840 #ifdef YOSYS_ENABLE_READLINE
841  add_history(command);
842 #endif
843 
844  char *p = command + strspn(command, " \t\r\n");
845  if (!strncmp(p, "exit", 4)) {
846  p += 4;
847  p += strspn(p, " \t\r\n");
848  if (*p == 0)
849  break;
850  }
851 
852  try {
853  log_assert(design->selection_stack.size() == 1);
854  Pass::call(design, command);
855  } catch (log_cmd_error_exception) {
856  while (design->selection_stack.size() > 1)
857  design->selection_stack.pop_back();
858  log_reset_stack();
859  }
860  }
861  if (command == NULL)
862  printf("exit\n");
863 
864  recursion_counter--;
865  log_cmd_error_throw = false;
866 }
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
const char * create_prompt(RTLIL::Design *design, int recursion_counter)
Definition: yosys.cc:400
#define log_assert(_assert_expr_)
Definition: log.h:85
bool log_cmd_error_throw
Definition: log.cc:43
void log_reset_stack()
Definition: log.cc:246
#define NULL
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string stringf ( const char *  fmt,
  ... 
)

Definition at line 58 of file yosys.cc.

59 {
60  std::string string;
61  va_list ap;
62 
63  va_start(ap, fmt);
64  string = vstringf(fmt, ap);
65  va_end(ap);
66 
67  return string;
68 }
std::string vstringf(const char *fmt, va_list ap)
Definition: yosys.cc:70

+ Here is the call graph for this function:

std::string vstringf ( const char *  fmt,
va_list  ap 
)

Definition at line 70 of file yosys.cc.

71 {
72  std::string string;
73  char *str = NULL;
74 
75 #ifdef _WIN32
76  int sz = 64, rc;
77  while (1) {
78  va_list apc;
79  va_copy(apc, ap);
80  str = (char*)realloc(str, sz);
81  rc = vsnprintf(str, sz, fmt, apc);
82  va_end(apc);
83  if (rc >= 0 && rc < sz)
84  break;
85  sz *= 2;
86  }
87 #else
88  if (vasprintf(&str, fmt, ap) < 0)
89  str = NULL;
90 #endif
91 
92  if (str != NULL) {
93  string = str;
94  free(str);
95  }
96 
97  return string;
98 }
void free(void *)
#define NULL

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RTLIL::Design* yosys_get_design ( )

Definition at line 395 of file yosys.cc.

396 {
397  return yosys_design;
398 }
RTLIL::Design * yosys_design
Definition: yosys.cc:52
void yosys_setup ( )

Definition at line 339 of file yosys.cc.

340 {
343  log_push();
344 }
RTLIL::Design * yosys_design
Definition: yosys.cc:52
void log_push()
Definition: log.cc:232
static void init_register()
Definition: register.cc:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void yosys_shutdown ( )

Definition at line 346 of file yosys.cc.

347 {
348  log_pop();
349 
350  delete yosys_design;
351  yosys_design = NULL;
352 
353  for (auto f : log_files)
354  if (f != stderr)
355  fclose(f);
356  log_errfile = NULL;
357  log_files.clear();
358 
360 
361 #ifdef YOSYS_ENABLE_TCL
362  if (yosys_tcl_interp != NULL) {
363  Tcl_DeleteInterp(yosys_tcl_interp);
364  Tcl_Finalize();
365  yosys_tcl_interp = NULL;
366  }
367 #endif
368 
369 #ifdef YOSYS_ENABLE_PLUGINS
370  for (auto &it : loaded_plugins)
371  dlclose(it.second);
372 
373  loaded_plugins.clear();
374  loaded_plugin_aliases.clear();
375 #endif
376 }
RTLIL::Design * yosys_design
Definition: yosys.cc:52
FILE * log_errfile
Definition: log.cc:39
void log_pop()
Definition: log.cc:237
YOSYS_NAMESPACE_BEGIN std::vector< FILE * > log_files
Definition: log.cc:37
static void done_register()
Definition: register.cc:62
std::map< std::string, std::string > loaded_plugin_aliases
Definition: plugin.cc:29
#define NULL
std::map< std::string, void * > loaded_plugins
Definition: plugin.cc:28

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

YOSYS_NAMESPACE_BEGIN int autoidx = 1

Definition at line 51 of file yosys.cc.

RTLIL::Design* yosys_design = NULL

Definition at line 52 of file yosys.cc.