(08-22-2013, 12:23 PM)Geoff Wrote: Does any one have a /really/ simple resource for learning about logic gates and bitwise operators and shtuff like that? Im having a hell of a time grasping these concepts and its killing me lol
This is school work, and some example questions would be like
1. Complete the Truth Table for a three input NOR gate.
2. Construct a NOR gate using only NAND gates with 2 inputs.
3. Using NAND gates with 2 inputs only, construct a three input NOR gate.
Perform a logical operation on these hex values...
4. 0x17E3 AND 0xA62B =
5. 0xD36D OR 0x2A30 =
6, 0x3011 XOR 0x5EC0 =
Note that im not actually asking for the answers to these questions, these are just examples and are of no concern to me... but right now i have no idea what im supposed to be doing with the above and the lecturer and lectures did not clear this up for me, and the stuff ive found on google is going right over my head... so if any one has any ideas? id appreciate it. i have some ideas for the first 3 but the last 3... not a fucking clue haha
Thanks.
Hey Geoff.
I can't provide you with links, but I can help you getting to the right answers and with specific questions. I have been working as a student assistant for exactly this subject, so I am still relatively near to the topic.
Let's start with some of these hex values for example. I will pick different ones so I won't spoil your own tasks:
0x34 AND 0xF8
In order to understand I recommend you convert these values into binaries first. The good thing about hex is that every digit represents exactly a nibble (half a byte). So for every digit in hex you have 4 digits in binary.
Some examples:
0(hex) = 0000(bin)
F(hex) = 1111(bin)
So grab a pencil and convert the values 0x34 and 0xF8 to binary.
Result:
Spoiler:
00110100
11111000
Best is to write them down like I did in the spoiler in order to perform the AND operation. Now get the truth table for AND. For every two digits in the same spot of the number you perform the AND operation.
So in this case you do (starting from left to right): 0 AND 0 is ..., 0 AND 0 is ..., 1 AND 0 is ...
Just look up the result from the truth table.
Result:
Spoiler:
00110100
11111000 AND
--------
00110000
Same principle applies for the other hex values. Just pick the right truth table.
For the other tasks, let's pick the first one:
Quote:1. Complete the Truth Table for a three input NOR gate.
What is the problem here? That there are three inputs?
Let's change the task a bit for explanation so I don't spoil your homework:
Quote:1a. Complete the Truth Table for a three input AND gate.
The usual truth table has two inputs, I call them a and b: (z is the result)
a b z
0 0 0
0 1 0
1 0 0
1 1 1
This is a AND b = z
What you want is: a AND b AND c = z
The AND is actually a binary operation, you always have only two inputs, so you need some brackets: ((a AND b) AND c) = z
This means calculate the result of a AND b and perform the AND operation on the result with c.
So you have a AND b = z1
z1 AND c = z2
This will be your table:
a b z1 c z2
0 0 0 0 ?
0 0 0 1 ?
0 1 0 0 ?
0 1 0 1 ?
1 0 0 0 ?
1 0 0 1 ?
1 1 1 0 ?
1 1 1 1 ?
And the rest is easy now. You only have to look at z1 and c to get the value of z2
Spoiler:
a b z1 c z2
0 0 0 0 0
0 0 0 1 0
0 1 0 0 0
0 1 0 1 0
1 0 0 0 0
1 0 0 1 0
1 1 1 0 0
1 1 1 1 1
I don't know if the three inputs are the point that bothered you with NOR. If it wasn't, just write me what it was.
Next task:
Quote:2. Construct a NOR gate using only NAND gates with 2 inputs.
This is what you want (NOR truth table):
a b z
0 0 1
0 1 0
1 0 0
1 1 0
This is what you can use (NAND truth table):
a b z
0 0 1
0 1 1
1 0 1
1 1 0
I could usually transform this well by only using the basic operations NOT and AND. It will help you to print out the laws of boolean logic that you can apply:
https://en.wikipedia.org/wiki/Boolean_logic
And:
https://en.wikipedia.org/wiki/De_Morgan%27s_laws
These are laws you just have to learn.
a NOR b = !(a OR b) = !a AND !b
In order to transform this to using only NAND operations you need to know how to do the parts of this with NAND. This rule is interesting here:
a NAND a = !(a AND a) = !a OR !a = !a
That means a NAND gate with the same operand for both inputs will work like a NOT gate. That knowledge makes it a lot easier:
!a = a NAND a
!b = b NAND b
--> (a NAND a) AND (b NAND b)
There is only one part left that is not a NAND, but an AND.
But again, you know that a NAND a = !a, so that NAND works like a NOT gate.
And you also know (or can conclude) that !!a = a.
So that you can as well put two NAND gates behind each other to perform an AND operation. You can use the single output of one gate, split it and put it into the two inputs of the following NAND gate.
Result:
Spoiler:
((a NAND a) NAND (b NAND b)) NAND ~
~ means the first operand again
That should be all you need to know to solve this.