B55IDEAL DIODE
The task
Two diodes joined at their cathodes pass whichever input is higher, less 0.6 volts.
Do it without the loss: put out the higher of P0 and P1 on CH3 through the PWM pin P2.
The board
- Sources
- V1 2 V sine at 25 Hz, V2 2.5 V, and V3 3 V square at 10 Hz
- Resistors
- R1 1 kΩ
- Capacitors
- C1 1 µF
- Probes
- CH1, CH2, and CH3
Key idea
MOV B, A keeps the first reading.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
The second reading minus the first is above 0 only when the second is higher.
Hint 2Show
If it is not, start from 0. Either way, ADD B gives the higher reading.
Solution
Reveal the Full SolutionThe complete program for IDEAL DIODE. Open it only when you want the answer.
The reference program
The game's own solution. It passes every test and scores exactly par on every benchmark.
Put out the higher of two inputs, with no drop.
u1SC-2 standard
IN P0
MOV B, A
IN P1
SUB B
JG W
MOV A, 0
W: ADD B
OUT P2- CYCLES
- 1000
- at par
- ENERGY
- 2000
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 8
- at par