Foggerty wrote
Hi, i've just finished the PC - implementing it was fun! - and have a question re the hardware simulator.
Because I wanted 'sel' to be set by either of the 1-bit inputs, I just did:
Thing(a=in, out=out, sel=load, sel=inc, sel=reset);
This doesn't work, but in the real world I'd expect it to; the three wires would fan-in to the single sel input, and so long as one of them was '1', everything would be fine. Right?
Normally what happens when you directly wire the outputs of two CMOS gates together is that the magic smoke comes out and the parts stop working.
When the output of the And gate is True, transistor Q5 (pull-up) is turned on and Q6 (pull-down) is turned off. When the output is False, Q5 is off and Q6 is on. Effectively, the output connected directly to power supply or ground. Think of the output as a two-way switch
When two competing outputs are connected together, power is connected to ground through the pull-up of one of the outputs and the pull-down of the other output, resulting in a short circuit. One, often both, of the transistors will burn.
Also, in the real world you don't want to leave unused inputs floating. They can pick up noise, causing output glitches, or they can cause the gate to enter analog operation which can also result in burnout.
(I'd have written the simulator to error on unconnected inputs, so you'd need to write
Or8Way(in[0]=load, in[1]=inc, in[2]=reset, in[3..7]=false, out=OrOut);
to ensure that all the inputs are connected.)
--Mark