# Design This file fixes the circuits, the timings and the dumps a build must match. The toolchain can vary, as long as the numbers here hold. ## Rounding Decimal, `digits` significand digits, round half-up, as in the vector file. Angles for trig are degrees, unless the file says radians. ## Vectors Each vector is: a sequence of keystrokes or opcodes, the expected stack or display, and flags. The file is the authority. ## Display A dumped 7-segment or a character buffer, rendered as a still. The mapping is in `fixtures/calc-display.json`. ## Inputs | Key | Label | Default | Notes | | --- | --- | --- | --- | | `digits` | Decimal digits | 8 | From 6 to 12, the calculator's significand. | | `stack` | Stack depth | 4 | From 2 to 8, a stack calculator. | | `trig` | Trigonometry | on | Sine, cosine, and a documented angle unit. | | `log` | Log and exp | on | A natural log and an exp, as in the file. | | `sim` | Simulator | verilator | Either must pass the same testbench vectors. | ## Acceptance at the defaults A calculator in HDL that works in 4-bit digits (or a documented BCD width). The testbench feeds key codes and reads a display register. | Quantity | Value | Tolerance | Source | | --- | --- | --- | --- | | Digit width | 4 bits | exact | BCD nibble | | Display width | 8 digits | 0 | Plus a 1-bit overflow flag | | Operations | +, −, ×, ÷ | — | Integer, documented rounding | | Sine at 0, 30, 90 degrees | 0.000, 0.500, 1.000 | 0.002 | When `trig` is on, degrees | | ln(1), exp(0) | 0.000, 1.000 | 0.002 | When `log` is on | A table of at least twelve calculations, including overflow and divide-by-zero, is the authority. The testbench applies them and checks the display register. No board and no seven-segment hardware are required; a dumped waveform or a register log is enough. ## Screenshots These pictures are dumps of a working reference model of the core, in `reference/preview.py`, at the default inputs. They are not drawings of a product that has not been built or simulated. The first picture is the one Spekkr shows on the spec's card. A build may ship its own goldens; those goldens are of that build and do not have to match these frames pixel-for-pixel. | File | What it shows | | --- | --- | | `shots/sine-30.png` | Display sin 30° = 0.500, eight BCD digits | | `shots/ln-1.png` | Display ln(1) = 0.000, eight BCD digits | ## How to verify 1. Run the simulation or the HDL testbench at the defaults, with no physical board. 2. Compare periods, trip points, register dumps or frames to the acceptance table in this file. 3. Corrupt one documented value on purpose and confirm the check fails. 4. A testbench of documented operations (arithmetic, stack, optional trig and log, and error cases) matches a vector file, with stated rounding. Display stills are written from a dumped register. No FPGA and no handheld are required.