Repository navigation
Expand file tree
/
Copy pathxmake.lua
More file actions
78 lines (68 loc) · 2.01 KB
/
Copy pathxmake.lua
File metadata and controls
78 lines (68 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---@diagnostic disable
task("rtl", function()
set_menu {
usage = "xmake rtl [options]",
description = "Generate RTL",
options = {
{'b', "build-dir", "kv", "build", "build directory"},
{'M', "main-function", "kv", "PriorityEncoderHigh", "main class"},
{'t', "target", "kv", "systemverilog", "output targer format"},
}
}
on_run(function()
import("core.base.option")
local main = option.get("main-function")
local build_dir = option.get("build-dir")
local rtl_dir = path.join(build_dir, "rtl")
local chisel_opts = {"-i", "test.runMain", "xs.utils.test." .. main .. "Top"}
table.join2(chisel_opts, {"--throw-on-first-error", "--target", option.get("target"), "--split-verilog", "--full-stacktrace", "-td", rtl_dir})
if os.exists(rtl_dir) then os.rmdir(rtl_dir) end
if os.host() == "windows" then
os.execv(os.shell(), table.join({"mill"}, chisel_opts))
else
os.execv("mill", chisel_opts)
end
os.rm(path.join(rtl_dir, "firrtl_black_box_resource_files.f"))
os.rm(path.join(rtl_dir, "filelist.f"))
os.rm(path.join(rtl_dir, "extern_modules.sv"))
end)
end)
task("init", function()
on_run(function()
os.cd(os.scriptdir())
os.exec("git submodule update --init")
end)
set_menu {}
end)
task("idea", function()
on_run(function()
if os.host() == "windows" then
os.execv("powershell", { "mill", "-i", "mill.idea.GenIdea/idea" })
else
os.execv("mill", { "-i", "mill.idea.GenIdea/idea" })
end
end)
set_menu {
options = {}
}
end)
task("comp", function()
on_run(function()
os.cd(os.scriptdir())
if os.host() == "windows" then
os.execv("powershell", {"-NoProfile", "-Command", "mill dist.jars; exit $LASTEXITCODE"})
else
os.execv("mill", {"dist.jars"})
end
end)
set_menu {
usage = "xmake comp",
description = "Package chisel.jar and chisel.pom into build"
}
end)
task("clean", function()
on_run(function()
os.rmdir(path.join("build", "*"))
end)
set_menu {}
end)