Learn
Practice
Press Safety Interlock
An industrial press may only operate with its guard door closed. Because a single stuck sensor could be fatal, the door carries two independent sensors that should always agree. You are writing the interlock logic: three gate expressions, computing in parallel, deciding what the press does.
Interface
| Port | Direction | Type | Description |
|---|---|---|---|
power | in | 1 bit | Power switch is on |
guard_a | in | 1 bit | Sensor A reads "guard closed" |
guard_b | in | 1 bit | Sensor B reads "guard closed" |
run | out | 1 bit | Press is allowed to run |
alert | out | 1 bit | Operator warning light |
fault | out | 1 bit | Sensor fault indicator |
Behavior
runis high only when the power is on and both sensors read closedalertis high when the power is on but the guard is not fully confirmed closed; that is, at least one sensor reads openfaultis high whenever the two sensors disagree, regardless of power
Spelled out for all eight input rows:
power | guard_a | guard_b | run | alert | fault |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 1 |
| 0 | 1 | 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 |
Notice the rows where alert and fault are high together. They are independent indicators answering different questions, not exclusive status categories.
The testbench sweeps all eight input combinations and checks all three outputs on every row.
Constraints
one concurrent assignment per output, using only and, or, xor, and not (&, |, ^, ~). No processes or always blocks; this is pure combinational wiring.
Click Run to execute your code. Output will appear here.