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

PortDirectionTypeDescription
patternout4-bit vectorStartup pattern for the 4-LED bar
addrout8-bit vectorThe controller's bus address
maskout8-bit vectorChannel enable mask
max_levelout4-bit vectorHighest 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.

PortWidthDatasheet valueWrite it in
pattern4 bitsdecimal 9 (two outermost LEDs lit)binary
addr8 bitsdecimal 90hex
mask8 bitsdecimal 15 (low four channels enabled)hex
max_level4 bitsthe largest value 4 bits can holdbinary

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

STRUCTURE

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
Loading editor...

Click Run to execute your code. Output will appear here.