From 161cdd349c591c24ee8be069f3015b14163bd5cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Ji=C5=99=C3=AD=20Tywoniak?= Date: Wed, 24 Sep 2025 11:30:29 +0200 Subject: [PATCH 1/4] io: add append_globbed to resolve globs in regular pass arguments --- kernel/io.cc | 7 +++++++ kernel/io.h | 1 + 2 files changed, 8 insertions(+) diff --git a/kernel/io.cc b/kernel/io.cc index 4c593501c..9e9eb9fb0 100644 --- a/kernel/io.cc +++ b/kernel/io.cc @@ -384,6 +384,13 @@ std::string escape_filename_spaces(const std::string& filename) return out; } +void append_globbed(std::vector& paths, std::string pattern) +{ + rewrite_filename(pattern); + std::vector globbed = glob_filename(pattern); + copy(globbed.begin(), globbed.end(), back_inserter(paths)); +} + void format_emit_unescaped(std::string &result, std::string_view fmt) { result.reserve(result.size() + fmt.size()); diff --git a/kernel/io.h b/kernel/io.h index 2ad0a6466..b3922bef0 100644 --- a/kernel/io.h +++ b/kernel/io.h @@ -469,6 +469,7 @@ bool is_absolute_path(std::string filename); void remove_directory(std::string dirname); bool create_directory(const std::string& dirname); std::string escape_filename_spaces(const std::string& filename); +void append_globbed(std::vector& paths, std::string pattern); YOSYS_NAMESPACE_END From a28c0c632b399f239ad3d0aa3d4a1197bfde9fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Ji=C5=99=C3=AD=20Tywoniak?= Date: Wed, 24 Sep 2025 11:30:49 +0200 Subject: [PATCH 2/4] clockgate: support liberty filename globbing --- passes/techmap/clockgate.cc | 4 +--- tests/techmap/clockgate.ys | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/passes/techmap/clockgate.cc b/passes/techmap/clockgate.cc index 7c6ca5551..b68e5d93d 100644 --- a/passes/techmap/clockgate.cc +++ b/passes/techmap/clockgate.cc @@ -290,9 +290,7 @@ struct ClockgatePass : public Pass { continue; } if (args[argidx] == "-liberty" && argidx+1 < args.size()) { - std::string liberty_file = args[++argidx]; - rewrite_filename(liberty_file); - liberty_files.push_back(liberty_file); + append_globbed(liberty_files, args[++argidx]); continue; } if (args[argidx] == "-dont_use" && argidx+1 < args.size()) { diff --git a/tests/techmap/clockgate.ys b/tests/techmap/clockgate.ys index da0f9dc42..c28852ef8 100644 --- a/tests/techmap/clockgate.ys +++ b/tests/techmap/clockgate.ys @@ -194,7 +194,7 @@ select -assert-count 1 t:\\pdk_icg #------------------------------------------------------------------------------ design -load before -clockgate -liberty clockgate.lib +clockgate -liberty c*ckgate.lib # rising edge ICGs select -module dffe_00 -assert-count 0 t:\\pos_small From 856a387aad0377a85c1bf24427c37149d2d0acaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Ji=C5=99=C3=AD=20Tywoniak?= Date: Wed, 24 Sep 2025 11:30:57 +0200 Subject: [PATCH 3/4] dfflibmap: support liberty filename globbing --- passes/techmap/dfflibmap.cc | 4 +--- tests/techmap/dfflibmap.ys | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/passes/techmap/dfflibmap.cc b/passes/techmap/dfflibmap.cc index f3b96aeec..f2bd16082 100644 --- a/passes/techmap/dfflibmap.cc +++ b/passes/techmap/dfflibmap.cc @@ -609,9 +609,7 @@ struct DfflibmapPass : public Pass { { std::string arg = args[argidx]; if (arg == "-liberty" && argidx+1 < args.size()) { - std::string liberty_file = args[++argidx]; - rewrite_filename(liberty_file); - liberty_files.push_back(liberty_file); + append_globbed(liberty_files, args[++argidx]); continue; } if (arg == "-prepare") { diff --git a/tests/techmap/dfflibmap.ys b/tests/techmap/dfflibmap.ys index 822d87a36..303daee48 100644 --- a/tests/techmap/dfflibmap.ys +++ b/tests/techmap/dfflibmap.ys @@ -23,7 +23,7 @@ read_liberty -lib dfflibmap.lib equiv_opt -map dfflibmap-sim.v -assert -multiclock dfflibmap -liberty dfflibmap.lib equiv_opt -map dfflibmap-sim.v -assert -multiclock dfflibmap -prepare -liberty dfflibmap.lib -dfflibmap -prepare -liberty dfflibmap.lib +dfflibmap -prepare -liberty dffl*bmap.lib equiv_opt -map dfflibmap-sim.v -assert -multiclock dfflibmap -map-only -liberty dfflibmap.lib design -load orig From 4508676e678af683991a7c3a37a997dca309dad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Ji=C5=99=C3=AD=20Tywoniak?= Date: Wed, 24 Sep 2025 11:31:06 +0200 Subject: [PATCH 4/4] libcache: support liberty filename globbing --- passes/techmap/libcache.cc | 4 +--- tests/liberty/libcache.ys | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/passes/techmap/libcache.cc b/passes/techmap/libcache.cc index c833a6046..e4326c49f 100644 --- a/passes/techmap/libcache.cc +++ b/passes/techmap/libcache.cc @@ -96,9 +96,7 @@ quiet = true; continue; } - std::string fname = args[argidx]; - rewrite_filename(fname); - paths.push_back(fname); + append_globbed(paths, args[argidx]); break; } int modes = enable + disable + purge + list + verbose + quiet; diff --git a/tests/liberty/libcache.ys b/tests/liberty/libcache.ys index 04257aa92..8132b3f11 100644 --- a/tests/liberty/libcache.ys +++ b/tests/liberty/libcache.ys @@ -1,5 +1,5 @@ libcache -verbose -libcache -enable busdef.lib +libcache -enable bus*f.lib logger -expect log "Caching is disabled by default." 1 logger -expect log "Caching is enabled for `busdef.lib'." 1