Skip to content

Commit a9de5c1

Browse files
committed
rtl: Automate RTL benchmarking
1 parent 5cfdc25 commit a9de5c1

File tree

9 files changed

+173318
-7
lines changed

9 files changed

+173318
-7
lines changed

docker/rtl/test-base/Dockerfile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ FROM ubuntu:22.04 AS build
66
SHELL ["/bin/bash", "-c"]
77

88
# Install some basic utilities
9+
ENV DEBIAN_FRONTEND=noninteractive
910
RUN apt update && \
1011
apt install -y \
1112
curl \
@@ -14,7 +15,8 @@ RUN apt update && \
1415
git \
1516
autoconf \
1617
build-essential \
17-
python3
18+
python3 \
19+
opensta
1820

1921
# Install SDKMAN, GraalVM & SBT
2022
RUN curl -s "https://get.sdkman.io" | bash
@@ -87,8 +89,3 @@ RUN make isa
8789

8890
RUN mkdir /rtl
8991
WORKDIR /rtl
90-
91-
# TODO:
92-
# Yosys
93-
# OpenSTA -> We can use the existing Docker image
94-
# Yosys + OpenSTA *.tcl Build scripts

vadl/main/resources/templates/rtl/CoreEmit.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,18 @@ class CoreEmit extends AnyFunSpec with ChiselSim {
2121
)
2222
Files.writeString(Paths.get("build/[(${topModule})].sv"), sv)
2323
}
24+
25+
it("emitDecode") {
26+
Files.createDirectories(Path.of("build"))
27+
val sv = ChiselStage.emitSystemVerilog(
28+
new DECODE,
29+
firtoolOpts = Array(
30+
"--lowering-options=disallowPackedArrays,disallowLocalVariables",
31+
"--strip-debug-info",
32+
"--extract-test-code",
33+
"--disable-layers=Verification"
34+
)
35+
)
36+
Files.writeString(Paths.get("build/DECODE.sv"), sv)
37+
}
2438
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Preserve exit code when piping to tee
4+
set -o pipefail
5+
6+
# Workdir is /rtl, where the OpenVADL 'rtl' output is mounted
7+
cd /rtl
8+
9+
# Translate Chisel to Verilog, writes the result to build/*
10+
sbt "testOnly CoreEmit -- -z emit"
11+
12+
# Run the respective yosys synthesize scripts
13+
yosys -s /scripts/bench/yosys/bench_decode.ys | tee build/synth_decode.log
14+
15+
# TODO: enable spike synthesis (takes too long)
16+
#yosys -s /scripts/bench/yosys/bench_spike.ys | tee build/synth_spike.log
17+
18+
# Timing analysis with OpenSTA
19+
sta < /scripts/bench/opensta/time_decode.tcl | tee /build/time_decode.log
20+

0 commit comments

Comments
 (0)