Anda di halaman 1dari 22

Number Systems

Revision of conversations What is a register Addition Complementation

Revision of conversions
Decimal Binary 101012 Hexadecimal

34010 1011102 100111112 3816 45010


C6716 B2116

4410

Answers
Decimal 2110 34010 4610 15910 5610 45010 317510 284910 4410 Binary 101012 1010101002 1011102 100111112 001110002 1110000102 1100011001112 1011001000012 1011002 Hexadecimal 1516 15416 2E16 9F16 3816 1C216 C6716 B2116 2C16

Home Work

Convert the following


Binary 1110112 0000112 010101002
A9E16

Decimal 5510

Hexadecimal

19910

What is a Register?

A small amount of very fast computer memory Speed up computer programs.


Store most commonly used values,

Computers load information into the registers, and then load it back to the main memory (load-store architecture)

Registers

If we have a 5 bit register the maximum number of bits it can store is 5 Since it can hold 5bits we could have 25 combinations (32)
The range of the register would be 0 25-1 = 0 - 31

Working with Registers

If we had a 12 bit register how many bits could it hold? How many combinations would the register be able to hold?
What would the range of the register be?

Home Work
Find the following for registers A, B and C 1. How many bits would each one hold? 2. How many combinations could be made in each register? 3. What would the range of numbers be for each one?

A. 10 B. 8 C. 14

Addition

We could perform addition on binary numbers Here are some examples;


0+ 0 0+ 1 1+ 0 1+ 1 1+ 1

1
0 1 1 10 11

REMEMBER

If we remember the following rules we will have no problems when performing additions

0+0= 0 +1= 1+0 = 1+1= 1+1+1

0 1 1 10 11

0 1 1 2 3

Trying out additions

100+ 011

1001+ 0011

111+ 001

Answers

100+ 011 111

1001+ 0011 1100

111+ 001 1100

Home work
1110+ 1111 0101+ 0110 1101+ 0100

0101+ 0111

1000+ 1001

1110+ 1010

Complementation

Complementation is a used to represent positive and negative numbers. In binary This system requires numbers to be represented by a fixed number of bits.
There are two forms of complementation, ones complement and twos complement.

Ones Complement

Ones complement is used to represent negative numbers


Lets say we have 4510

When using 8 bits 4510 = 001011012 If we change 4510 to -4510 The binary representation changes by converting 0s to 1s and 1s to 0s; 001011012 110100102.
after ones complement

Examples

Change the following to negative binary numbers using ones complement


Binary Ones Complement

Decimal 10910 22910

6410
8910

Answers
Decimal 10910 Binary 11011012 Ones Complement 00100102

22910
6410 8910

111001012
10000002 010110012

000110102
01111112 101001102

Twos Complement

Twos complement allows us to perform subtractions with binary numbers

With twos complement we start converting 1s to 0s and 0s to 1s after the first 1 Lets take the previous example of -4510,

Decimal 4510 Binary 001011012 Twos complement 110100112

Another example

Lets say we had the number 1710 and we want to change it to a -17 in twos complement First we convert 1710 to binary using an 8 bit register = 000100012 Starting after the first 1 we convert the bits = 111011112

Examples

Change the following negative numbers to binary using twos complement and an 8 bit register ;
Binary Twos Complement

Decimal -1010

-4210
-5510 -6010

Answers
Decimal -1010
-4210 -5510

Binary 000010102
001010102 001101112

Twos Complement 111101102


110101102 110010012

-6010

001111002

110001002

Home Work

Convert the following negative numbers into binary using ones and twos complement;
Twos Complement

Decimal Binary Ones Complement


5610

8910
6710

2110
4910

Anda mungkin juga menyukai