Skip to content

Commit

Permalink
Merge pull request #5677 from 24bit-xjkp/dev
Browse files Browse the repository at this point in the history
feat(rules/iverilog): Improve the iverilog build rules
  • Loading branch information
waruqi committed Sep 30, 2024
2 parents ab08bde + a1c7cf2 commit dab564a
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions xmake/rules/iverilog/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

-- @see https://github.com/xmake-io/xmake/issues/3257
rule("iverilog.binary")
set_extensions(".v", ".vhd")
set_extensions(".v", ".sv", ".vhd")
on_load(function (target)
target:set("kind", "binary")
if not target:get("extension") then
Expand Down Expand Up @@ -80,11 +80,8 @@ rule("iverilog.binary")
end

-- get defines
local defines = target:get("defines")
if defines then
for _, define in ipairs(defines) do
table.insert(argv, "-D" .. define)
end
for _, define in ipairs((target:get_from("defines", "*"))) do
table.insert(argv, "-D" .. define)
end

-- get includedirs
Expand Down Expand Up @@ -114,6 +111,5 @@ rule("iverilog.binary")
on_run(function (target)
local toolchain = assert(target:toolchain("iverilog"), 'we need set_toolchains("iverilog") in target("%s")', target:name())
local vvp = assert(toolchain:config("vvp"), "vvp not found!")

os.execv(vvp, {"-n", target:targetfile(), "-lxt2"})
os.execv(vvp, {"-n", target:targetfile()})
end)

0 comments on commit dab564a

Please sign in to comment.