The test script does not say anything about how the circuit is wired. The test script only validates how the circuit functions. The script changes
in and
load and tests that
out changes to the correct values at the correct time.
This complex circuit, using 2 DFFs is also a Bit because it satisfies the specified behavior.
CHIP Bit {
IN in, load;
OUT out;
PARTS:
Xor(a=in, b=p, out=ixa);
Not(in=load, out=nl);
Or(a=load, b=q, out=lob);
Or(a=nl, b=ixa, out=nxi);
Not(in=p, out=p1);
Nand(a=nxi, b=lob, out=q1);
DFF(in=p1, out=p);
DFF(in=q1, out=q);
Xor(a=p, b=q, out=out);
}
--Mark