One Lamp, One Driver
The BUSY lamp should light when the heater, the pump, or both are running. The supplied design works when both are off and when both are on. It fails when only one is running.
Run the template and inspect one failing case. What does the lamp's value tell you about the problem?
Fix it, then use a single-driver type for the internal lamp signal so the compiler can catch the same mistake next time.
Interface
| Port | Direction | Type | Description |
|---|---|---|---|
heater_on_i | in | 1 bit | Heater is running |
pump_on_i | in | 1 bit | Pump is running |
lamp_o | out | 1 bit | BUSY lamp: high while anything runs |
All ports are std_logic.
Behavior
lamp_ois '1' whenheater_on_iis '1', whenpump_on_iis '1', and when both arelamp_ois '0' only when both inputs are '0'- All four input combinations are checked; no
'X'may appear anywhere
Constraints
SINGLE DRIVER: the lamp line stays a named internal signal with exactly one driver, and
lamp_okeeps reading it.
-
The final declaration uses the strict
std_ulogickind. The testbench checks values only, so the declaration is your guard. The unfixed code must stop at compile time -
Expect the first run to fail on the mixed rows; that 'X' in the waveform is the bug you're hunting
Click Run to execute your code. Output will appear here.