Skip to content

Commit 1048557

Browse files
committed
add workflow for automatic gate-level testing
1 parent 79d6b01 commit 1048557

File tree

3 files changed

+61
-3
lines changed

3 files changed

+61
-3
lines changed

.github/workflows/gds.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ jobs:
5858
- name: show files
5959
run: find runs/wokwi/
6060

61+
# extract gate-level verilog
62+
- name: extract gate-level verilog
63+
run: |
64+
cp `find runs/wokwi/results/final/verilog/gl/*.v` runs/gatelevel.v
65+
66+
# upload gate-level verilog
67+
- uses: actions/upload-artifact@v3
68+
with:
69+
name: gatelevel.v
70+
path: runs/gatelevel.v
71+
6172
# print some routing stats
6273
- name: add summary
6374
run: ./configure.py --get-stats >> $GITHUB_STEP_SUMMARY
@@ -80,6 +91,28 @@ jobs:
8091
path: runs
8192
key: ${{ runner.os }}-runs-${{ github.run_id }}
8293

94+
gatelevel:
95+
needs: gds
96+
runs-on: ubuntu-latest
97+
container:
98+
image: davidsiaw/ocs
99+
env:
100+
GATES: yes
101+
PDK_ROOT: /opt/pdk
102+
steps:
103+
- name: checkout repo
104+
uses: actions/checkout@v3
105+
- uses: actions/download-artifact@v3
106+
with:
107+
name: gatelevel.v
108+
path: src/gatelevel-src
109+
- name: run gate level test
110+
run: |
111+
cd src
112+
ls
113+
cp gatelevel-src/gatelevel.v gatelevel.v
114+
make
115+
83116
png:
84117
needs: gds
85118
runs-on: ubuntu-latest

src/Makefile

+18-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,24 @@
55
SIM ?= icarus
66
TOPLEVEL_LANG ?= verilog
77

8-
VERILOG_SOURCES += $(PWD)/tb.v $(PWD)/counter.v $(PWD)/decoder.v
8+
ifneq ($(GATES),yes)
9+
# normal simulation
10+
VERILOG_SOURCES=$(wildcard $(PWD)/*.v)
11+
12+
else
13+
# copy the gatelevel verilog from /runs/wokwi/results/final/verilog/gl/ and commit to this directory
14+
VERILOG_SOURCES=$(PWD)/tb.v $(PWD)/gatelevel.v
15+
16+
# gate level simulation requires some extra setup
17+
COMPILE_ARGS += -DGL_TEST
18+
COMPILE_ARGS += -DFUNCTIONAL
19+
COMPILE_ARGS += -DUSE_POWER_PINS
20+
COMPILE_ARGS += -DSIM
21+
COMPILE_ARGS += -DUNIT_DELAY=#1
22+
COMPILE_ARGS += -DSIM
23+
VERILOG_SOURCES += $(PDK_ROOT)/sky130B/libs.ref/sky130_fd_sc_hd/verilog/primitives.v
24+
VERILOG_SOURCES += $(PDK_ROOT)/sky130B/libs.ref/sky130_fd_sc_hd/verilog/sky130_fd_sc_hd.v
25+
endif
926

1027
# TOPLEVEL is the name of the toplevel module in your Verilog or VHDL file
1128
TOPLEVEL = tb
@@ -15,4 +32,3 @@ MODULE = test
1532

1633
# include cocotb's make rules to take care of the simulator setup
1734
include $(shell cocotb-config --makefiles)/Makefile.sim
18-

src/tb.v

+10-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@ module tb (
2626
assign segments = outputs[6:0];
2727

2828
// instantiate the DUT
29-
seven_segment_seconds #(.MAX_COUNT(100)) seven_segment_seconds(
29+
seven_segment_seconds #(
30+
`ifndef GL_TEST
31+
.MAX_COUNT(100)
32+
`endif
33+
) seven_segment_seconds (
34+
`ifdef GL_TEST
35+
// for gatelevel testing we need to set up the power pins
36+
.vccd1(1'b1),
37+
.vssd1(1'b0),
38+
`endif
3039
.io_in (inputs),
3140
.io_out (outputs)
3241
);

0 commit comments

Comments
 (0)