diff options
| author | ruki <[email protected]> | 2023-07-10 12:38:26 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-07-10 12:38:26 +0800 |
| commit | 450568bf820aa1449bd794efdf6eae0d01c5020a (patch) | |
| tree | 6bc016ee0a1c5f6a0ab5486008095d964ba4f91e | |
| parent | 23b7722256773b42a8219addac2e734d86c422fc (diff) | |
| parent | 2d0da9231087fe5b47eba5534f37108c50abd102 (diff) | |
Merge pull request #3944 from leesum1/verilator_fix
Add systemverilog support,Fix verilator build error
| -rw-r--r-- | xmake/rules/verilator/verilator.lua | 16 | ||||
| -rw-r--r-- | xmake/rules/verilator/xmake.lua | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/xmake/rules/verilator/verilator.lua b/xmake/rules/verilator/verilator.lua index 2314bad23..eebee4121 100644 --- a/xmake/rules/verilator/verilator.lua +++ b/xmake/rules/verilator/verilator.lua @@ -20,6 +20,7 @@ -- imports import("utils.progress") +import("core.base.hashset") import("core.project.depend") import("private.action.build.object", {alias = "build_objectfiles"}) @@ -112,14 +113,14 @@ function config(target) local sourcefile = path.join(tmpdir, "main.v") local argv = {"--cc", "--make", "cmake", "--prefix", "test", "--Mdir", tmpdir, "main.v"} local flags = target:values("verilator.flags") + local switches_flags = hashset.of( "sc", "coverage", "timing", "trace", "trace-fst", "threads") if flags then - for _, flag in ipairs(flags) do - -- we need ignore some unused flags in this stub testing - -- - -- e.g. add_values("verilator.flags", "-GWIDTH=4", "--trace") - -- error: %Error: Parameters from the command line were not found in the design: WIDTH - if not flag:startswith("-G") then + for idx, flag in ipairs(flags) do + if flag:startswith("--") and switches_flags:has(flag:sub(3)) then table.insert(argv, flag) + if flag:startswith("--threads") then + table.insert(argv, flags[idx + 1]) + end end end end @@ -199,6 +200,9 @@ endmodule]]) if target:is_plat("linux", "macosx") and switches.THREADS == "1" then target:add("syslinks", "pthread") end + if target:is_plat("linux", "macosx") and switches.TRACE_FST == "1" then + target:add("syslinks", "z") + end os.rm(tmpdir) end diff --git a/xmake/rules/verilator/xmake.lua b/xmake/rules/verilator/xmake.lua index cc7a24b27..4272ed91f 100644 --- a/xmake/rules/verilator/xmake.lua +++ b/xmake/rules/verilator/xmake.lua @@ -20,7 +20,7 @@ -- @see https://github.com/xmake-io/xmake/issues/3257 rule("verilator.binary") - set_extensions(".v") + set_extensions(".v", ".sv") on_load(function (target) target:set("kind", "binary") end) |
