forked from TinyTapeout/tt02-submission-template
-
Notifications
You must be signed in to change notification settings - Fork 0
240 lines (213 loc) · 6.37 KB
/
gds.yaml
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
name: gds
# either manually started, or on a schedule
on: [ push, workflow_dispatch ]
permissions:
contents: write
pages: write
id-token: write
jobs:
gds:
env:
OPENLANE_IMAGE_NAME: efabless/openlane:2022.07.02_01.38.08
OPENLANE_ROOT: /home/runner/openlane
PDK_ROOT: /home/runner/pdk
PDK: sky130B
# ubuntu
runs-on: ubuntu-latest
steps:
# need the repo checked out
- name: checkout repo
uses: actions/checkout@v3
# build PDK and fetch OpenLane
- name: pdk & caravel
run: |
cd $HOME
git clone https://github.com/efabless/caravel_user_project.git -b mpw-7a
cd caravel_user_project
make setup
# need python
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.7.7'
- run: pip install requests PyYAML
# fetch the Verilog from Wokwi API
- name: fetch Verilog and build config
run: ./configure.py --create-user-config
# run OpenLane to build the GDS
- name: make GDS
run: >
docker run --rm
-v $OPENLANE_ROOT:/openlane
-v $PDK_ROOT:$PDK_ROOT
-v $(pwd):/work
-e PDK_ROOT=$PDK_ROOT
-u $(id -u $USER):$(id -g $USER)
$OPENLANE_IMAGE_NAME
/bin/bash -c "./flow.tcl -verbose 2 -overwrite -design /work/src -run_path /work/runs -tag wokwi"
# for debugging, show all the files
- name: show files
run: find runs/wokwi/
# print some routing stats
- name: add summary
run: ./configure.py --get-stats >> $GITHUB_STEP_SUMMARY
# print some cell stats
- name: cell usage summary
run: |
git clone https://github.com/TinyTapeout/sssummarizer
sssummarizer/sssummarizer.py --gl runs/wokwi/results/final/verilog/gl/*.v --print-category >> $GITHUB_STEP_SUMMARY
- name: populate src cache
uses: actions/cache@v3
with:
path: src
key: ${{ runner.os }}-src-${{ github.run_id }}
- name: populate runs cache
uses: actions/cache@v3
with:
path: runs
key: ${{ runner.os }}-runs-${{ github.run_id }}
svg:
needs: gds
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: restore runs cache
uses: actions/cache@v3
with:
path: runs
key: ${{ runner.os }}-runs-${{ github.run_id }}
- name: create svg
run: |
python -m pip install gdstk
python << EOF
import gdstk
import pathlib
gds = sorted(pathlib.Path('runs').glob('wokwi/results/final/gds/*.gds'))
library = gdstk.read_gds(gds[-1])
top_cells = library.top_level()
top_cells[0].write_svg('gds_render.svg')
EOF
- name: populate svg cache
uses: actions/cache@v3
with:
path: 'gds_render.svg'
key: ${{ runner.os }}-svg-${{ github.run_id }}
viewer:
needs: gds
runs-on: ubuntu-latest
steps:
- name: checkout GDS2glTF repo
uses: actions/checkout@v3
with:
repository: mbalestrini/GDS2glTF
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: restore runs cache
uses: actions/cache@v3
with:
path: runs
key: ${{ runner.os }}-runs-${{ github.run_id }}
- name: gds2gltf
run: |
python -m pip install numpy gdspy triangle pygltflib
cp runs/wokwi/results/final/gds/*.gds tinytapeout.gds
python3 gds2gltf.py tinytapeout.gds
- name: populate viewer cache
uses: actions/cache@v3
with:
path: 'tinytapeout.gds.gltf'
key: ${{ runner.os }}-viewer-${{ github.run_id }}
artifact:
needs:
- gds
runs-on: ubuntu-latest
steps:
- name: restore src cache
uses: actions/cache@v3
with:
path: src
key: ${{ runner.os }}-src-${{ github.run_id }}
- name: restore runs cache
uses: actions/cache@v3
with:
path: runs
key: ${{ runner.os }}-runs-${{ github.run_id }}
- name: upload artifact
uses: actions/upload-artifact@v3
with:
# path depends on the tag and the module name
name: GDS
path: |
src/*
runs/wokwi/results/final/*
runs/wokwi/reports/metrics.csv
runs/wokwi/reports/synthesis/1-synthesis.AREA 0.stat.rpt
pages:
needs:
- svg
- viewer
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
outputs:
page_url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: restore svg cache
uses: actions/cache@v3
with:
path: 'gds_render.svg'
key: ${{ runner.os }}-svg-${{ github.run_id }}
- name: restore viewer cache
uses: actions/cache@v3
with:
path: 'tinytapeout.gds.gltf'
key: ${{ runner.os }}-viewer-${{ github.run_id }}
- name: generate redirect to viewer
run: |
cat << EOF >> index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Redirecting to GDS Viewer...</title>
</head>
<body>
<script>
location.href = "https://gds-viewer.tinytapeout.com/?model=" + encodeURIComponent(location.href + '/tinytapeout.gds.gltf');
</script>
</body>
</html>
EOF
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/[email protected]
preview:
needs: pages
runs-on: ubuntu-latest
steps:
- name: add gds preview
run: |
PAGE_URL=${{ needs.pages.outputs.page_url }}
PAGE_URL=$(echo "$PAGE_URL" | sed -e 's/\/$//')
cat << EOF >> $GITHUB_STEP_SUMMARY
# layout
![svg]($PAGE_URL/gds_render.svg)
# viewer
[open preview](https://gds-viewer.tinytapeout.com/?model=$PAGE_URL/tinytapeout.gds.gltf)
EOF