Syscall 2: Firmware, home

BenchChapter 9: Special nodes

B65DEAD TIME

The task

P1 and P2 drive the high and low sides of a half bridge. Both on at once shorts the supply.

P0 is the command on CH1: high asks for the high side, low for the low side.

Start on the low side. Sample P0 on each tick of P3.

To switch, turn the side that is on off, wait a tick, then turn the other on.

The board

The chip of DEAD TIMEChip u1 with 4 ports: P0 digital in, reaching V1, CH1; P1 digital out, reaching R1, D1, CH2; P2 digital out, reaching R2, D2, CH3; P3 timer 20 cycles.u1CHIP SC-2P0DIGITAL INV1, CH1P1DIGITAL OUTR1, D1, CH2P2DIGITAL OUTR2, D2, CH3P3TIMER 20 CYCLES
The chip's ports, each with its kind and the parts its signal reaches. Cyan reads, lemon writes. On a narrow screen, scroll the board sideways to see all of it.
Sources
V1 5 V and V2 5 V square at 31.25 Hz
Resistors
R1 330 Ω and R2 330 Ω
LEDs
D1 yellow and D2 blue
Probes
CH1, CH2, and CH3

Key idea

The tick with both off is the dead time: neither switch turns on before the other is off.

Hints

Each hint goes a step further than the one before. Open them one at a time.

Hint 1Show

After JZ falls through, A holds the 1 just read; after JNZ falls through, it holds 0.

Hint 2Show

Low on, wait for high, low off, sleep, high on, wait for low, high off, sleep, and around.

Solution

Reveal the Full SolutionThe complete program for DEAD TIME. 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.

Break before make, with one tick between.

u1SC-2 standard

LO: MOV A, 1
OUT P2
W: IN P3
IN P0
JZ W
SUB 1
OUT P2
IN P3
MOV A, 1
OUT P1
V: IN P3
IN P0
JNZ V
OUT P1
IN P3
CYCLES
254
at par
ENERGY
508
at par
NODES
1
at par
INSTRUCTIONS
15
at par