A computer, compiled into the weights of a language model. An exact CPU inside Qwen3.5-4B, with Gated DeltaNet state as RAM.
RISC-V calc firmware: zero every bignum register at the start of each call (later calls in a session could print digits left by the previous call)
Divyansh Agrawal80e0dde0e4d2
diff --git a/experimental/riscv/chipformer/rv/env/calc/calc.c b/experimental/riscv/chipformer/rv/env/calc/calc.cindex 79a1a33..29ac667 100644--- a/experimental/riscv/chipformer/rv/env/calc/calc.c+++ b/experimental/riscv/chipformer/rv/env/calc/calc.c@@ -385,6 +385,10 @@ static int apply(int op, int nv) { // returns the new value countstatic int calc_eval(void) { // prints the value (or "error") and a newline; 0 on successused = 0;err = 0;+ for (int r = 0; r < ONE; r++) { // every call starts clean: no digits left by the last one+ bn_mac(BN_OPS(63, 0, 0, r, r, 1));+ dirty[r] = 0;+ }bn_ld(&one_ch + 1, BN_OPS(1, 0, 0, ONE, 0, 0));const char *s = calc_in;int operand = 1, nv = 0, no = 0; // operand: an operand (or a prefix) comes nextdiff --git a/experimental/riscv/tests/data/rv/calc-bridge.elf b/experimental/riscv/tests/data/rv/calc-bridge.elfindex 32a4c30..6698dd4 100644Binary files a/experimental/riscv/tests/data/rv/calc-bridge.elf and b/experimental/riscv/tests/data/rv/calc-bridge.elf differdiff --git a/experimental/riscv/tests/data/rv/calc.elf b/experimental/riscv/tests/data/rv/calc.elfindex d9dea98..aeaa4c4 100644Binary files a/experimental/riscv/tests/data/rv/calc.elf and b/experimental/riscv/tests/data/rv/calc.elf differ