gray_code
Convert binary values to Gray code or back, and generate n-bit Gray code sequences by specifying bit width and optional value.
Instructions
Convert between binary and Gray code, or generate n-bit Gray code sequences.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | Yes | Bit width (1-20) | |
| value | No | Optional value to convert (omit for full sequence) | |
| to_gray | No | If true convert binary to Gray; if false convert Gray to binary (default true) |