-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathaction.yml
187 lines (163 loc) · 5.72 KB
/
action.yml
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
name: 'Tiny Tapeout GDS Action'
description: 'This action builds a GDS file from your Tiny Tapeout project'
branding:
color: purple
icon: layers
inputs:
tools-repo:
description: 'Override tt-support-tools repository'
default: 'TinyTapeout/tt-support-tools'
required: false
type: string
tools-ref:
description: 'Override tt-support-tools branch/tag/commit'
default: 'tt10'
required: false
type: string
flow:
description: 'Flow used for hardening the chip'
default: 'openlane2'
required: false
type: choice
options:
- openlane2
runs:
using: 'composite'
steps:
- name: Set up environment variables
shell: bash
run: |
sed 's/^ *//' << __EOF >> $GITHUB_ENV
OPENLANE2_TAG=2.2.9
PDK_ROOT=/home/runner/pdk
PDK=sky130A
__EOF
# Install packages for 'Render PNG from GDS' step and ghdl to process VHDL files:
- name: Install prerequisites
uses: awalsh128/[email protected]
with:
packages: librsvg2-bin pngquant ghdl-llvm # librsvg2-bin for rsvg-convert; pngquant for heavy PNG compression.
version: tt10 # I think naming a version builds a reusable packages cache for that name.
- name: Checkout tt-support-tools repo
uses: actions/checkout@v4
with:
repository: "${{ inputs.tools-repo }}"
path: tt
ref: "${{ inputs.tools-ref }}"
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip' # caching pip dependencies
- name: Install tt-support-tools dependencies
shell: bash
run: pip install -r tt/requirements.txt
- name: Fetch verilog and build config
shell: bash
run: ./tt/tt_tool.py --create-user-config
- name: Install OpenLane
shell: bash
run: pip install openlane==$OPENLANE2_TAG
- name: Make GDS with OpenLane
shell: bash
run: ./tt/tt_tool.py --harden
- name: Show build files (for debugging)
shell: bash
run: find runs/wokwi/
- name: Linter output
if: always()
shell: bash
run: |
LINTER_LOG=(runs/wokwi/*-verilator-lint/verilator-lint.log)
LINTER_LOG=${LINTER_LOG[0]}
echo "DEBUG LINTER_LOG *$LINTER_LOG*"
cat $LINTER_LOG
echo "END DEBUG"
if [ -s "$LINTER_LOG" ]; then
set +e
count_error=$(egrep -i "^%Error" $LINTER_LOG | wc -l)
count_warn=$( egrep -i "^%Warning" $LINTER_LOG | wc -l)
count_other=$(egrep -i "^%" $LINTER_LOG | egrep -v "%(Warning|Error)" | wc -l)
set -e
open=""
summary=""
icon=":green_circle:"
if [ $count_other -gt 0 ]; then
summary="$count_other message(s)"
icon=":orange_circle:"
fi
if [ $count_warn -gt 0 ]; then
summary="$count_warn warning(s)"
icon=":orange_circle:"
fi
if [ $count_error -gt 0 ]; then
summary="$count_error error(s)"
icon=":red_circle:"
open="open"
fi
if [ -n "$summary" ]; then
summary="[$summary]"
fi
echo "<details ${open}>" >> $GITHUB_STEP_SUMMARY
echo "<summary><h1>Linter output <h4>${summary} ${icon}</h4></h1></summary>" >> $GITHUB_STEP_SUMMARY
echo "<pre>" >> $GITHUB_STEP_SUMMARY
# Print each line of the file preceeded by four spaces:
sed 's/^/ /' < $LINTER_LOG >> $GITHUB_STEP_SUMMARY
echo "</pre>" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
fi
- name: Yosys warnings
shell: bash
run: ./tt/tt_tool.py --print-warnings >> $GITHUB_STEP_SUMMARY
- name: Routing summary
shell: bash
run: ./tt/tt_tool.py --print-stats >> $GITHUB_STEP_SUMMARY
- name: Cell usage summary
shell: bash
run: ./tt/tt_tool.py --print-cell-category >> $GITHUB_STEP_SUMMARY
- name: Publish build logs
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: GDS_logs
path: |
src/*
runs/wokwi/*
- name: Install KLayout
shell: bash
run: |
wget https://github.com/htfab/klayout/releases/download/v0.29.10/klayout_0.29.10-1_amd64.deb
sudo apt-get install -y ./klayout_0.29.10-1_amd64.deb
pip install klayout==0.29.10
- name: Prepare tt_submission artifact
shell: bash
run: |
mkdir -p tt_submission
mkdir -p tt_submission/stats
TOP_MODULE=$(./tt/tt_tool.py --print-top-module)
cp runs/wokwi/final/commit_id.json tt_submission/
cp runs/wokwi/final/{gds,lef,spef/*}/${TOP_MODULE}.* tt_submission/
strm2oas tt_submission/${TOP_MODULE}.gds tt_submission/${TOP_MODULE}.oas
cp runs/wokwi/final/pnl/${TOP_MODULE}.pnl.v tt_submission/${TOP_MODULE}.v
cp runs/wokwi/{OPENLANE_VERSION,PDK_SOURCES,resolved.json} tt_submission/
cp runs/wokwi/final/metrics.csv tt_submission/stats/metrics.csv
cp runs/wokwi/*-yosys-synthesis/reports/stat.rpt tt_submission/stats/synthesis-stats.txt
- name: Publish tt_submission artifact
uses: actions/upload-artifact@v4
with:
name: tt_submission
path: |
src/*
docs/*
tt_submission/*
info.yaml
LICENSE
# Create and store PNG...
- name: Render PNG from GDS
shell: bash
run: './tt/tt_tool.py --create-png 2>&1 || echo "WARNING: Failed to render PNG preview from GDS; error $?"'
- name: Upload gds_render (png) artifact
uses: actions/upload-artifact@v4
with:
name: gds_render
path: 'gds_render.png'