Mintwright

Bitwright

Bit-width, Q-format and IEEE 754 engineering calculator. Exact arithmetic.

Open Bitwright Calculator

Bitwright is a calculator for RTL, FPGA and DSP engineers, and for programmers who work at the bit level: the widths, formats and conversions that otherwise take three browser tabs, in one app, computed exactly.

  • Two's-complement integers at any width from 1 to 512 bits, with the signed and unsigned readings shown together.
  • Integer and fixed-point results are exact at any size. A result with no exact form is computed to 50 significant digits and marked ≈.
Bitwright on a phone in Prog mode at width 128: a hexadecimal result, its signed and unsigned readings, and the bit grid.

Features

Q mode at width 16 with 15 fraction bits: the rows 0.1 * 3 giving 0.3 and 1 / 3 giving 0.3333…, the value in s16Q0.15 and as hex 0x2A_AB, and the flag inexact with error 10.2e-6 (-99.8 dBFS).
Fixed point. s16Q0.15 with its LSB and range, and the quantization error of 1/3 in dBFS.
Prog mode at width 32: the rows a = 24'shFF8000 giving 0xFFFF8000, a[15:8] giving 0x80, {4'hA, 4'hB} giving 0xAB and {4{2'b10}} giving 0xAA.
Verilog notation. A sized literal, a part-select, concatenation and replication, typed as in code.
IEEE mode with binary32: the rows bits(0x3DCCCCCD, f32) giving 0.10000000149011611938… and e4m3(0.1) giving 0.1015625 with error 1/640, and the sign, exponent, mantissa and hex fields of the E4M3 result.
IEEE 754 down to FP8. A binary32 pattern read as a float, and 0.1 rounded to E4M3 with its sign, exponent, mantissa and hex.
Prog mode at width 32 after three lines were pasted: CTRL = 0x0000_0201, STATUS = 0x8000_0040 and MASK = 0xFFFF_0000, one row each, with the flag 3 lines pasted; one row each.
Paste a register dump. Three NAME = hex lines pasted at once give one row each.
Calc mode: 2 ** 100 giving 1267650600228229401496703205376, 1 / 3 giving 0.33333333333333…, sqrt(2) giving ≈ 1.41421356237309…, and the flag that the result is approximate, correct to 50 significant digits.
Exact arithmetic. 2**100 to the last digit. sqrt(2) has no exact form, so it is computed to 50 significant digits and marked ≈.
Prog mode at width 8: s8(300, SAT) giving 127 and s8(-200, SAT_SYM) giving -127, both flagged cast overflowed, and s8(2.5, HALF_EVEN) giving 2, flagged cast inexact with error -1/2.
Rounding and overflow modes, by name. Ten rounding modes and four overflow modes, chosen per cast. A cast that overflows or rounds is flagged.
Calc mode: crc32 of the ASCII string 123456789 giving 3421780262, lfsr(16) giving 53256 with taps 16, 15, 13, 4 and period 2^16-1, and pll(100, 125) giving M/N/D = 5/1/4, exact.
CRC, LFSR, PLL solver. The CRC-32 check value, a 16-bit LFSR's taps and period, and M/N/D for 100 to 125. No ads, no account; works offline after the first visit.

What it does

Widths and formats

Exact arithmetic

No floating-point rounding hides in the arithmetic. Integer and fixed-point results are exact at any size. Results that have no exact form are computed to 50 significant digits and marked ≈.

HDL notation

Verilog operators and idioms as typed in code: part-select x[15:8], concatenation {a, b}, replication {4{a}}, sized literals such as 24'shFF8000, VHDL bit strings such as x"FF"; sext, zext, narrow and bits(x, T); rotates, popcount, clz, ctz, bitrev, bswap.

Functions

Gray, one-hot, alignment, LFSR taps for widths 2 to 32, CRC with nine presets or your own polynomial; clock period, frequency, ppm and a PLL M/N/D solver.

The web edition

The web edition is Bitwright as a web app. It runs in the browser at bitwright.mintwright.app on an iPhone (iOS 17 or later), on Android and on a desk. It installs to the home screen and works offline after the first visit.

Buy

US $9.99, one-time, plus tax where it applies.

Buy the licence key

  1. Pay at the checkout.
  2. Copy the whole licence key from the receipt. Keep that e-mail: it is your record of the key. If it is lost, write to [email protected] from the address you bought with.
  3. Open the calculator and enter the licence key once. The key is checked on your device and never sent anywhere.
  4. To use it again, open the calculator the same way, or from its icon once installed. The app remembers the key on that device and opens straight in, online or offline.

Install