
Misc  Random Notes
The following are some random questions that I have been receiving frequently and have posted answers to. Perhaps the answer you are looking for is in here. Eventually I will put this collection into a more organized FAQ. Until then, here is a snapshot of this information. Please check back often for updates.
 My circuit isn't working in LogicWorks. All I get is a Z in my binary probes. What's wrong?
In most cases the issue has been with the ground symbol in LogicWorks. There are three grounds in the system. Two are smaller than the third. The small ones will work fine (hook directly to a BinaryProbe to verify). The big one does not produce a signal so a binary probe will read "Z".
 Do I need to connect the pins on my Hex Keypad?
The pins on Hex Keypads are outputs and therefore should be left floating with nothing connected to them if you do not need them. Inputs must always be connected to a signal ground (Vss, 0) or power (Vcc, Vdd, 1).
 How do I detect overflow during addition using 2's compliment numbers?
There has been some confusion over the methods to detect overflow in 2's compliment addition. The simplest solution is to look at the carryin and carryout of the most significant bit (MSB). If the carryin matches the carryout then the number produced was in range. If they are different then there is an overflow (or underflow). There are more difficult approaches, but this is the technique that is used inside of most circuits. You should prove to yourself that this works.
As an example take 1+5
*0* 0 1 0 (Cin)
0 0 0 1 (1)
+ 0 1 0 1 (5)

0 1 1 0 (6)
*0* 0 0 1 (Cout)
Notice that the leftmost Cin=0 and Cout=0  therefore no overflow. However, 1+7...
*1* 1 1 0 (Cin)
0 0 0 1 (1)
+ 0 1 1 1 (7)

1 0 0 0 (8)
*0* 1 1 1 (Cout)
Now we have Cin=1 and Cout=0  therefore Overflow
Also check some negative cases (3)+(6)...
*0* 0 0 0 (Cin)
1 1 0 1 (3)
+ 1 0 1 0 (6)

0 1 1 1 (7)
*1* 0 0 0 (Cout)
and (3)+(1)
*1* 1 1 0 (Cin)
1 1 0 1 (3)
+ 1 1 1 1 (1)

1 1 0 0 (4)
*1* 1 1 1 (Cout)
 Can you please explain Hamming Codes?
Start with some data bits ZYXW (called D8, D4, D2, D1 in your notes). Now let's compute some parity values for these bits (PQR  P1 P2 P3)
P = Z :+: Y :+: W
Q = Z :+: X :+: W
R = Y :+: X :+: W
Where :+: is XOR (effectively counting how many 1's we have). Now interleave these bits to be sent over an unreliable link (everything is unreliable).
P Q Z R Y X W
and receive them on the other side after something bad has happened
P Q Z R y X W < I did something to Y
Now pull the bits apart so you have your data and parity
PQR
ZyXW
Recompute your parity using the data you received
p = Z :+: y :+: W
q = Z :+: X :+: W
r = y :+: X :+: W
Check to see if P=p and Q=q and R=r. If they all match, then the data came through with no errors. If they don't match, something is wrong. But comparing P=p is nothing more than P :+: p. By combining the equations we can get
C = Z :+: y :+: W :+: P
B = Z :+: X :+: W :+: Q
A = y :+: X :+: W :+: R
so if CBA are all 0 then no error occurred.
HOWEVER  if CBA is not all 0, then the "magic" occurs. The value of CBA (read as a binary number) will indicate which bit is wrong (assuming a single bit error). The particular order of which bits are included in which equation and the interleaving order make this work.
Okay, now for an example...
I have 1001 that I want to send
P = 1 :+: 0 :+: 1 = 0
Q = 1 :+: 0 :+: 1 = 0
R = 0 :+: 0 :+: 1 = 1
so I build up 0011001 (notice this is the same as the entry in row 9 of the procedure) and send that over the link and receive 0011101.
Pull the word apart (no cheating, at this point you have no idea what was really sent over the link, just what you have received)
Data = 1101
Parity = 001
p = 1 :+: 1 :+: 1 = 1
q = 1 :+: 0 :+: 1 = 0
r = 1 :+: 0 :+: 1 = 0
and match these against the recieved parity bits
C = P :+: p = 0 :+: 1 = 1
B = Q :+: q = 0 :+: 0 = 0
A = R :+: r = 1 :+: 0 = 1
CBA = 101 = 5
This means something is wrong with bit #5 when read left to right 1234567
So... we flip that bit (I'll leave this part up to you)
0011101 > 0011001
Then extract the data from that
1001
viola  the corrected data. Of course, if 2 bits are in error, then we will "correct" the wrong bit.
Last Modified:

Barry E. Mapen
