Home › Practice › RTL Design › Blink an LED at half speed
Blink an LED at half speed
EasyRTLsequential
The clock ticks too fast to see. You want an LED that changes on every tick it is allowed to, so it blinks at half the clock rate.
Concept first. A T (toggle) flip-flop is a memory bit with one control input, t. On each rising clock edge: if t = 0 it keeps its value; if t = 1 it flips to the opposite value. With t held at 1 the output changes on every edge, so it needs two edges to make a full cycle: a square wave at half the clock frequency. That is a divide-by-2. You do not need a special flip-flop: an ordinary flip-flop can feed its own output back.
What to build.
toggle(clk, rst, t)with outputq.rstis synchronous and active-high: on a rising edge withrst = 1,qbecomes 0.- Otherwise, on a rising edge with
t = 1,qflips. Witht = 0it holds.
No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.