Learn
Practice
Power-Up Defaults in Binary and Hex
A small LED controller chip must present fixed configuration values the moment power arrives: no processor loads them; they are wire bundles permanently connected to constants. The datasheet gives each value in decimal. Your job is to convert each one and write it as a literal of the correct width.
Interface
| Port | Direction | Type | Description |
|---|---|---|---|
pattern | out | 4-bit vector | Startup pattern for the 4-LED bar |
addr | out | 8-bit vector | The controller's bus address |
mask | out | 8-bit vector | Channel enable mask |
max_level | out | 4-bit vector | Highest brightness level the chip supports |
Behavior
Everything each output needs is in its row: the width, the datasheet value, and the base to write the literal in.
| Port | Width | Datasheet value | Write it in |
|---|---|---|---|
pattern | 4 bits | decimal 9 (two outermost LEDs lit) | binary |
addr | 8 bits | decimal 90 | hex |
mask | 8 bits | decimal 15 (low four channels enabled) | hex |
max_level | 4 bits | the largest value 4 bits can hold | binary |
Converting those decimals is the exercise, using the lesson's method. Subtract the largest power of two that fits until nothing remains, then group the bits in fours for the hex ports. Decimal 90 starts with 64.
The testbench reads all four outputs once and compares each against its decimal value.
Constraints
drive every output with a single concurrent assignment and a literal: no operators, no conversion functions.
- Every literal's width must match its port exactly
Click Run to execute your code. Output will appear here.