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. Real datasheets mix binary, decimal, and hex notation, so this one does too. Your job is to convert each value and write it as a literal of the requested base and width.

Interface

PortDirectionTypeDescription
pattern_oout4-bit vectorStartup pattern for the 4-LED bar
addr_oout8-bit vectorThe controller's bus address
mask_oout8-bit vectorChannel enable mask
max_level_oout4-bit vectorHighest brightness level the chip supports

Behavior

Each row takes a different route between number bases:

PortWidthDatasheet valueWrite it inConversion
pattern_o4 bitshex C (two leftmost LEDs lit)binaryhex to binary
addr_o8 bitsdecimal 90hexdecimal to hex
mask_o8 bitsbinary 0101 0101 (even-numbered channels enabled)hexbinary to hex
max_level_o4 bitsdecimal 13binarydecimal to binary

The testbench reads all four outputs once and compares each against its decimal value. The requested spelling is still part of the specification: use binary where the table says binary and hex where it says hex.

Constraints

STRUCTURE: drive every output with a single assignment outside a procedural block 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.