mirror of https://github.com/YosysHQ/yosys.git
Merged a few fixes for non-posix systems from github.com/Siesh1oo/yosys
(see https://github.com/cliffordwolf/yosys/pull/28)
This commit is contained in:
parent
9992026a8d
commit
91704a7853
2
README
2
README
|
@ -292,7 +292,7 @@ a recent version of gcc:
|
|||
This is a bug in the minisat header. It can be fixed by adding spaces before
|
||||
and after each occurrence of PRIi64 in the header file:
|
||||
|
||||
sudo sed -i 's/PRIi64/ & /' /usr/include/minisat/utils/Options.h
|
||||
sudo sed -i -e 's/PRIi64/ & /' /usr/include/minisat/utils/Options.h
|
||||
|
||||
|
||||
Roadmap / Large-scale TODOs
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
struct Vhdl2verilogPass : public Pass {
|
||||
Vhdl2verilogPass() : Pass("vhdl2verilog", "importing VHDL designs using vhdl2verilog") { }
|
||||
|
@ -93,9 +95,12 @@ struct Vhdl2verilogPass : public Pass {
|
|||
log_error("For some reason mkdtemp() failed!\n");
|
||||
|
||||
if (!out_file.empty() && out_file[0] != '/') {
|
||||
char *pwd = get_current_dir_name();
|
||||
char pwd [PATH_MAX];
|
||||
if (!getcwd(pwd, sizeof(pwd))) {
|
||||
log_cmd_error("getcwd failed: %s", strerror(errno));
|
||||
log_abort();
|
||||
}
|
||||
out_file = pwd + ("/" + out_file);
|
||||
free(pwd);
|
||||
}
|
||||
|
||||
FILE *f = fopen(stringf("%s/files.list", tempdir_name).c_str(), "wt");
|
||||
|
@ -104,9 +109,12 @@ struct Vhdl2verilogPass : public Pass {
|
|||
if (file.empty())
|
||||
continue;
|
||||
if (file[0] != '/') {
|
||||
char *pwd = get_current_dir_name();
|
||||
char pwd [PATH_MAX];
|
||||
if (!getcwd(pwd, sizeof(pwd))) {
|
||||
log_cmd_error("getcwd failed: %s", strerror(errno));
|
||||
log_abort();
|
||||
}
|
||||
file = pwd + ("/" + file);
|
||||
free(pwd);
|
||||
}
|
||||
fprintf(f, "%s\n", file.c_str());
|
||||
log("Adding '%s' to the file list.\n", file.c_str());
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
|
16
kernel/log.h
16
kernel/log.h
|
@ -23,6 +23,8 @@
|
|||
#include "kernel/rtlil.h"
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <vector>
|
||||
|
||||
extern std::vector<FILE*> log_files;
|
||||
|
@ -65,9 +67,23 @@ struct PerformanceTimer
|
|||
}
|
||||
|
||||
static int64_t query() {
|
||||
#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
|
||||
return int64_t(ts.tv_sec)*1000000000 + ts.tv_nsec;
|
||||
#elif defined(RUSAGE_SELF)
|
||||
struct rusage rusage;
|
||||
int64_t t;
|
||||
if (getrusage(RUSAGE_SELF, &rusage) == -1) {
|
||||
log_cmd_error("getrusage failed!\n");
|
||||
log_abort();
|
||||
}
|
||||
t = 1000000000ULL * (int64_t) rusage.ru_utime.tv_sec + (int64_t) rusage.ru_utime.tv_usec * 1000ULL;
|
||||
t += 1000000000ULL * (int64_t) rusage.ru_stime.tv_sec + (int64_t) rusage.ru_stime.tv_usec * 1000ULL;
|
||||
return t;
|
||||
#else
|
||||
#error Dont know how to measure per-process CPU time. Need alternative method (times()/clocks()/gettimeofday()?).
|
||||
#endif
|
||||
}
|
||||
|
||||
void reset() {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
using namespace REGISTER_INTERN;
|
||||
#define MAX_REG_COUNT 1000
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <signal.h>
|
||||
#include <csignal>
|
||||
#include <cinttypes>
|
||||
|
||||
#include <minisat/core/Solver.h>
|
||||
|
@ -170,14 +170,18 @@ contradiction:
|
|||
#endif
|
||||
}
|
||||
|
||||
sighandler_t old_alarm_sighandler = NULL;
|
||||
struct sigaction sig_action;
|
||||
struct sigaction old_sig_action;
|
||||
int old_alarm_timeout = 0;
|
||||
|
||||
if (solverTimeout > 0) {
|
||||
sig_action.sa_handler = alarmHandler;
|
||||
sigemptyset(&sig_action.sa_mask);
|
||||
sig_action.sa_flags = SA_RESTART;
|
||||
alarmHandlerThis = this;
|
||||
alarmHandlerTimeout = clock() + solverTimeout*CLOCKS_PER_SEC;
|
||||
old_alarm_timeout = alarm(0);
|
||||
old_alarm_sighandler = signal(SIGALRM, alarmHandler);
|
||||
sigaction(SIGALRM, &sig_action, &old_sig_action);
|
||||
alarm(1);
|
||||
}
|
||||
|
||||
|
@ -187,7 +191,7 @@ contradiction:
|
|||
if (alarmHandlerTimeout == 0)
|
||||
solverTimoutStatus = true;
|
||||
alarm(0);
|
||||
signal(SIGALRM, old_alarm_sighandler);
|
||||
sigaction(SIGALRM, &old_sig_action, NULL);
|
||||
alarm(old_alarm_timeout);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
|
||||
#include "ezsat.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
const int ezSAT::TRUE = 1;
|
||||
const int ezSAT::FALSE = 2;
|
||||
|
|
|
@ -43,7 +43,9 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
#include <cerrno>
|
||||
#include <sstream>
|
||||
#include <climits>
|
||||
|
||||
#include "blifparse.h"
|
||||
|
||||
|
@ -973,7 +975,11 @@ struct AbcPass : public Pass {
|
|||
int lut_mode = 0;
|
||||
|
||||
size_t argidx;
|
||||
char *pwd = get_current_dir_name();
|
||||
char pwd [PATH_MAX];
|
||||
if (!getcwd(pwd, sizeof(pwd))) {
|
||||
log_cmd_error("getcwd failed: %s\n", strerror(errno));
|
||||
log_abort();
|
||||
}
|
||||
for (argidx = 1; argidx < args.size(); argidx++) {
|
||||
std::string arg = args[argidx];
|
||||
if (arg == "-exe" && argidx+1 < args.size()) {
|
||||
|
@ -1020,7 +1026,6 @@ struct AbcPass : public Pass {
|
|||
}
|
||||
break;
|
||||
}
|
||||
free(pwd);
|
||||
extra_args(args, argidx, design);
|
||||
|
||||
if (lut_mode != 0 && !liberty_file.empty())
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "kernel/log.h"
|
||||
#include <string.h>
|
||||
#include <fnmatch.h>
|
||||
#include <errno.h>
|
||||
|
||||
using RTLIL::id2cstr;
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@
|
|||
#include "kernel/consteval.h"
|
||||
#include "kernel/celltypes.h"
|
||||
#include "fsmdata.h"
|
||||
#include "math.h"
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
static void fm_set_fsm_print(RTLIL::Cell *cell, RTLIL::Module *module, FsmData &fsm_data, const char *prefix, FILE *f)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "kernel/log.h"
|
||||
#include "libparse.h"
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
using namespace PASS_DFFLIBMAP;
|
||||
|
||||
|
|
Loading…
Reference in New Issue