-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
254 lines (230 loc) · 9.21 KB
/
Taskfile.yml
File metadata and controls
254 lines (230 loc) · 9.21 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# SPDX-FileCopyrightText: 2026 aesc silicon
#
# SPDX-License-Identifier: CERN-OHL-W-2.0
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: '3'
includes:
lib:
taskfile: ./modules/elements/zibal/Taskfile.yaml
optional: true
flatten: true
vars:
PDK: '{{.PDK | default "ihp-sg13g2"}}'
TECH:
sh: |
case "{{.PDK}}" in
ihp-sg13g2) echo "sg13g2" ;;
sky130A) echo "sky130" ;;
gf180mcuD) echo "gf180mcu" ;;
*) echo ""; echo "Unknown PDK: {{.PDK}}" >&2; exit 1 ;;
esac
PDK_FAMILY:
sh: |
case "{{.PDK}}" in
ihp-sg13g2) echo "ihp-sg13g2" ;;
sky130A) echo "sky130" ;;
gf180mcuD) echo "gf180mcu" ;;
*) echo ""; echo "Unknown PDK: {{.PDK}}" >&2; exit 1 ;;
esac
PDK_ORFS:
sh: |
case "{{.PDK}}" in
ihp-sg13g2) echo "ihp-sg13g2" ;;
sky130A) echo "sky130hd" ;;
gf180mcuD) echo "gf180" ;;
*) echo ""; echo "Unknown PDK: {{.PDK}}" >&2; exit 1 ;;
esac
PDK_HASH:
sh: |
case "{{.PDK}}" in
ihp-sg13g2) echo "5cccb161f7492697cfa52eb14dc03beb00bdca9e" ;;
sky130A) echo "7b70722e33c03fcb5dabcf4d479fb0822d9251c9" ;;
gf180mcuD) echo "7b70722e33c03fcb5dabcf4d479fb0822d9251c9" ;;
*) echo ""; echo "Unknown PDK: {{.PDK}}" >&2; exit 1 ;;
esac
KLAYOUT_HOME: "{{.PDK_ROOT}}/{{.PDK}}/libs.tech/klayout/"
CONTAINER_NAME: ipforge_container
CONTAINER_ENV: " \
-e TECH={{.TECH}} \
-e PDK={{.PDK}} \
-e PDK_FAMILY={{.PDK_FAMILY}} \
-e PDK_ROOT={{.PDK_ROOT}} \
-e KLAYOUT_HOME={{.KLAYOUT_HOME}} \
-e NAFARR_BASE={{.NAFARR_BASE}} \
-e ZIBAL_BASE={{.ZIBAL_BASE}} \
-e BUILD_ROOT={{.BUILD_ROOT}} \
-e USER={{.USER}} \
"
env:
PDK_ROOT: "{{.PWD}}/pdks"
NAFARR_BASE: "{{.PWD}}/modules/elements/nafarr"
ZIBAL_BASE: "{{.PWD}}/modules/elements/zibal"
BUILD_ROOT: "{{.PWD}}/build"
OPENROAD_FLOW_ROOT: "{{.PWD}}/tools/OpenROAD-flow-scripts/flow"
tasks:
_project-prepare:
cmds:
- virtualenv venv
- venv/bin/pip3 install podman-compose==1.0.6
- venv/bin/pip3 install reuse
- curl https://storage.googleapis.com/git-repo-downloads/repo > repo
- chmod a+rx repo
- ./repo init -u https://github.com/aesc-silicon/i2c-gpio-expander.git -b {{if .branch}}{{.branch}}{{else}}main{{end}} -m manifest{{.manifest_suffix}}.xml
_build-container:
cmds:
- venv/bin/podman-compose {{if .CI}}--podman-pull-args=-q{{end}} pull
repo-sync:
desc: Downloads and synchronizes all required dependencies.
cmds:
- ./repo sync {{if .CI}}-q{{end}}
install:
desc: Installs all dependencies and prepares the project for FPGA and chip workflows.
cmds:
- task: _project-prepare
- task: _build-container
- task: repo-sync
vars:
branch: "main"
manifest_suffix: ""
export:
desc: Exports RTL from SpinalHDL/Chisel for the given ip.
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.RUN}} 'IP_ROOT={{.PWD}}/sources/{{.ip}}/ sbt \"runMain digital.peripherals.io.gpio.GpioExport\"'"
build:
desc: Runs ORFS physical implementation for the given ip/macro/PDK.
vars:
ORFS_ENV: source {{.OPENROAD_FLOW_ROOT}}/../env.sh
ORFS: >-
make -C {{.OPENROAD_FLOW_ROOT}}
YOSYS_EXE=$YOSYS_EXE
OPENROAD_EXE=$OPENROAD_EXE
IP_ROOT={{.PWD}}/sources/{{.ip}}/
DESIGN_CONFIG={{.PWD}}/sources/{{.ip}}/{{.PDK}}/flow/orfs/{{.macro}}/config.mk
WORK_HOME={{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs
CDL: "{{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs/results/{{.PDK_ORFS}}/{{.macro}}/base/6_final.cdl"
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.PDK_CHECK}}"
- "{{.RUN}} '{{.ORFS_ENV}} && {{.ORFS}} {{if .stage}}{{.stage}}{{end}}'"
- "{{.RUN}} '{{.ORFS_ENV}} && {{.ORFS}} generate_abstract'"
- "{{.RUN}} '{{.ORFS_ENV}} && {{.ORFS}} {{.CDL}}'"
- "{{.RUN}} '{{.ORFS_ENV}} && {{.ORFS}} metadata-generate'"
- "{{.RUN}} '{{.ORFS_ENV}} && {{.ORFS}} metadata-check'"
update-metadata:
desc: Updates the OpenROAD metadata for the given ip/macro/PDK.
vars:
ORFS_ENV: source {{.OPENROAD_FLOW_ROOT}}/../env.sh
ORFS: >-
make -C {{.OPENROAD_FLOW_ROOT}}
YOSYS_EXE=$YOSYS_EXE
OPENROAD_EXE=$OPENROAD_EXE
IP_ROOT={{.PWD}}/sources/{{.ip}}/
DESIGN_CONFIG={{.PWD}}/sources/{{.ip}}/{{.PDK}}/flow/orfs/{{.macro}}/config.mk
WORK_HOME={{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs
CDL: "{{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs/objects/{{.PDK_ORFS}}/{{.macro}}/base/6_final_concat.cdl"
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.RUN}} '{{.ORFS_ENV}} && {{.ORFS}} metadata-generate'"
- "{{.RUN}} '{{.ORFS_ENV}} && {{.ORFS}} update_rules'"
build-librelane:
desc: Runs LibreLane physical implementation for the given ip/macro/PDK.
vars:
LIBRELANE_CMD: >-
PYTHONPATH={{.PWD}}/tools/librelane python3 -m librelane
--force-run-dir {{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/librelane
{{.PWD}}/sources/{{.ip}}/{{.PDK}}/flow/librelane/{{.macro}}.yml
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.PDK_CHECK}}"
- "mkdir -p {{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/librelane"
- "{{.RUN}} '{{.LIBRELANE_CMD}}'"
check-logs:
desc: Scans ORFS build logs for warnings and errors for the given ip/macro/PDK.
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.RUN}} 'find {{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs/logs/{{.PDK_ORFS}}/{{.macro}}/ -type f -iname \"*.log\" -exec grep -v -e \"already destroyed\" -e \"XDG_RUNTIME_DIR not set\" -i {} \\+ |
grep --color -e WARNING -e ERROR'"
- "{{.RUN}} 'find {{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs/reports/{{.PDK_ORFS}}/{{.macro}}/ -type f -iname \"6_finish.rpt\" -exec grep \"violation count\" {} \\+'"
run-drc:
desc: Runs KLayout DRC sign-off for the given ip/macro/PDK.
vars:
DRC_CMD: >-
bash {{.PWD}}/scripts/run_drc.sh
--gds {{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs/results/{{.PDK_ORFS}}/{{.macro}}/base/6_final.gds
--topcell {{.macro}}
--run-dir {{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/verification/{{.PDK}}/drc/
--jobs {{numCPU}}
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.RUN}} '{{.DRC_CMD}}'"
run-lvs:
desc: Runs KLayout LVS sign-off for the given ip/macro/PDK.
vars:
ORFS_RESULTS: "{{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs/results/{{.PDK_ORFS}}/{{.macro}}/base"
ORFS_OBJECTS: "{{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs/objects/{{.PDK_ORFS}}/{{.macro}}/base"
LVS_CMD: >-
bash {{.PWD}}/scripts/run_lvs.sh
--gds {{.ORFS_RESULTS}}/6_final.gds
--topcell {{.macro}}
--netlist {{.ORFS_RESULTS}}/6_final.cdl
--netlist-concat {{.ORFS_OBJECTS}}/6_final_concat.cdl
--run-dir {{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/verification/{{.PDK}}/lvs/
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.RUN}} '{{.LVS_CMD}}'"
run-test:
desc: Runs cocotb simulation tests for the given ip/macro/PDK.
vars:
TEST_ENV: >-
SIM_BUILD={{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/verification/{{.PDK}}/test
COCOTB_RESULTS_FILE={{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/verification/{{.PDK}}/test/results.xml
TOPLEVEL={{.macro}}
COCOTB_TEST_MODULES=test_{{.macro}}
VERILOG_SOURCES={{.PWD}}/sources/{{.ip}}/rtl/verilog/{{.macro}}.v
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.RUN}} '{{.TEST_ENV}} make -C {{.PWD}}/sources/{{.ip}}/test/'"
check-license:
desc: Checks REUSE license compliance for the given ip.
cmds:
- "venv/bin/reuse --root {{.PWD}}/sources/{{.ip}}/ lint"
view-drc:
desc: Opens DRC results in KLayout for the given ip/macro/PDK.
vars:
GDS: "{{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs/results/{{.PDK_ORFS}}/{{.macro}}/base/6_final.gds"
DRC_DB: "{{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/verification/{{.PDK}}/drc/{{.macro}}_drc.lyrdb"
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.RUN}} 'klayout -n {{.TECH}} -e {{.GDS}} -m {{.DRC_DB}}'"
view-lvs:
desc: Opens LVS results in KLayout for the given ip/macro/PDK.
vars:
GDS: "{{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs/results/{{.PDK_ORFS}}/{{.macro}}/base/6_final.gds"
LVS_DB: "{{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/verification/{{.PDK}}/lvs/6_final.lvsdb"
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.RUN}} 'klayout -n {{.TECH}} -e {{.GDS}} -mn {{.LVS_DB}}'"
view-openroad:
desc: Opens the final ODB in the OpenROAD GUI for the given ip/macro/PDK.
vars:
ODB: "{{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs/results/{{.PDK_ORFS}}/{{.macro}}/base/{{if .stage}}{{.stage}}{{else}}6_final{{end}}.odb"
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.RUN}} '{{.OPENROAD_EXE}} -gui <(echo read_db {{.ODB}})'"
view-klayout:
desc: Opens the final GDS in KLayout for the given ip/macro/PDK.
vars:
GDS: "{{.BUILD_ROOT}}/{{.ip}}/{{.macro}}/orfs/results/{{.PDK_ORFS}}/{{.macro}}/base/6_final.gds"
cmds:
- "{{.CONTAINER_CHECK}}"
- "{{.RUN}} 'klayout -n {{.TECH}} -e {{.GDS}}'"
default:
cmds:
- task: build
- task: run-drc
# LVS is not stable yet. Skip for now.
#- task: run-lvs
- task: run-test
- task: check-logs
- task: check-license