← All tasks
EDA 05Design Synthesis & Review

Design RISC-V CPU core from description to GDSII

Tools
Verilator, Spike, riscv32-unknown-elf-gcc, Ramulator, OpenROAD-flow-scripts
Time limit
6 hours

Agent is asked to design a RISC-V CPU core, with its own caches in front of a DRAM line port, and take it all the way to GDSII.

Agent Input

What the agent is given: the instruction and its input files.

instruction.md

Design a RISC-V CPU core and take it all the way to GDSII.

The workspace is /app; start with /app/README.md, then /app/docs/INTERFACE_CONTRACT.md and /app/docs/SCORING.md.

  • What to build: implement module core (ISA rv32i_zmmul_zicsr) behind the frozen interface in /app/rtl, and list your sources and commit width in /app/rtl/design.mk. All of DRAM sits behind a 64-byte line port with DRAM-modeled, variable latency, so the core needs its own caches; you may build them from the provided ASAP7 fakeram SRAM macros.
  • Functional verification: the core must pass Spike lock-step cosim on all directed tests with the RAM_DIFF=1 memory cross-check, and on every Embench-IoT program (make eval).
  • Performance: each Embench-IoT program is run whole against the DRAM model, clocked at the Fmax your make pd measured, and the geometric mean of their IPC (instructions retired / cycles) must be at least 1.5 (make embench).
  • Physical design: take core_pnr from RTL to GDSII with OpenROAD-flow-scripts on ASAP7 at the TT corner using make pd, with your settings in /app/pd/config.mk. Sign-off must be clean: no detailed-route DRC or antenna violations, no hold or max slew/cap/fanout violations, and a fully constrained design.
  • Fmax: must be at least 1300 MHz, where Fmax = 1 / (clock period − worst setup slack) from make pd sign-off.
  • Die area: the routed core_pnr must be at most 46000 µm² (make pd reports it).
  • Netlist binding: the netlist that ORFS builds must behave identically to the RTL you verified (make check-netlist).
  • RTL content: no file in /app/rtl may use DPI imports or exports, $system, $fopen, $writememh/$writememb, $dump*, Verilator $c, or `systemc_* blocks.

Only /app/rtl and /app/pd are collected. The grader re-runs make eval, make pd and make check-netlist from a clean copy of the workspace with your rtl/ and pd/; make pd gets 8 CPUs and fails if it has not finished within 4.5 hours. The design must meet every requirement above.

You have 21600 seconds to complete this task. ps -o etimes= -p 1 prints the seconds elapsed since your environment started; check it regularly rather than estimating. If any requirement is still unmet, do not stop: keep working until the time is nearly used up. Keep /app/rtl and /app/pd ready to submit, since they are collected as they stand when time runs out. Do not cheat by using online solutions or hints specific to this task.

rv32cpu task

Task

Implement a rv32i_zmmul_zicsr RISC-V CPU, verify it against the provided tests and the Embench-IoT benchmarks using the cosim environment, and take it from RTL to a DRC-clean GDSII with OpenROAD-flow-scripts (ORFS) on ASAP7 at the TT corner.

The same design must also meet these requirements:

  • Embench IPC ≥ 1.5: the geometric mean, over the Embench-IoT programs, of each program's IPC (instructions retired / cycles) when run whole against the DRAM model, clocked at the design's measured Fmax (make embench, docs/SCORING.md).
  • Fmax ≥ 1300 MHz, where Fmax = 1 / (clock period − worst setup slack) from sign-off STA of the routed design (make pd).
  • Die area ≤ 46000 µm² for the routed core_pnr (make pd).

Quickstart

source env/setup_env.sh   # pin the toolchain on PATH (RISC-V gcc + Spike in $RISCV/bin)
make check-env            # hard-gate tool versions vs VERSIONS.lock (fails loudly on drift)
make smoke                # RTL-free sign of life with the shipped stub (~1 min)

# after implementing `module core` and listing its sources in rtl/design.mk:
make eval                 # cosim (RAM_DIFF=1) + Embench
make pd                   # RTL -> GDSII + sign-off (route DRC, antenna, STA) -> build/pd/pd_report.json
make check-netlist        # the ORFS-elaborated netlist matches the RTL cycle-for-cycle

Every command assumes source env/setup_env.sh was run first. make help lists all targets.

What you implement

The body of module core (replace rtl/core_stub.sv, or add your own files), honoring docs/INTERFACE_CONTRACT.md: a 64-byte line port to a DRAM model with variable latency (build your own caches, from the provided fakeram SRAM macros or flops), a 1-cycle port to the uncached I/O page, an end-of-run write-back handshake, a configurable in-order commit width, synchronous active-high reset, and the commit_* retire-trace semantics. ISA is RV32I + Zmmul + minimal Zicsr (-march=rv32i_zmmul_zicsr, Spike --isa=rv32i_zmmul_zicsr_zicntr). core_pkg.sv and core_pnr.sv are provided complete — do not change their public API (core_pnr.sv is replaced by the original at grading).

rtl/design.mk is the single description of your design used by every flow and by the grader: RTL_SRCS (your sources under rtl/, in compile order, including rtl/core_pkg.sv) and COMMIT_LANES. pd/config.mk holds your ORFS settings. Only rtl/ and pd/ are collected for grading; everything else in the workspace is restored to its original state.

Physical design

make pd (scripts/pd/run_pd.py) runs ORFS on core_pnr exactly as the grader does:

  • platform asap7, CORNER=TC (typical libraries), NLDM, the slang SystemVerilog front end (-D SYNTHESIS), ORFS logic-equivalence checking (LEC_CHECK=1) between the synthesized and final netlists;
  • sources, include dir and VERILOG_TOP_PARAMS come from rtl/design.mk;
  • the SDC is generated: clock clk with period CLOCK_PERIOD_PS; core_pnr forwards it to the memory system on its mem_clk output (a generated clock), and all other inputs and the line-port, I/O-port and flush_done outputs have a 100 ps external delay against mem_clk as it leaves the core: inputs are valid 100 ps after its edge, and outputs must arrive 100 ps before the next one; rst is a false path;
  • the flow always provides the ASAP7 fakeram SRAM macros (docs/INTERFACE_CONTRACT.md 8.1) to synthesis and placement; rtl/ instantiates the ones it wants;
  • pd/config.mk may set only the knobs in KNOBS in scripts/pd/run_pd.py (clock period, synthesis options, utilization/density, VT selection via ASAP7_USE_VT, repair and CTS options, macro placement, ...). No Tcl hooks, extra files, or extra libraries/macros are accepted. Unless set, SLEW_MARGIN and CAP_MARGIN default to 50 and 25: the percent by which ORFS repair_design over-fixes slew and capacitance, since it works from pre-route parasitic estimates that run below the extracted values sign-off uses. The line port puts about 1,160 pins on the die edge; at the default pin spacing they can congest global routing next to the logic they connect to, which wider spacing in PLACE_PINS_ARGS (e.g. -min_distance 4 -min_distance_in_tracks) relieves;
  • outputs go to build/pd/ (ORFS results/, reports/, logs/ under it). --keep (make pd PD_ARGS=--keep) reuses an existing run directory so ORFS only redoes out-of-date steps; the grader always starts clean. For experiments you can also drive ORFS directly with the generated build/pd/config.mk.

Sign-off (scripts/pd/signoff.tcl, on the routed design with OpenRCX parasitics) requires all of: the flow completes and writes a GDS; zero detailed-route DRC violations (OpenROAD's router checks against the ASAP7 tech LEF rules, which is ORFS's DRC sign-off for this platform); zero antenna violations; hold slack ≥ 0; zero max slew/capacitance/fanout violations; and a fully constrained design (check_setup reports nothing: every register clocked by clk, no combinational loops). Fmax is then 1e6 / (CLOCK_PERIOD_PS − setup WNS) MHz. Sign-off STA uses the propagated clock tree: register-to-register paths include clock skew, and I/O paths are timed against the actual mem_clk edge at its port, which leaves through the clock tree like any register clock. The die area (die_area_um2 in pd_report.json) is the area of the routed design's die box, which CORE_UTILIZATION, CORE_ASPECT_RATIO and CORE_MARGIN size from the synthesized cell area, macros included.

make check-netlist (scripts/pd/check_netlist.py) proves that what ORFS builds is what you verified: it takes ORFS's own elaboration of core_pnr (same front end, defines and parameters), flattens it to a generic gate netlist and runs every directed test and Embench-IoT program on it in tb_top, with the fakeram macros simulated by sim/fakeram.sv as in RTL simulation. I/O-port store streams, the final DRAM contents, console output and the HTIF exit cycle must match the RTL core simulation exactly. Latches are rejected, and synthesis ignores initial values (reset state explicitly). Logic that differs between simulation and synthesis (e.g. ifdef SYNTHESIS, or behavior that depends on COMMIT_LOG) fails this check.

Grading

The grader starts from a clean copy of this workspace plus your rtl/ and pd/, then runs make eval (all directed tests with RAM_DIFF=1, and Embench), make pd, and make check-netlist, and finally measures Embench IPC (make embench-ipc) with the DRAM timed at the Fmax its make pd measured. make pd gets 8 CPUs and fails if it has not finished within 4.5 hours. The task passes only if every requirement is met.

Toolchain (pinned; gated by make check-env, authoritative strings in VERSIONS.lock)

ToolVersion
Verilator5.032
Spike1.1.1-dev
riscv32-unknown-elf-gcc16.1.0
python33.14.4
pip25.2
ORFS (OpenROAD, Yosys, KLayout)openroad/orfs:26Q4-421-g73c804d45 at /OpenROAD-flow-scripts
Ramulator 2 (DRAM model)commit 7bead6cb at /opt/ramulator2

The self-eval flows use only the Python standard library + a hand-rolled C++ ELF loader — no vcdvcd, numpy, pandas, pyelftools, or cocotb.

Layout

env/     version/PATH gate (check_env.sh, setup_env.sh); VERSIONS.lock (repo root) pins versions
rtl/     core_pkg.sv, core_stub.sv (replace), core_pnr.sv, design.mk (your source list + width)
pd/      config.mk (your ORFS knobs)
sim/     Spike lock-step cosim harness (tb_top.cpp + dram.cpp + fakeram.sv + cosim_diff.py + run_cosim.sh)
sw/      bare-metal runtime, directed test ladder, Embench-IoT (embench/: src/, build/ ELFs, build.sh)
docs/    interface contract and scoring
scripts/ pd/ (ORFS flow, sign-off, netlist check)
DocCovers
docs/INTERFACE_CONTRACT.mdthe binding core interface (ports, memory system, fakeram macros, reset, commit trace, ISA)
docs/SCORING.mdhow Embench IPC is measured (task grading is under "Grading" above)

Grading & Reference Solution

How the submission is scored, and a human expert-authored reference solution.

rubric

Gates

G1Submission correctness
Pass / fail

rtl/ and pd/ well formed; RTL uses no forbidden construct.

  • design.mk valid · Lists existing .sv/.v sources under rtl/ (RTL_SRCS) and a positive COMMIT_LANES.
  • config.mk valid · Sets CLOCK_PERIOD_PS and only allowed ORFS knobs, each in range; no Tcl hooks, extra files or libraries.
  • RTL content rules · No DPI, $system, $fopen, $writemem*, $dump*, Verilator $c or `systemc_* in rtl/ (comments ignored).
G2Design integrity
Pass / fail

Matches Spike over DRAM; clean sign-off; ORFS netlist is the verified RTL.

  • Directed cosim · 15 directed tests match Spike to exit; RAM_DIFF=1 checks I/O stores and final RAM after cache flush.
  • Embench-IoT lock-step · 19 Embench-IoT programs match Spike to exit against the DRAM model.
  • Flow completes · make pd: OpenROAD-flow-scripts on core_pnr (ASAP7, typical corner) through GDSII and sign-off.
  • Route DRC clean · Detailed-route DRC violations against the ASAP7 tech LEF rules.
  • Antenna clean · Nets with antenna violations.
  • Hold met · Sign-off hold slack on the routed design with OpenRCX parasitics.
  • No design-rule violations · Max slew, max capacitance and max fanout violations at sign-off.
  • Fully constrained · check_setup: no unconstrained paths, every register clocked by clk, no combinational loops.
  • Fmax measured · Fmax = 1e6 / (CLOCK_PERIOD_PS − setup WNS) MHz, from sign-off slack.
  • Netlist matches RTL · ORFS gate netlist runs all tests and programs; bus traffic, console, exit cycle equal RTL's; no latches.
G3Benchmark performance
Pass / fail

Embench-IoT instructions per cycle at the reached clock.

  • Embench IPC · Geometric mean over 19 programs of instructions / cycles to exit store, DRAM timed at measured Fmax, clean exits.

Scored Categories

H1Physical attributes
100%

Clock rate and area, in one check.

  • Fmax and die area · Fmax from sign-off setup slack (only if clean); die area of routed core_pnr, macros included.
Reference layout