Bit Slice is a lightweight browser tool for inspecting hexadecimal data at the bit level: visualize bits, move an alignment window, search patterns, and re-slice the stream back into hex.
Live demo: sure-wang.github.io/bit-slice
When debugging FPGA logic, embedded protocols, register payloads, packet dumps, or binary logs, the annoying part is often not conversion itself. It is answering:
- Which bit am I aligned to?
- What does this window become in hex?
- Where does this Verilog-style pattern occur?
- Did I shift by one bit?
Bit Slice keeps those answers visible without asking you to set up a project, install dependencies, or paste data into a heavy editor.
- Small by default: one static HTML file, easy to host on GitHub Pages and easy to open locally.
- Precise over decorative: the UI favors bit positions, window ranges, match counts, and current values over visual noise.
- Fast feedback: paste hex, drag the start bit, adjust width, and see the result immediately.
- Readable data: bits are lightly grouped, matches are highlighted, and the current slice is framed.
- Friendly to first-time users: a built-in example shows the workflow without reading the README first.
- Hex input with validation, uppercasing, and a 512-character cap.
- Bit view with 4-bit grouping, current-window highlight, and match highlight.
- Slice window with start bit, width, end bit, match index, and current value status.
- Pattern matching for Verilog-style hex (
N'hXX), raw hex, or binary strings. - Slice results reassembled into hex groups, with copy actions for the current slice or full result.
- Input history saved locally with
localStorage.
Open the live demo or open index.html locally in any modern browser.
- Paste or enter hex data, for example
5E4D6EADA. - Move the start-bit slider and set the window width.
- Optionally search for a pattern such as
3'h5,8'hB7,B7, or10110111. - Read the status strip for
start,end,width,match, andvalue. - Copy the current slice or the full re-sliced result when needed.
- FPGA signal alignment and
rxdatainspection - Embedded protocol payload checks
- Register field and packed-bit analysis
- Packet or binary log debugging
- Teaching bit order, slicing, and alignment concepts
- Input: up to 512 hex characters, or 2048 bits.
- Window size: limited by the input length. Conversion uses
BigInt, so precision is not lost within the input cap. - Persistence: history is local to the browser through
localStorage; no data is uploaded.
This project intentionally stays simple:
index.htmlcontains the app.test.jscontains standalone logic tests.- No build step is required.
Run tests with:
node test.jsThe tests cover hex/binary conversion, Verilog-style parsing, bit sequence matching, slice reassembly, and edge cases.
MIT