I hope you can help me understand the logic behind the bit chip.
So i understand that i need a Mux and then combine it with a DFF.
This is what i came up with my own.
Mux(a=in, b=dffout, sel=load,out=muxout);
It fails at line 9.
However this does not work. I check online for answer. One solution is use two NOTs after the DFF? It just seems like they are just cancelling each other.
Another solution is: that the DFF has two outs
DFF(in=x, out=out, out=y);
I'm not sure they DFF has two out. This is correct?
I also noticed that the Mux a and b is reverse to what i have i both cases.
Is theres something special in this case.
Don't think of HDL as steps in a procedure. DFF commands don't fetch values nor do you pipe values from one command into another. HDL is a description of a circuit diagram.
The circuit for the Bit, as shown in figure 3.1, consists of a Mux and a DFF.
There is one wire in that diagram that does not have a name. Let's call it 'muxOut'. Then the HDL can be written directly from the diagram, except for which Mux input is 'a' and 'b'.
Mux (sel=load, ?=in, ?=out, out=muxOut); // error: Can't connect gate's output pin to part
DFF (in=muxOut, out=out);
There is a problem with this HDL, though. The HardwareSimulator does not allow wires named in the OUT line to be connected to anything so we need to connect another wire to the DFF's 'out' so that we can connect it elsewhere in the part. (This is like soldering two wires to a physical part.)