Search code examples
cpu-architecturedigital-design

How can a connection between one gate input with mutiple outputs of other gates causes circuit memory?


I'm reading the Digital Design and Computer Architecture by David Harris, Sarah Harris. The authors give the following definition of combinational logic:

A combinational circuit’s outputs depend only on the current values of the inputs; in other words, it combines the current input values to compute the output... A combinational circuit is memoryless, but a sequential circuit has memory. The functional specification of a combinational circuit expresses the output values in terms of the current input values.

However, they claim this circuit is not combinational:

because "node n6 connects to the output terminals of both I3 and I4". Indeed, it's one of the designated signs when a scheme can not be combinational but, according to the authors:

Certain circuits that disobey these rules are still combinational, so long as the outputs depend only on the current values of the inputs.

As I'm able to catch on, the aforementioned circuit is the case: its output is 1 if and only if its inputs are both 1, otherwise the output is 0. So the output is defined as a function of the inputs (the AND function).

In fact, there was already a question about this circuit in the computer science network and it has an accepted answer. Here's an excerpt from it:

Circuit (d) cannot be written in this form [of formula], since the outputs of I3 and I4 are wired together. What is the relation between the input to the rightmost gate and the outputs of I3 and I4? Not something that can be described combinatorially.

Unfortunately, I'm still confused due to

  • The circuit, regarded as a black box, is still in scope of the combinational logic definition: its output values depend only on the current values of the inputs;
  • The relation between the input to the rightmost gate and the outputs of I3 and I4 can be described through the function NAND of the circuit inputs and this function is quite "memoryless". It's not obvious for me why we can't afford to depict a gate input using multiple outputs of other gates.

I need some elaboration. Maybe things would fall into place if someone provide a circuit example when two gates outputs is connected to one input and it actually causes "memory" (in contrast to the considered sample).


Solution

  • Circuit (d) is not combinational because it is not a logic gate circuit at all.
    I think it's a very silly example to explain combinational vs sequential circuits.

    In a logic circuit, an output wire cannot go to another output wire. You assumed that the outputs, when connected together, will act as a logical OR or AND of themselves.
    This is not true (otherwise why would we use AND/OR gates in the first place?).
    What will happen depends on the specific implementation of the gates (i.e. specific IC or manufacturing process you used) and this is not something that a logic circuit is meant to model.
    A logic circuit must behave the same, no matter what brand you are using.

    In circuit (d), the output of I3 will feed both the input of the rightmost NOT and the output of I4 (the complementary is also true).
    Most IC will break if a current will flow in from their outputs, others won't but they will interfere with the capability of the right-most NOT to sense its input.
    Logic circuits are still circuits, so you should, in theory, perform a full circuit analysis, which includes solving differential equations, to solve for their output.
    Digital electronics is a branch that abstracts from these "low-level" details but at the cost of making some assumptions, one of which is: outputs are never merged without a gate.

    The whole point of a combinational circuit is that you can write out = f(in0, in1, ..., ink) but it's not always possible.
    Take for example an edge detector, it is just a f(A) = (NOT A) AND A which should, by the law of the excluded middle, always output 0.
    But it will not because the NOT A path takes a slightly longer time to reach the AND input.
    How can you describe this dynamic behaviour with a f(A) function?

    Don't think too much of it, when you'll get to sequential circuits you'll spot the difference immediately (if you need a preview, look up for "latch circuit").