0% found this document useful (0 votes)
16 views64 pages

Computer Architecture

The document outlines a computer architecture course led by lecturer S. Shifran, covering topics such as computer systems, data representation, and number systems. It includes assessment strategies, lesson outlines, and details on data types, input/output devices, and various number systems including binary, octal, and hexadecimal. Additionally, it explains how data is stored and represented in computers, emphasizing the importance of understanding these concepts for effective computing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views64 pages

Computer Architecture

The document outlines a computer architecture course led by lecturer S. Shifran, covering topics such as computer systems, data representation, and number systems. It includes assessment strategies, lesson outlines, and details on data types, input/output devices, and various number systems including binary, octal, and hexadecimal. Additionally, it explains how data is stored and represented in computers, emphasizing the importance of understanding these concepts for effective computing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 64

Computer Architecture

Lecturer: S. Shifran
[email protected]
+94 768701466
Senior Software QA Engineer (Accel Digital - Australia)
B.Sc in IS & Master in IT ® - University of Colombo
Lesson 01 –
Introduction to Computer System.

Lesson 02 –
Data Representation and Internal Operations of the
Computer & Number Representation

Day Plan
Assessment Strategy

❏Examination: Learning Outcome 1, & 2.


❏Exam will cover 70% of the total marks for the module.
❏Exam which contain multiple choice and essay questions.
❏Presentation : Learning Outcome 3.
❏Presentation will cover 30% of the total marks for the
module.
Outline
Lesson 01 –
Introduction to ❏ Usage of the Computers
❏ Data and Information
Computer System. ❏ Qualitative vs. Quantitative Data
❏ Basic Data Types
❏ How do we store data in a
computer?
❏ Data Representation in
Computers?
❏ Advantages of Binary Code
Usage of the Computers
Examples of computer applications in society
1. Government
2. Industries
3. Businesses
4. Education
5. Health
6. Agriculture
7. Transport
8. Entertainment
Data vs Information

❏What is Information?
❏What is Data ? processed outcome of data. (it is derived from
data)
Data is a collection of facts Provide meaningful values to the receiver.
❏Numbers
❏ Timely - Information should be available
❏Words when required.
❏ Accuracy - Information should be
❏Measurements accurate.
❏ Completeness - Information should be
❏Observations complete.

❏Description of things
Examples for Data & Information
Qualitative vs. Quantitative Data

⚫Quantitative Data : Numerical Information


⚫Qualitative Data : Descriptive data
Basic Data Types: Character Data

⚫Numeric
⚫0 1 2 … 9

⚫Alphabetic
⚫a b c …… z

⚫Special
⚫# @ % ( $ &
Basic Data Types: Numeric data

4 - Most
●Integer significant bit

○+ & - whole numbers 1 - Least


significant bit
○ 4251

●Real
○All numbers including everything between integers
○ 0.23, 0, 5½, -2.3,
Input Devices

1. Keyboard
2. Mouse
3. Touch screen
4. Joystick
5. Light pen
6. Digital Camera
7. Webcam
8. Closed Circuit TV (CCTV)
9. Flatbed Scanners
10. Barcode Reader
11. Magnetic Ink Character Reader - MICR
12. Optical Character Recognition - OCR
13. Optical Mark Recognition - OMR
14. Automated Teller Machine - ATM
15. Microphone
Output Devices

1. Monitor/ Screen
2. Multimedia Projector
3. Printers
4. Plotter
5. Speaker
How do we store data in a computer?

●8 Bits = 1 Byte
●1024 Bytes = 1KB
●1024 KB = 1 MB
●1024 MB = 1 GB
●1024 GB = 1 TB
How do we store data in a computer?

●The memory is made up of BYTES


●Each BYTE can be addressed uniquely
●When the address is expressed in Binary, the number of maximum BITs
used to write the address specifies the total number of locations
available
15
●If n number of BITs are available then the total number of locations
6/17/2019

available is 2n
●If we have 32 BITs then we can have 4GB of Memory (232 = 4 GB)
Data Representation in Computers?
⚫How do computers represent data?
⚫Most computers are digital
⚫ Recognize only two discrete states: on or off
⚫ Computers are electronic devices powered by electricity, which has only
two states, on or off

16 6/17/2019
Data Representation in Computers
⚫Binary representation
⚫A number system that has just two unique digits, 0 and 1
⚫The two digits represent the two off and on states

Binary Digit Electronic Electronic


(bit) Charge State

17 6/17/2019
Data Representation in Computers

⚫BCD (Binary Coded Decimal)


⚫ 4 bit code for numeric values only
⚫ 9 🡪1001
Data Representation in Computers

19
Data Representation in Computers

⚫ ASCII (American Standard Code for Information Interchange)


⚫7 bit code for all 128 characters
A=1000001

⚫ Extended ASCII
20 ⚫ This system is an 8-bit system and allows the system to store up to 256 different
characters
⚫ EBCDIC (Extended BCD Interchange Code)
⚫8 bit ASCII used in the IBM mainframe environment.
⚫ Invention of IBM.
Data Representation in Computers

●Unicode provides a unique number for every character,


no matter what the platform,
no matter what the program,
no matter what the language.
●Fundamentally, computers just deal with numbers. They
21
store letters and other characters by assigning
6/17/2019
a number
for each one.
●8, 16 or 32 bits per character
Data Representation in Computers

22
Lesson 02 – Data Outline
Representation and ❏Ancient numerals
Internal Operations ❏Decimal Number system.
of the Computer &
❏Binary number system
Number Representation
❏Binary to Octal
Conversion
❏Decimal to Hexadecimal
Conversion
Some Ancient Numerals
Egyptian
3rd Century BC
Cretan
1200-1700BC
England’s “five-barred gate”
The Greek Numeral System
Roman Numerals
1 I 20 Now try these:
XX
2 II 25
XXV
3 III 29 XIX 1. XXXVI
4 IV 50 L
5 V 75 2. XL
LXXV
6 VI 100 C 3. XVII
10 X 500
D 4. DCCLVI
11 XI 1000 M
16 XVI 5. MCMLXIX
Introduction to the Number System

● A number system defines a set of symbols used to represent


quantity.

● Quantifying values and items in relation to each other is


helpful us to make sense of our environment.

● The study of number system is not just limited to computers.


We use numbers every day. A computer manipulates and stores
numbers inside the computer system.
Why we learn it?
• These symbols are processed internally by
components that can maintain a limited number of
discrete states.

• To represent these states we have to use number


systems.

• Ex: The decimal digits 0,1,2, …..,9 provide 10


discrete symbols (10 digits)
Decimal Number system – Place Values
We normally use the decimal number system to
represent quantities and perform calculations.

342

Hundreds Tens Ones

3 x 100 4 x 10 2x1
Decimal Number System(cont..)
The decimal Number System:
• uses base 10
• includes only the symbols 0 through 9

The weighed values for each position is as follows:

104 103 102 101 100 10-1 10-2 10-3


10000 1000 100 10 1 .1 .01 .001
Binary number system
• TWO symbols are used to represent numerals in the
binary number system. These have the values of,
• 0
• 1
• 0 represents low value, and 1 represents high value.

……………
Position x 5 4 3 2 1
…..
……………
Binary Value 1 1 1 1 1 1

Decimal ……………
2 x-1
24 23 22 21 20
Binary Number System (cont.)

• The binary number system is also a positional


numbering system.
• Instead of using ten digits, 0 - 9, the binary
system uses only two digits, 0 and 1.

Example of a binary number and the position values :

● 1 0 0 1 1 0 1
● 26 25 24 23 22 21 20
Binary Number System(cont.)

• uses base 2
• includes only the digits 0 and 1
The weighted values for each position is as follows:

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
Octal number system
• The octal number system uses EIGHT symbols to
represent numbers. The 8 distinct symbols are,
• 01234567

• With 0 having the lowest value and 7 having the


highest value

• Columns are used in the same way as in the decimal


system in that, the leftmost column is used to
represent the greatest value

• Octal numbers are represented with the base 8


Octal Number System
The Octal system is based on the binary system with a 3-bit
boundary. The Octal Number System:

• Uses base 8
• Includes only the symbols 0 through 7

The weighted values for each position is as follows:

85 84 83 82 81 80
32768 4096 512 64 8 1
Hexadecimal number system

●The hexadecimal number system uses SIXTEEN symbols to


represent Numbers. The 16 distinct symbols are, 0 1 2 3 4 5 6
7 8 9 A B C D E F, where A = 10, B = 11, .., F = 15

●With ‘0’ having the lowest value and ‘F’ having the highest
value.

●Hexadecimal numbers are represented with the base 16.


The Hexadecimal Number System:
uses base 16
• includes only the symbols 0 through 9 and the
letters A, B, C, D, E, and F to represent 10, 11, 12,
13, 14, and 15 respectively.
The weighted values for each position is as follows:
163 162 161 160
4096 256 16 1
Number Base Conversion
Binary to Decimal
Multiply each digit by its weighted position, and add each of the
weighted values.

Example
The binary value 1011 represents:
1x23 + 0x22 + 1x21 + 1x20
=1x8 + 0x4 + 1x2 + 1x1
=8 + 0 + 2 + 1
=11 (base 10)
Converting from Binary to Decimal

●1 X 20 = 1
● 1 0 0 1 1 0 1 ●0 X 21 = 0
● 26 25 24 23 22 21 20 ●1 X 22 = 4
●1 X 23 = 8
●0 X 24 = 0
● 20 = 1 24 = 16
21 = 2 25 ●0 X 25 = 0
= 32 22 = 4 26 ●1 X 26 = 64
= 64 23 = 8 7710
Decimal to Binary (Repeated Division By 2)

Division Quotient Remainder Binary Number


47 / 2 23 1 1
2 47
23 / 2 11 1 11
2 23 --1
11 / 2 5 1 111
2 11 --1
5/2 2 1 1111
2 5 --1
2/2 1 0 01111
2 2 --1
1/2 0 1 101111
2 1 --0
4710 = 1011112 0 --1
●Let's find the binary equivalent of the decimal number 254

●254 / 2 gives 127 with remainder 0


●127 / 2 gives 63 with remainder 1
● 63 / 2 gives 31 with remainder 1
● 31 / 2 gives 15 with remainder 1
● 15 / 2 gives 7 with remainder 1
● 7/2 gives 3 with remainder 1
● 3/2 gives 1 with remainder 1
● 1/2 gives 0 with remainder 1
111111102
Binary to Octal Conversion

It is easy to convert a binary number to an octal.


This is accomplished by:
1010111012
Most Significant Bit Least Significant Bit
(MSB) (LSB)

1. Break the binary number into 3-bit sections from the LSB to the MSB.
2. Convert the 3-bit binary number to its octal equivalent.

For example, the binary value 1010111110110010 will be


written:
001 010 111 110 110 010
1 2 7 6 6 2
Relationship between binary and octal

Octal Binary (in 3


bits)
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
Octal to Decimal Conversion
To convert from Octal to Decimal, multiply the value in each
position by its Octal weight and add each value.
Example, convert this octal 342 to decimal,
we can obtain the decimal value as follows:
3x82 4x81 2x80
3x64 4x8 2x1
192 32 2 192 + 32 + 2 = 226
8
6
8
4
6
8 1
46
8 1
4
3 x 82 4 x 81 2 x 80
Conversion from Octal to Decimal

●Convert 1768 to decimal.

●Each column represents a power of 8,


176 = 1 * 82 + 7 * 81 + 6 * 80
= (1 * 64) + (7 * 8) + (6 * 1)
= 64 + 56 + 6
= 126
Decimal to Octal Conversion

To convert decimal to octal is slightly more difficult. The typical


method to convert from decimal to octal is repeated division by 8.
Repeated Division By 8
•For this method, divide the decimal number by 8, and write the
remainder on the side as the least significant digit.
•This process is continued by dividing the quotient by 8 and
writing the remainder until the quotient is 0.

Division Quotient Remainder


87 / 8 10 7
10 / 8 1 2 8710 = 1278
1 / 8 0 1
Binary to Hexa Conversion

It is easy to convert a binary number to hexa.


This is accomplished by:

1.Break the binary number into 4-bit sections from the LSB to the MSB.
2.Convert the 4-bit binary number to its Hexa equivalent.

For example, the binary value 1010111110110010 is written:

1010 1111 1011 0010


A F B 2
Relationship between Binary and Hexadecimal

Hexadecimal Binary (in Hexadecimal Binary


4 bits) (in 4 bits)

0 0000 8 1000
1 0001 9 1001
2 0010 A 1010
3 0011 B 1011
4 0100 C 1100
5 0101 D 1101
6 0110 E 1110
7 0111 F 1111
Hexa to Binary Conversion

It is also easy to convert from an integer hexa number to binary.


This is accomplished by:

• Convert the Hexa number to its 4-bit binary equivalent.


• Combine the 4-bit sections by removing the spaces.

For example the hexa value B2 is written in binary:

B 2
1011 0010
This yields the binary number 10110010 or 1011 0010 in our more
readable format.
Hexadecimal to Decimal Conversion

To convert from Hexa to Decimal, multiply the value in each


position by its hexa weight and add each value.

Using the value from the previous example, B216, we can obtain
the decimal value as follows: 1
16
61
B x 161 2 x 160 16
11 x 16 2 x 1 61
16
176 2 61
16
61 1
16
176 + 2 = 178 61 1
6
0 x 163 0 x 162 11 x 161 2 x 160
Conversion from hexadecimal to decimal

●Convert hexadecimal 17616 to decimal.

●Each column represents a power of 16,


17616= (1 * 162) + (7 * 161) + (6 * 160)
= (1 * 256) + (7 * 16 )+ (6 * 1)
= 256 + 112 + 6
= 374
The bits in a byte are filled from LSB (b0) to MSB (b7)
respectively as follows:

1 0 0 1 1 0 0 1
b7 b6 b5 b4 b3 b2 b1 b0
Most Significant Bit (MSB) Least Significant Bit
(LSB)
The Binary equivalent of the decimal number 205 is as follows and
the Most Significant Bit(MSB) and the Least Significant Bit
(LSB)can be defined as below :
1 1 0 0 1 1 0 1
MS
LSB
B
BCD - Binary Coded Decimal

• Binary Coded Decimal is a numerical code.


• In this code structure, each of the decimal digits (0-9) is
represented by a four-bit binary code (eg: 3 is represented by
0011)
• Each digit is then represented by it's binary equivalent.
• 16 unique(different) numbers can be stored in the 4 bit binary
code.
• Thus there are 6 invalid four-bit combinations in the BCD
code.
2’s complement representation
1). 2’s complement representation of 0 100 0001
Sign bit = 0(Positive)
Absolute value = 100 0001
Hence the relevant = +65

2). 2’s complement representation of 1 000 0001


Sign bit = 1(negative)
Absolute value is the complement of 000 0001 -> 111 1110+1 ->111 1111
Hence the relevant = -127

3). 2’s complement representation of 0 000 0000


Sign bit = 0(Positive)
Absolute value = 0
Hence the relevant = +0

4). 2’s complement representation of 1 111 1111


Sign bit = 1(negative)
Absolute value is the complement of 111 1111-> 000 0000 + 1-> 000 0001
Hence the relevant = -1
Binary Addition
▪ 0+0=0
▪ 0+1=1
▪ 1+0=1
▪ 1 + 1 = 10 (carry: 1)
• E.g.
1 1 1 1 1 (carry)
0 1 1 0 1
+ 1 0 1 1 1
= 10 0 1 0 0
Binary Addition

A B S C(arry)
0 0 0 0
1 0 1 0
0 1 1 0
1 1 0 1

Notice that the carry results are the same as AND


C=A•B
17
Binary addition

●101111012+1011102
●1110112+11102
●1111002+100002
60
●11100002+1002
Binary Subtraction
▪ 0-0=0
▪ 0 - 1 = 1 (with borrow)
▪ 1-0=1
▪ 1-1=0
• E.g.
* * * (borrow)
1 0 1 1 0 1
- 0 1 0 1 1 1
Binary Multiplication
• E.g.
1 0 1 1
x 1
0 1 0
0
0 0 0
+ 1 01 1
+ 0 0 00
+ 1 0 1 1
= 1 1 0 1 1 1 0
Binary Division
• E.g.
1 0 1
1 0 1 1 1 0 1 1
- 1 0 1
0 1 1
- 0 0 0
1 1 1
- 1 0 1

You might also like