|
2 | 2 |
|
3 | 3 | Svelte-based interactive tutorial shell for SystemVerilog, SVA, and UVM. |
4 | 4 |
|
5 | | -## CIRCT Fork |
| 5 | +## Reproducible Requirements |
6 | 6 |
|
7 | | -This project is pinned to the CIRCT fork with wasm support: |
| 7 | +Pinned versions are centralized in `scripts/toolchain.lock.sh`: |
8 | 8 |
|
9 | | -- `git@github.com:thomasnormal/circt.git` |
| 9 | +- Node major: `22` |
| 10 | +- Emscripten (emsdk): `4.0.21` |
| 11 | +- CIRCT repo: `https://github.com/thomasnormal/circt.git` |
| 12 | +- CIRCT ref: `8e8ca87dcda1c8abd47103ae7789c8ed261d5de3` |
| 13 | +- LLVM submodule ref: `972cd847efb20661ea7ee8982dd19730aa040c75` |
| 14 | + |
| 15 | +Host tools: |
| 16 | + |
| 17 | +- `git` |
| 18 | +- `node`/`npm` (Node 22.x) |
| 19 | +- `cmake` (>= 3.24) |
| 20 | +- `ninja` (>= 1.10) |
| 21 | +- `python3` (>= 3.10) |
| 22 | +- `rsync` |
| 23 | +- `unzip` |
| 24 | + |
| 25 | +Check prerequisites: |
| 26 | + |
| 27 | +- `npm run check:req` (frontend/tooling only) |
| 28 | +- `npm run check:req:wasm` (includes emsdk/emcc verification) |
| 29 | + |
| 30 | +## Reproducible Local Build |
| 31 | + |
| 32 | +1. Activate emsdk `4.0.21` (or ensure `emcc -v` reports `4.0.21`). |
| 33 | +2. Run the one-shot bootstrap: |
| 34 | + - `npm run bootstrap:repro` |
| 35 | + |
| 36 | +Equivalent step-by-step: |
| 37 | + |
| 38 | +1. `npm ci` |
| 39 | +2. `scripts/setup-surfer.sh` |
| 40 | +3. `npm run setup:circt` |
| 41 | +4. `npm run build:circt` |
| 42 | +5. `npm run sync:circt` |
| 43 | +6. `npm run build` |
| 44 | + |
| 45 | +The CIRCT wasm build script enforces conservative resource limits by default: |
| 46 | + |
| 47 | +- Ninja parallelism: `CIRCT_WASM_JOBS=4` |
| 48 | +- Configure timeout: `CIRCT_WASM_CONFIGURE_TIMEOUT_MIN=30` |
| 49 | +- Build timeout: `CIRCT_WASM_BUILD_TIMEOUT_MIN=120` |
| 50 | +- Force clean build dir first: `CIRCT_WASM_CLEAN_BUILD=1` |
| 51 | +- Build targets override: `CIRCT_WASM_TARGETS="circt-verilog circt-sim circt-bmc"` |
| 52 | +- Optional virtual memory cap: `CIRCT_WASM_MEMORY_LIMIT_KB=<kb>` |
| 53 | + |
| 54 | +To also build `circt-sim-vpi` (required for cocotb lessons): |
| 55 | + |
| 56 | +``` |
| 57 | +CIRCT_WASM_TARGETS="circt-verilog circt-sim circt-bmc circt-sim-vpi" npm run build:circt |
| 58 | +``` |
10 | 59 |
|
11 | 60 | ## Scripts |
12 | 61 |
|
13 | | -- `npm install` |
14 | 62 | - `npm run dev` |
15 | | -- `npm run build` |
16 | 63 | - `npm run preview` |
17 | | -- `scripts/setup-circt.sh` (clone/update the CIRCT fork checkout) |
18 | | - |
19 | | -## CIRCT WASM Runtime Setup |
20 | | - |
21 | | -1. Clone/update the fork checkout: |
22 | | - - `scripts/setup-circt.sh` |
23 | | -2. Build wasm artifacts from that checkout. |
24 | | -3. Copy artifacts into this app: |
25 | | - - `cp vendor/circt/build-wasm/bin/circt-verilog.js public/circt/circt-verilog.js` |
26 | | - - `cp vendor/circt/build-wasm/bin/circt-verilog.wasm public/circt/circt-verilog.wasm` |
27 | | - - `cp vendor/circt/build-wasm/bin/circt-sim.js public/circt/circt-sim.js` |
28 | | - - `cp vendor/circt/build-wasm/bin/circt-sim.wasm public/circt/circt-sim.wasm` |
29 | | - - `cp vendor/circt/build-wasm/bin/circt-bmc.js public/circt/circt-bmc.js` |
30 | | - - `cp vendor/circt/build-wasm/bin/circt-bmc.wasm public/circt/circt-bmc.wasm` |
31 | | -4. Runtime artifact lookup order: |
32 | | - - `public/circt/circt-verilog.js` |
33 | | - - `public/circt/circt-verilog.wasm` |
34 | | - - `public/circt/circt-sim.js` |
35 | | - - `public/circt/circt-sim.wasm` |
36 | | - - `public/circt/circt-bmc.js` |
37 | | - - `public/circt/circt-bmc.wasm` |
38 | | -5. Optional mock shim (explicit opt-in only): |
39 | | - - `public/circt/circt.js` |
40 | | - - `public/circt/circt.wasm` |
41 | | - - not used by default runtime |
42 | | -6. Optional URL overrides in `.env`: |
43 | | - - `VITE_CIRCT_VERILOG_JS_URL` |
44 | | - - `VITE_CIRCT_VERILOG_WASM_URL` |
45 | | - - `VITE_CIRCT_SIM_JS_URL` |
46 | | - - `VITE_CIRCT_SIM_WASM_URL` |
47 | | - - `VITE_CIRCT_BMC_JS_URL` |
48 | | - - `VITE_CIRCT_BMC_WASM_URL` |
49 | | - - `VITE_CIRCT_VERILOG_ARGS` |
50 | | - - `VITE_CIRCT_SIM_ARGS` |
51 | | - - `VITE_CIRCT_BMC_ARGS` |
52 | | - |
53 | | -## Notes |
54 | | - |
55 | | -- This repo currently includes a starter tutorial UI and lesson data model. |
| 64 | +- `npm run test:e2e` |
| 65 | +- `npm run setup:circt` |
| 66 | +- `npm run build:circt` |
| 67 | +- `npm run sync:circt` |
| 68 | +- `npm run bootstrap:repro` |
| 69 | + |
| 70 | +## Optional Runtime Overrides |
| 71 | + |
| 72 | +In `.env` (copy `.env.example`): |
| 73 | + |
| 74 | +- `VITE_CIRCT_VERILOG_JS_URL` |
| 75 | +- `VITE_CIRCT_VERILOG_WASM_URL` |
| 76 | +- `VITE_CIRCT_SIM_JS_URL` |
| 77 | +- `VITE_CIRCT_SIM_WASM_URL` |
| 78 | +- `VITE_CIRCT_BMC_JS_URL` |
| 79 | +- `VITE_CIRCT_BMC_WASM_URL` |
| 80 | +- `VITE_CIRCT_SIM_VPI_JS_URL` (cocotb lessons) |
| 81 | +- `VITE_CIRCT_SIM_VPI_WASM_URL` (cocotb lessons) |
| 82 | +- `VITE_PYODIDE_URL` (cocotb lessons, default: jsdelivr CDN) |
| 83 | +- `VITE_CIRCT_VERILOG_ARGS` |
| 84 | +- `VITE_CIRCT_SIM_ARGS` |
| 85 | +- `VITE_CIRCT_BMC_ARGS` |
| 86 | + |
| 87 | +## Runtime Notes |
| 88 | + |
56 | 89 | - Runtime uses a real 2-stage wasm toolchain by default: |
57 | 90 | - `circt-verilog` lowers SV/SVA/UVM source to MLIR |
58 | 91 | - `circt-sim` executes lowered MLIR and emits VCD for the waveform pane |
59 | 92 | - Tool invocations run in isolated Web Workers to avoid global Emscripten symbol collisions and re-entry issues. |
60 | | -- The UI includes a `self-check` action in the Runtime panel to validate artifact compatibility. |
61 | | -- Waveform pane is metadata-driven (`off`, `optional`, `required`) and prepared for Surfer integration. |
| 93 | +- UI includes a `self-check` action in the Runtime panel to validate artifact compatibility. |
| 94 | +- Waves tab appears automatically only when a valid VCD is generated. |
| 95 | + |
| 96 | +## CI |
| 97 | + |
| 98 | +- `.github/workflows/ci.yml` builds with pinned toolchain requirements: |
| 99 | + 1. install Node 22 |
| 100 | + 2. install emsdk 4.0.21 |
| 101 | + 3. run `scripts/setup-circt.sh` (pinned CIRCT ref) |
| 102 | + 4. run `scripts/build-circt-wasm.sh` |
| 103 | + 5. run `npm run sync:circt` |
| 104 | + 6. run `npm run build` |
| 105 | + |
| 106 | +## E2E |
| 107 | + |
| 108 | +- `npm run test:e2e -- e2e/waveform.spec.js` |
| 109 | +- Includes: |
| 110 | + - non-mock pipeline check (`circt-verilog` + `circt-sim`, waveform generated) |
| 111 | + - Surfer waveform render check when browser WebGL support is available in the test environment |
0 commit comments