mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-08 04:01:25 +00:00
Merge remote-tracking branch 'origin/master' into xc7mux
This commit is contained in:
commit
fb09c6219b
56 changed files with 1811 additions and 487 deletions
|
@ -281,6 +281,9 @@ struct BugpointPass : public Pass {
|
|||
}
|
||||
extra_args(args, argidx, design);
|
||||
|
||||
if (script.empty())
|
||||
log_cmd_error("Missing -script option.\n");
|
||||
|
||||
if (!has_part)
|
||||
{
|
||||
modules = true;
|
||||
|
@ -298,7 +301,7 @@ struct BugpointPass : public Pass {
|
|||
if (!check_logfile(grep))
|
||||
log_cmd_error("The provided grep string is not found in the log file!\n");
|
||||
|
||||
int seed = 0, crashing_seed = seed;
|
||||
int seed = 0;
|
||||
bool found_something = false, stage2 = false;
|
||||
while (true)
|
||||
{
|
||||
|
@ -324,7 +327,6 @@ struct BugpointPass : public Pass {
|
|||
if (crashing_design != design)
|
||||
delete crashing_design;
|
||||
crashing_design = simplified;
|
||||
crashing_seed = seed;
|
||||
found_something = true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -98,21 +98,23 @@ struct CoverPass : public Pass {
|
|||
}
|
||||
if ((args[argidx] == "-o" || args[argidx] == "-a" || args[argidx] == "-d") && argidx+1 < args.size()) {
|
||||
const char *open_mode = args[argidx] == "-a" ? "a+" : "w";
|
||||
std::string filename = args[++argidx];
|
||||
const std::string &filename = args[++argidx];
|
||||
FILE *f = nullptr;
|
||||
if (args[argidx-1] == "-d") {
|
||||
#ifdef _WIN32
|
||||
log_cmd_error("The 'cover -d' option is not supported on win32.\n");
|
||||
#else
|
||||
char filename_buffer[4096];
|
||||
snprintf(filename_buffer, 4096, "%s/yosys_cover_%d_XXXXXX.txt", filename.c_str(), getpid());
|
||||
filename = mkstemps(filename_buffer, 4);
|
||||
f = fdopen(mkstemps(filename_buffer, 4), "w");
|
||||
#endif
|
||||
} else {
|
||||
f = fopen(filename.c_str(), open_mode);
|
||||
}
|
||||
FILE *f = fopen(filename.c_str(), open_mode);
|
||||
if (f == NULL) {
|
||||
for (auto f : out_files)
|
||||
fclose(f);
|
||||
log_cmd_error("Can't create file %s.\n", args[argidx].c_str());
|
||||
log_cmd_error("Can't create file %s%s.\n", args[argidx-1] == "-d" ? "in directory " : "", args[argidx].c_str());
|
||||
}
|
||||
out_files.push_back(f);
|
||||
continue;
|
||||
|
|
|
@ -37,7 +37,9 @@ struct statdata_t
|
|||
STAT_INT_MEMBERS
|
||||
#undef X
|
||||
double area;
|
||||
string tech;
|
||||
|
||||
std::map<RTLIL::IdString, int> techinfo;
|
||||
std::map<RTLIL::IdString, int, RTLIL::sort_by_id_str> num_cells_by_type;
|
||||
std::set<RTLIL::IdString> unknown_cell_area;
|
||||
|
||||
|
@ -70,8 +72,10 @@ struct statdata_t
|
|||
#undef X
|
||||
}
|
||||
|
||||
statdata_t(RTLIL::Design *design, RTLIL::Module *mod, bool width_mode, const dict<IdString, double> &cell_area)
|
||||
statdata_t(RTLIL::Design *design, RTLIL::Module *mod, bool width_mode, const dict<IdString, double> &cell_area, string techname)
|
||||
{
|
||||
tech = techname;
|
||||
|
||||
#define X(_name) _name = 0;
|
||||
STAT_NUMERIC_MEMBERS
|
||||
#undef X
|
||||
|
@ -153,7 +157,8 @@ struct statdata_t
|
|||
log(" Number of processes: %6d\n", num_processes);
|
||||
log(" Number of cells: %6d\n", num_cells);
|
||||
for (auto &it : num_cells_by_type)
|
||||
log(" %-26s %6d\n", RTLIL::id2cstr(it.first), it.second);
|
||||
if (it.second)
|
||||
log(" %-26s %6d\n", RTLIL::id2cstr(it.first), it.second);
|
||||
|
||||
if (!unknown_cell_area.empty()) {
|
||||
log("\n");
|
||||
|
@ -165,6 +170,59 @@ struct statdata_t
|
|||
log("\n");
|
||||
log(" Chip area for %smodule '%s': %f\n", (top_mod) ? "top " : "", mod_name.c_str(), area);
|
||||
}
|
||||
|
||||
if (tech == "xilinx")
|
||||
{
|
||||
int lut6_cnt = num_cells_by_type["\\LUT6"];
|
||||
int lut5_cnt = num_cells_by_type["\\LUT5"];
|
||||
int lut4_cnt = num_cells_by_type["\\LUT4"];
|
||||
int lut3_cnt = num_cells_by_type["\\LUT3"];
|
||||
int lut2_cnt = num_cells_by_type["\\LUT2"];
|
||||
int lut1_cnt = num_cells_by_type["\\LUT1"];
|
||||
int lc_cnt = 0;
|
||||
|
||||
lc_cnt += lut6_cnt;
|
||||
|
||||
lc_cnt += lut5_cnt;
|
||||
if (lut1_cnt) {
|
||||
int cnt = std::min(lut5_cnt, lut1_cnt);
|
||||
lut5_cnt -= cnt;
|
||||
lut1_cnt -= cnt;
|
||||
}
|
||||
|
||||
lc_cnt += lut4_cnt;
|
||||
if (lut1_cnt) {
|
||||
int cnt = std::min(lut4_cnt, lut1_cnt);
|
||||
lut4_cnt -= cnt;
|
||||
lut1_cnt -= cnt;
|
||||
}
|
||||
if (lut2_cnt) {
|
||||
int cnt = std::min(lut4_cnt, lut2_cnt);
|
||||
lut4_cnt -= cnt;
|
||||
lut2_cnt -= cnt;
|
||||
}
|
||||
|
||||
lc_cnt += lut3_cnt;
|
||||
if (lut1_cnt) {
|
||||
int cnt = std::min(lut3_cnt, lut1_cnt);
|
||||
lut3_cnt -= cnt;
|
||||
lut1_cnt -= cnt;
|
||||
}
|
||||
if (lut2_cnt) {
|
||||
int cnt = std::min(lut3_cnt, lut2_cnt);
|
||||
lut3_cnt -= cnt;
|
||||
lut2_cnt -= cnt;
|
||||
}
|
||||
if (lut3_cnt) {
|
||||
int cnt = (lut3_cnt + 1) / 2;
|
||||
lut3_cnt -= cnt;
|
||||
}
|
||||
|
||||
lc_cnt += (lut2_cnt + lut1_cnt + 1) / 2;
|
||||
|
||||
log("\n");
|
||||
log(" Estimated number of LCs: %10d\n", lc_cnt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -226,6 +284,10 @@ struct StatPass : public Pass {
|
|||
log(" -liberty <liberty_file>\n");
|
||||
log(" use cell area information from the provided liberty file\n");
|
||||
log("\n");
|
||||
log(" -tech <technology>\n");
|
||||
log(" print area estemate for the specified technology. Corrently supported\n");
|
||||
log(" calues for <technology>: xilinx\n");
|
||||
log("\n");
|
||||
log(" -width\n");
|
||||
log(" annotate internal cell types with their word width.\n");
|
||||
log(" e.g. $add_8 for an 8 bit wide $add cell.\n");
|
||||
|
@ -239,6 +301,7 @@ struct StatPass : public Pass {
|
|||
RTLIL::Module *top_mod = NULL;
|
||||
std::map<RTLIL::IdString, statdata_t> mod_stat;
|
||||
dict<IdString, double> cell_area;
|
||||
string techname;
|
||||
|
||||
size_t argidx;
|
||||
for (argidx = 1; argidx < args.size(); argidx++)
|
||||
|
@ -253,6 +316,10 @@ struct StatPass : public Pass {
|
|||
read_liberty_cellarea(cell_area, liberty_file);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-tech" && argidx+1 < args.size()) {
|
||||
techname = args[++argidx];
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-top" && argidx+1 < args.size()) {
|
||||
if (design->modules_.count(RTLIL::escape_id(args[argidx+1])) == 0)
|
||||
log_cmd_error("Can't find module %s.\n", args[argidx+1].c_str());
|
||||
|
@ -263,6 +330,9 @@ struct StatPass : public Pass {
|
|||
}
|
||||
extra_args(args, argidx, design);
|
||||
|
||||
if (techname != "" && techname != "xilinx")
|
||||
log_cmd_error("Unsupported technology: '%s'\n", techname.c_str());
|
||||
|
||||
for (auto mod : design->selected_modules())
|
||||
{
|
||||
if (!top_mod && design->full_selection())
|
||||
|
@ -272,7 +342,7 @@ struct StatPass : public Pass {
|
|||
if (mod->attributes.count("\\abc_box_id"))
|
||||
continue;
|
||||
|
||||
statdata_t data(design, mod, width_mode, cell_area);
|
||||
statdata_t data(design, mod, width_mode, cell_area, techname);
|
||||
mod_stat[mod->name] = data;
|
||||
|
||||
log("\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue