Logic Lock (4-bit key comparator)

A lock opens only when it is enabled and the entered key matches the stored code bit for bit.

Inputs: key, 4 bits entered; code, 4 bits stored; enable.
Output: unlock, 1 only when enable is 1 and key equals code.

The testbench applies all 512 combinations.

Contributed by Indicore

Compiler Output
Waveform Viewer