Bus Width Adapter
A 16-bit backbone bus connects to a stack of older 4- and 8-bit parts, and all the glue between them is pure wiring. You are building the adapter. It packs a header and payload into the backbone's word format, tiles a diagnostic pattern across a 16-LED strip, and fixes the byte order of incoming words.
Interface
| Port | Direction | Type | Description |
|---|---|---|---|
hdr | in | 4-bit vector | Header nibble |
pay | in | 8-bit vector | Payload byte |
word | out | 16-bit vector | Packed backbone word |
pat | in | 4-bit vector | Diagnostic test pattern |
led | out | 16-bit vector | 16-LED strip drive |
bus_in | in | 16-bit vector | Word arriving from the backbone |
swap | out | 16-bit vector | bus_in with its bytes swapped |
Behavior
-
wordfollows the backbone's word layout exactly:Bits Field 15–12 hdr11–8 constant 0000(reserved)7–0 pay -
ledcarriespatrepeated four times: bits 15–12, 11–8, 7–4, and 3–0 each show the pattern -
swapcarriesbus_inwith its two bytes exchanged: bits 15–8 ofswapare bits 7–0 ofbus_in, and bits 7–0 ofswapare bits 15–8 ofbus_in
Constraints
concatenation (and replication, where your language has it) only; no logic operators, no arithmetic.
one concurrent assignment per output; no processes or always blocks.
Click Run to execute your code. Output will appear here.