Sunday, May 31, 2015

No High-Z, None High-Z

While trying to hook up different destination registers for an op-code, the line to signal the register to update its value was only dependent on the op-code, not the destination.  However, when trying to key off the logic to trigger the memory update there was a problem.  Using normal logic gates (at least with this simulator) a High-Z AND 1 gives a 1.  That means if I want to signal a 1 given several other conditions, if one set of logic is inactive (High-Z), it will signal true.  I don't want this!  Here is an example:

A case where I want to set a register  "Reg0" to load a value when:
     A.  Opcode is "load register with value"
     B.  Operand 1 specifies "Reg0"
     C.  Decode stage is 1.

If the condition is:

     (opcode == 0 && operand1 == 0 && stage== 1) == True

If you try that case, everything is good and thing load correctly.  However, if in the case of our selector if the operand1 is a different register, the selector for operand1 == 0 will be High-Z.  And the other conditions will still be the case.  So what we need is a special AND.  It is an AND that is true if both values are not High-Z.  Otherwise it outputs High-Z.

e.g.
     (opcode == 0 && operand1 == High-Z && stage== 1) == False
This is not what we want!


Here is how the normal AND behaves with High-Z (basically ignoring the high-z input)


Normal AND (partial table)

ABResult
0High-Z0
1High-Z1
010


Not only do we want the High-Z to be passed through the gate, but we also want any non-High-Z (Low-Z????) value to cause a true to be output.  There is data and we want it to cause a selector to be enabled.



The Not High-Z Circuit

To achieve the goal, we want to create a circuit that detects High-Z vs. normal signals.  There are probably off the shelf components for this, but not in the tool I have.  The Tri-State gate goes from normal logic and transforms the output to the 3 state domain.  But I've got nothing to go backwards to trigger a select signal.

The monstrosity below is what I've cobbled together.  It has to handle two separate issues.  The first is that we want to use normal gates to detect High-Z.  The top part of the circuit takes a single input and uses differences in how AND's and OR's behave with a High-Z signal to detect it.  We AND and OR the same signal against itself and if there is a not difference in the output, the signal must be 0 or 1.  If the output is not the same, it is High-Z.
The lower group of gates handles the initial condition issue where starting in High-Z does not give the same result as transitioning to High-Z.
These two are combined to give a reliable High-Z (or !) detector.




No High-Z (partial table)

AResult
01
11
High-Z0

To re-iterate, this takes a Tri-State input and lets us know if it is not High-Z.  Then we can just send direct the result lines of some enable-able component to an input, send the output to this and hook it up to enable (or load) and be good.

None High-Z

Armed with this idea, we can chain outputs from enabled or disabled circuits to either enable a true or output High-Z.  We'll take inputs of 0,1 or High-Z.  From these we'll change domains from 3 state to 2 state and use normal gates.  When when we are done we'll convert back to 3 State and emit either a 1 (to enable some sub-circuit) or High-Z to not affect the attached logic.




None High-Z (Partial Table)
ABResult
0High-ZHigh-Z
1High-ZHigh-Z
011
001

This can easily be extended to arbitrary inputs to have an N-input None High-Z device.

No comments:

Post a Comment