HDLbits

Circuits/Combinational Logic

Combinational Logic

Gates, muxes, arithmetic, Karnaugh maps.

  1. 1

    Wire

    Connect a one-bit input directly to an output.

    easy
  2. 2

    2-to-1 Multiplexer (Gate-Level)

    Build a 2-to-1 multiplexer using only basic AND/OR/NOT gates instead of a behavioral assign statement.

    easy
  3. 3

    Ground

    Drive an output permanently low.

    easy
  4. 4

    4-to-1 Multiplexer

    Select one of four single-bit inputs with a 2-bit select signal.

    easy
  5. 5

    BCD to 7-Segment Display Decoder

    Decode a 4-bit BCD digit into the seven segment-drive signals of a 7-segment display.

    medium
  6. 6

    NOR

    Implement a two-input NOR gate.

    easy
  7. 7

    Another Gate

    Implement the two-input AND gate with the second input inverted.

    easy
  8. 8

    4-bit Priority Encoder

    Report the bit position of the highest set bit in a 4-bit input, with a valid flag for all-zero input.

    medium
  9. 9

    Karnaugh Map Function

    Implement the four-variable function from the Karnaugh map. Inputs are `x(4 downto 1)`, with columns labeled `x1x2` and rows labeled `x3x4`.

    medium
  10. 10

    Two Gates

    Cascade an XNOR gate and an XOR gate as shown.

    easy
  11. 11

    8-bit Magnitude Comparator

    Compare two 8-bit unsigned values and report equal, greater-than, and less-than as three one-hot flags.

    easy
  12. 12

    More Logic Gates

    Build independent NAND and NOR outputs.

    easy
  13. 13

    7420 Chip

    Model two independent four-input NAND gates.

    easy
  14. 14

    4-bit Barrel Shifter (Rotate Left)

    Rotate a 4-bit value left by a variable amount using a combinational barrel shifter.

    medium
  15. 15

    Two-Bit Equality

    Compare two two-bit values for equality.

    easy
  16. 16

    Simple Circuit A

    Implement a three-input function with an OR stage feeding an AND stage.

    easy
  17. 17

    Simple Circuit B

    Implement a sum-of-products Boolean function.

    easy
  18. 18

    Combine Two Circuits

    Combine two independently computed Boolean terms.

    medium
  19. 19

    Ring or Vibrate?

    Choose whether a phone rings or vibrates when a call arrives.

    easy
  20. 20

    Thermostat

    Drive heater and cooler controls from temperature and enable signals.

    easy
  21. 21

    3-Bit Population Count

    Count the one bits in a three-bit input.

    medium
  22. 22

    2-to-1 Bus Multiplexer

    Select one of two eight-bit buses.

    easy
  23. 23

    9-to-1 Multiplexer

    Select one of nine bits with a four-bit selector.

    medium
  24. 24

    256-to-1 Multiplexer

    Select one bit from a 256-bit input using an eight-bit index.

    medium
  25. 25

    256-to-1 4-Bit Multiplexer

    Select one four-bit word from 256 packed choices.

    hard
  26. 26

    3-Bit Binary Adder

    Add two three-bit unsigned numbers and expose the carry bit.

    easy
  27. 27

    32-Bit Adder

    Add two 32-bit unsigned operands with a carry-preserving result.

    medium
  28. 28

    Signed Addition Overflow

    Add signed bytes and flag when the mathematical result exceeds the signed range.

    medium
  29. 29

    100-Bit Binary Adder

    Add two 100-bit operands and preserve the final carry.

    medium
  30. 30

    4-Digit BCD Adder

    Add two four-digit packed BCD values with decimal carry propagation.

    hard
  31. 31

    3-Variable Karnaugh Map

    Implement the three-variable Boolean function shown by the K-map. The columns are input `a`; the rows are `bc` in Gray-code order.

    medium
  32. 32

    4-Variable Karnaugh Map 1

    Implement the four-variable function shown by the original Karnaugh map. Columns are `ab = 00, 01, 11, 10`; rows are `cd = 00, 01, 11, 10`.

    medium
  33. 33

    4-Variable Karnaugh Map 2

    Implement the four-variable function shown by the Karnaugh map. The `d` cells are don’t-cares and may be treated as either 0 or 1 to simplify the circuit.

    medium
  34. 34

    4-Variable Karnaugh Map 3

    Implement the four-variable function in the K-map. Changing any single input bit must invert the output.

    medium
  35. 35

    Minimum SOP and POS Forms

    Express a Boolean function in equivalent minimized SOP and POS forms.

    hard
  36. 36

    K-map Function Using Multiplexers

    Build the four data inputs for the supplied 4-to-1 mux using only 2-to-1 muxes. The mux uses `a` and `b` as its select inputs; this module receives only `c` and `d` and returns `mux_in[3:0]`.

    medium
  37. 37

    Truth Tables

    Translate two three-input truth tables into combinational logic.

    easy
  38. 38

    Even Longer Vectors

    Apply a bitwise operation across two 64-bit buses.

    easy
  39. 39

    Karnaugh Map with Don’t-Cares

    Minimize a four-variable Boolean function using the supplied K-map. The cells marked `d` are don’t-cares.

    medium