HDLbits

Hardware Language/Procedures

Procedures

always blocks, if/else, case, and loops.

  1. 1

    Always Blocks: Combinational

    Implement the two-input AND function twice: once as a concurrent assignment and once in a combinational process. Both outputs must match for every input combination.

    easy
  2. 2

    Priority Encoder (if/else)

    Build a 4-to-2 priority encoder using cascaded if/else inside a combinational always block.

    medium
  3. 3

    3-to-8 Decoder (case statement)

    Build a 3-to-8 one-hot decoder using a case statement inside a combinational always block.

    medium
  4. 4

    Always Blocks: Clocked

    Implement the same XOR function three ways: a concurrent assignment, a combinational process, and a clocked process that updates only on the rising edge of `clk`. The clocked output is therefore registered.

    easy
  5. 5

    Population Count (for loop)

    Count the number of set bits in an 8-bit vector using a for loop inside a combinational always block.

    medium
  6. 6

    Min/Max of Four Values

    Compute both the minimum and maximum of four 4-bit inputs using comparisons inside a combinational always block.

    medium
  7. 7

    If Statement: Conditional Selection

    Select `b` only when both `sel_b1` and `sel_b2` are high; otherwise select `a`. Implement the same behavior as both a concurrent conditional assignment and a combinational process.

    easy
  8. 8

    Transparent Latch

    Describe a level-sensitive latch with an enable.

    medium
  9. 9

    Case-Based Multiplexer

    Select one of four input vectors using a two-bit selector.

    easy
  10. 10

    Priority Encoder with Wildcards

    Encode the highest-priority active request and report whether one exists.

    medium
  11. 11

    Complete Combinational Decode

    Decode a two-bit selector into a complete one-hot output.

    easy
  12. 12

    If Statement: Avoiding Latches

    Fix both incomplete conditionals so they describe combinational logic. Shut off the computer only when it is overheated. Keep driving only while you have not arrived and the gas tank is not empty; drive output must be 0 in all other cases.

    easy