Tricky questions, quite difficult for me :p (1 Viewer)

saves.the.day

Member
Joined
Oct 29, 2003
Messages
233
Location
Castle Hill
Gender
Undisclosed
HSC
2003
To explain why we divide by 2 you need to get a grasp on two's complement.

Just using a broken down component (4bit instead of 5)

In 1's complement with 3bits of data to store
000 = 0
001 = 1
010 = 2
011 = 3
100 = 4
101 = 5
110 = 6
111 = 7

Applying 1's complement (meaning that a 001 which is a 1 in decimal base 10 can be shown as a negative 1 as 110). The table looks like

000 = 0
001 = 1
010 = 2
011 = 3
100 = -3
101 = -2
110 = -1
111 = -0

Recalling how you turn a number into a negative using 1's complement, we'll reverse all the binary digits. E.g. positive 3 (represented by 011) becomes negative 3 represented as 100.

This is why we divide by 2. If we didn't use 1's complement, we'd still have 8 combinations to play with, but ones complement means that we have to make room for 4 negative numbers. In effect, we "lose" 4 combinations.

As you may have noticed by now, 1's complement is inefficient as it makes room for a negative 0. For this reason, we have 2's complement. By adding a 1, we remove the possibility for a negative 0. The table now looks like

000 = 0
001 = 1
010 = 2
011 = 3
100 = 4
101 = -3
110 = -2
111 = -1

By adding a one, we remove the possibility for a negative 0. Working through the table we get 111=-1 and 110=-2 etc. One combination remains; 100, which is obviously 4.

Therefore, if we divide by two in this table, we get 8/2 = 4
Now add 1 = 5

The 5th value can then only be
100 = 4

Now using the same logic, you can apply to our other table of 4 bits. Without any ones or twos complement, we get a total of 116 numbers to play with.

1) 0000 = 0
2) 0001 = 1
3) 0010 = 2
4) 0011 = 3
5) 0100 = 4
6) 0101 = 5
7) 0110 = 6
8) 0111 = 7
9) 1000 = 8
10) 1001 = 9
11) 1010 = 10
12) 1011 = 11
13) 1100 = 12
14) 1101 = 13
15) 1110 = 14
16) 1111 = 15

Two's complement will give:
1) 0000 = 0
2) 0001 = 1
3) 0010 = 2
4) 0011 = 3
5) 0100 = 4
6) 0101 = 5
7) 0110 = 6
8) 0111 = 7
9) 1000 = 8
10) 1001 = -7
11) 1010 = -6
12) 1011 = -5
13) 1100 = -4
14) 1101 = -3
15) 1110 = -2
16) 1111 = -1

From the table the highest number is indeed 8

Honestly though, I think this is beyond the scope of the HSC.

Cheers,
Lester Pepingco
 
Last edited:

-X-

Member
Joined
Aug 10, 2003
Messages
481
Gender
Undisclosed
HSC
N/A
Originally posted by SamD


Now (NOT(A) OR A) is always true so it has no effect on the AND
=NOT(B)
Can u please explain wat you mean by that?
 

-X-

Member
Joined
Aug 10, 2003
Messages
481
Gender
Undisclosed
HSC
N/A
Originally posted by saves.the.day


Two's complement will do this:
1) 0000 = 0
2) 0001 = 1
3) 0010 = 2
4) 0011 = 3
5) 0100 = 4
6) 0101 = 5
7) 0110 = 6
8) 0111 = 7
9) 1000 = 8
10) 1001 = -7
11) 1010 = -6
12) 1011 = -5
13) 1100 = -4
14) 1101 = -3
15) 1110 = -2
16) 1111 = -1

And therefore, the highest number is indeed 8
I think uve got it wrong. 1000 is = -8. The "1" in front would tell us its negative. So the Highest number is 7 and not 8. The lowest number would be = "-8".
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
Originally posted by -X-
Can u please explain wat you mean by that?
In the original post I had in essence:
=NOT(B) AND (NOT(A) OR A)
=NOT(B)
Let me try to explain this:

Consider the (NOT(A) OR A) part.
- If A is true (1) then this becomes 0 OR 1 which is True (1)
- If A is false (0) then this becomes 1 OR 0 which is also True (1)
So (NOT(A) OR A) is always true (1)

So in the original we have:
=NOT(B) AND (NOT(A) OR A)
=NOT(B) AND 1
=NOT(B)
The 'AND 1' part has no effect on the output, its just like multiplying something by 1, it has no effect.

HTH
Sam
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
Originally posted by -X-
I think uve got it wrong. 1000 is = -8. The "1" in front would tell us its negative. So the Highest number is 7 and not 8. The lowest number would be = "-8".
Correct -X-

The smallest number in a twos complement system is always a 1 followed by 0s. In effect the leading 1 represents a negative. However the rest of saves.the.days post is really excellent!!!
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Originally posted by SamD
Correct -X-

The smallest number in a twos complement system is always a 1 followed by 0s. In effect the leading 1 represents a negative. However the rest of saves.the.days post is really excellent!!!
I agree on that Sam D, a band 6 student lol...

Sam last two ques for sdd then i gotta study for food tech hehe

Ok thanks very much for your method of drawing circuits from truth tables, it works very well for all truth tables i made up :)

but what happens when, i saw this in 2001 specimen paper

"use a NOT and AND gates to construct an OR gate"

how would you do questions like that?


and my second question is

when doing binary division, you mentioned before you should just subtract the diviser, instead of converting the diviser into a two's complement and adding, is there any reason for that?
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
Originally posted by Winston

but what happens when, i saw this in 2001 specimen paper

"use a NOT and AND gates to construct an OR gate"

how would you do questions like that?

and my second question is

when doing binary division, you mentioned before you should just subtract the diviser, instead of converting the diviser into a two's complement and adding, is there any reason for that?
1. You can use the technique I discussed earlier based on either the 1 outputs or the 0 outputs. If you use the 0 outputs then you need to shove a NOT around each line. Actually it's often best to choose the 0 or 1 rows in the truth table based on the one with the least number of rows.

Let me explain using your "use a NOT and AND gates to construct an OR gate"

Here's the truth table for a simple OR gate:

A B Output
--------------
0 0 0
0 1 1
1 0 1
1 1 1

There's only one row with a 0 output so we'll use it

Logically it says NOT(A) AND NOT(B) but this results in false (0) not true, so we shove a NOT around it:
NOT(NOT(A) AND NOT(B))
(This is the answer to the question, just draw the circuit)

To check we can reduce this expression back into the original A OR B using boolean algebra.
NOT(NOT(A) AND NOT(B))
=NOT(NOT(A OR B)) Using DeMorgan's Thm (9a on p359 of my text)
=A OR B as reversing something twice gives you the something back.

2. I mentioned in another recent post that binary and twos complement binary are different methods of representation. Binary is just the base 2 number system, just like decimal is base 10. In binary all the usual arithmetic operations apply and work. Therefore if the question says nothing about twos complement, why would you use it when answering? If the question says to use twos complement then use it, however I think you'd be unlucky to get a division question in twos complement.

HTH
Sam
 

-X-

Member
Joined
Aug 10, 2003
Messages
481
Gender
Undisclosed
HSC
N/A
The 'AND 1' part has no effect on the output, its just like multiplying something by 1, it has no effect.
Ok thanks i understand that now...and about your last post, u chose the one with least outputs? i.e. u chose to use NOT(NOT(A) AND NOT(B)) instead of doing a long one to output a true (1)? I used the rows that had an output of 1 which gave me this huge scary equation that i gave up on. :p
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Originally posted by SamD
1. You can use the technique I discussed earlier based on either the 1 outputs or the 0 outputs. If you use the 0 outputs then you need to shove a NOT around each line. Actually it's often best to choose the 0 or 1 rows in the truth table based on the one with the least number of rows.

Let me explain using your "use a NOT and AND gates to construct an OR gate"

Here's the truth table for a simple OR gate:

A B Output
--------------
0 0 0
0 1 1
1 0 1
1 1 1

There's only one row with a 0 output so we'll use it

Logically it says NOT(A) AND NOT(B) but this results in false (0) not true, so we shove a NOT around it:
NOT(NOT(A) AND NOT(B))
(This is the answer to the question, just draw the circuit)

Thanks Sam

But taking the inputs 0 and 0, and notting them will be 1 and 1, and AND them will give us a 1, but how come u say it results in false? (0)

well this is my resulting circuit

http://www.blizzardhacks.net/upload/images3/circuit.1067913443.jpg
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
In response to -X-:

I knew we wanted just NOTs and ANDs, that was in the question. When you can choose just a single row you ensure that NOTs and ANDs are all you'll get. (Remember each multiple row is joined using ORs).

If we had chosen the true (1) outputs we'd have got:
(NOT(A) AND B) OR (A AND NOT(B)) OR (A AND B)
which, as you say, is a buggar of a thing!!!

Let's reduce it to A OR B just for fun!!!
(NOT(A) AND B) OR (A AND NOT(B)) OR (A AND B)
=(NOT(A) AND B) OR (A AND (NOT(B) OR B)) Take A out as a common factor
=(NOT(A) AND B) OR (A AND 1)
=(NOT(A) AND B) OR A
=A OR (NOT(A) AND B) Just getting ready to use rule 8a
=A OR B Using one of Boole's laws (8a on p359 of my text)

(This is beyond what you need to know, but maybe will help you to understand why I included p359 in my text)

Sam
 
Last edited:

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
Originally posted by Winston
Thanks Sam

But taking the inputs 0 and 0, and notting them will be 1 and 1, and AND them will give us a 1, but how come u say it results in false? (0)

well this is my resulting circuit

http://www.blizzardhacks.net/upload/images3/circuit.1067913443.jpg
I'm not clear if you're asking in regard to your circuit or in regard to my post???

(By the way your circuit is correct)
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Originally posted by SamD
I'm not clear if you're asking in regard to your circuit or in regard to my post???

(By the way your circuit is correct)
it was in regard to ur post
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
OK...

I'll try to explain....

The expression you create must describe when the situation is true. So if you use the false outputs then the final expression must be reversed so your resulting expression describes what happens to get a true result.

(Note: if there is more than one 0 output row used, you NOT the whole final expression, rather than each row's expression).

I think we're going a bit mental with all this stuff, its a small part of the syllabus...

HTH
Sam
 

-X-

Member
Joined
Aug 10, 2003
Messages
481
Gender
Undisclosed
HSC
N/A
lol SamD the magic of yours really helps when designing circuits. All i need is to remember some of those laws at the end in you book.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top