flipflop
A D flip-flop: on each rising edge of its clock its output q takes the level at its d, and holds it until the next. qbar is the complement of q. Its ports are marked inside it — D and CLK on its back, Q and Q̄ on its front. Wires that name no port land on d and then clock, and leave from q; a wire may return to the same flip-flop, wire(from: #ff.qbar; to: #ff.d), which divides its clock by two.
flipflop

#Attributes
valueThe level
q starts at, 0 or 1. Without it q starts unknown.colourThe box fills with the hue's own tint and strokes deeper.
bluelight-bluedark-blueredlight-reddark-redorangelight-orangedark-orangeyellowlight-yellowdark-yellowteallight-tealdark-tealgreenlight-greendark-greenpinklight-pinkdark-pinkpurplelight-purpledark-purplegreylight-greydark-greyneutralhex(…)rgb(…)colorhiddenDeclared but not drawn, and taking no room while hidden. Animatable.
Default
false#Derived attributes
Computed while the element renders — read one with #id.name in attribute position or {{#id.name}} in prose, never set.
levelThe level of
q: 0, 1, or absent while unknown.#Allowed content
Body { }Words set inside the box; usually empty
#Allowed in
#Examples


logic{
switch#d{$D$}(value: 1)
switch#clk{Clock}(value: 0 !cue.to{1}(at: 1))
flipflop#ff{}(value: 0)
lamp#q{$Q$}
wire(from: #d; to: #ff.d)
wire(from: #clk; to: #ff.clock)
wire(from: #ff.q; to: #q)
}