mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #4223 from rovinski/master
dfflibmap: use patmatch() from kernel/yosys.cc
This commit is contained in:
commit
6e06723ddb
|
@ -23,13 +23,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <shlwapi.h>
|
|
||||||
#pragma comment(lib, "shlwapi.lib")
|
|
||||||
#else
|
|
||||||
#include <fnmatch.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
USING_YOSYS_NAMESPACE
|
USING_YOSYS_NAMESPACE
|
||||||
PRIVATE_NAMESPACE_BEGIN
|
PRIVATE_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -122,14 +115,6 @@ static bool parse_pin(LibertyAst *cell, LibertyAst *attr, std::string &pin_name,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int glob_match(const char *pattern, const char *string) {
|
|
||||||
#ifdef _WIN32
|
|
||||||
return PathMatchSpecA(string, pattern);
|
|
||||||
#else
|
|
||||||
return fnmatch(pattern, string, 0) == 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void find_cell(LibertyAst *ast, IdString cell_type, bool clkpol, bool has_reset, bool rstpol, bool rstval, std::vector<std::string> &dont_use_cells)
|
static void find_cell(LibertyAst *ast, IdString cell_type, bool clkpol, bool has_reset, bool rstpol, bool rstval, std::vector<std::string> &dont_use_cells)
|
||||||
{
|
{
|
||||||
LibertyAst *best_cell = nullptr;
|
LibertyAst *best_cell = nullptr;
|
||||||
|
@ -153,7 +138,7 @@ static void find_cell(LibertyAst *ast, IdString cell_type, bool clkpol, bool has
|
||||||
bool dont_use = false;
|
bool dont_use = false;
|
||||||
for (std::string &dont_use_cell : dont_use_cells)
|
for (std::string &dont_use_cell : dont_use_cells)
|
||||||
{
|
{
|
||||||
if (glob_match(dont_use_cell.c_str(), cell->args[0].c_str()))
|
if (patmatch(dont_use_cell.c_str(), cell->args[0].c_str()))
|
||||||
{
|
{
|
||||||
dont_use = true;
|
dont_use = true;
|
||||||
break;
|
break;
|
||||||
|
@ -277,7 +262,7 @@ static void find_cell_sr(LibertyAst *ast, IdString cell_type, bool clkpol, bool
|
||||||
bool dont_use = false;
|
bool dont_use = false;
|
||||||
for (std::string &dont_use_cell : dont_use_cells)
|
for (std::string &dont_use_cell : dont_use_cells)
|
||||||
{
|
{
|
||||||
if (glob_match(dont_use_cell.c_str(), cell->args[0].c_str()))
|
if (patmatch(dont_use_cell.c_str(), cell->args[0].c_str()))
|
||||||
{
|
{
|
||||||
dont_use = true;
|
dont_use = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue