Skip to content

WASM emulator demo support#3869

Draft
swenson wants to merge 5 commits into
chipsalliance:mainfrom
swenson:wasm
Draft

WASM emulator demo support#3869
swenson wants to merge 5 commits into
chipsalliance:mainfrom
swenson:wasm

Conversation

@swenson

@swenson swenson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR collects the caliptra-sw changes needed to run Caliptra in a
browser via WebAssembly. They back the standalone WASM emulator demo at
https://swenson.github.io/caliptra-wasm/ (source:
https://github.com/swenson/caliptra-wasm).

Note: This branch (swenson:wasm) is intentionally out of date
relative to main. It is opened as a draft so others can review the
current state of the WASM-enabling changes, not as a ready-to-merge PR.
The WASM demo currently pins this work at commit 0615298.

What's here

The substantive emulator/model changes that the WASM build depends on:

  • sw-emulator/.../key_vault.rs – Add a KeyVault snapshot accessor so
    the demo UI can display key-vault state, and fix a snapshot panic
    (keys storage is padded to 2048 bytes).
  • hw-model/ – Expose the snapshot accessor through ModelEmulated
    / the HwModel trait, plus the dependency wiring needed to build for
    wasm32-unknown-unknown.
  • Lifecycle flexing – Allow booting straight to FW in the emulated model
    for the demo flow.

Plus an early embedded prototype of the demo itself under wasm-demo/. That
prototype has since graduated into the standalone
caliptra-wasm repository; it is
included here only for historical context and is not intended to live in
caliptra-sw long-term.

Commits

  • Add WASM demo
  • WASM demo core FW
  • Flex lifecycle; boot to FW
  • Add KeyVault snapshot accessor for WASM demo UI
  • Fix KeyVault::snapshot panic (keys storage padded to 2048 bytes)

Why open it now

Folks have asked to see the current state of the WASM-enabling changes. This
draft makes them reviewable in one place even though the branch needs a
rebase onto current main before it could merge.

swenson added 5 commits March 24, 2026 10:47
Adds KeyVault::snapshot() and KeyVaultSnapshot struct exposing key
data, PCRs, and control register state for external inspection.
ModelEmulated::key_vault_snapshot() forwards the call so WASM
consumers can display the keyvault contents in real time.
self.keys is a ReadWriteMemory<2048> (KEY_REG_SIZE = 0x800) but only
24 keys × 64 bytes = 1536 bytes are valid. Slicing the source down
to the valid portion avoids the copy_from_slice length mismatch
panic.
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 11, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant