0% found this document useful (0 votes)
7 views

intro archi

This lesson provides an introduction to computer architecture and organization, focusing on defining key concepts such as computer architecture, instruction set architecture (ISA), and the differences between RISC and CISC processors. It explains the characteristics, advantages, and disadvantages of both RISC and CISC architectures, as well as the importance of CPU cache and number systems in data representation. Students will learn how these concepts impact computer performance and design.

Uploaded by

zumbastudio736
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

intro archi

This lesson provides an introduction to computer architecture and organization, focusing on defining key concepts such as computer architecture, instruction set architecture (ISA), and the differences between RISC and CISC processors. It explains the characteristics, advantages, and disadvantages of both RISC and CISC architectures, as well as the importance of CPU cache and number systems in data representation. Students will learn how these concepts impact computer performance and design.

Uploaded by

zumbastudio736
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 58

Lesson 1

Introduction to Computer Architecture and Organization

Intended Learning Outcomes:

At the end of the lesson, the student is expected to:

1. define computer architecture and computer organization;


2. understand Instruction Set Architecture, Number of bits
used to represent various data types, I/O Mechanisms, and
Memory addressing Techniques
3. learn how computers work, how to analyze computer
performance, and what issues affect the design and function
of modern computers.

COMPUTER ARCHITECTURE

Computer Architecture refers to those attributes


(characteristics) of a system that have a direct impact on the
logical execution of a program.

Examples:

 Instruction Set Architecture


 Number of bits used to represent various data types
 I/O (Input/Output Mechanism)
 Memory Addressing Techniques

Instruction Set Architecture (ISA)

Instruction Set Architecture (ISA) is part of the abstract model


of a computer that defines how the CPU is controlled by the
software.

An abstract model of a machine is a model of a computer system


(considered either as hardware or software) constructed to allow
a detailed and precise analysis of how the computer system
works.

It acts as an interface between the hardware and the software,


specifying both what the processor is capable of doing as well
as how it gets done.

It also defines the way in which a microprocessor is programmed


at the machine level.

An ISA is an abstraction, so it is independent of the actual


physical implementation of the device being described.

Different architectures have their own sets of instructions,


syntax, data types, and addressing modes that are of interest to
the programmer at the machine level.

There are 2 classifications of ISA:

1. RISC (Reduced Instruction Set Computer) architecture


2. CISC (Complex Instruction Set Computer) architecture

RISC stands for Reduced Instruction Set Computer Processor, a


microprocessor architecture with a simple collection and highly
customized set of instructions.
It is built to minimize the instruction execution time by most
effective use and limiting the number of instructions. It means
each instruction cycle requires only one clock cycle, and each
cycle contains three parameters: fetch, decode and execute. A
computer processor or CPU speed is determined by the clock
cycle, which is the amount of time between two pulses of an
oscillator.

T = 1/F

It uses more basic instructions that are executed independently


to complete a task and also it uses more lines of codes;

RISC chips require several transistors, making it cheaper to


design and reduce the execution time for instruction.

Examples of RISC processors are SUN's SPARC, PowerPC, Microchip


PIC processors, RISC-V.

Advantages of RISC Processor

1. The RISC processor's performance is better due to the


simple and limited number of the instruction set.
2. It requires several transistors that make it cheaper to
design.
3. RISC allows the instruction to use free space on a
microprocessor because of its simplicity.
4. RISC processor is simpler than a CISC processor because of
its simple and quick design, and it can complete its work
in one clock cycle.

Disadvantages of RISC Processor

1. The RISC processor's performance may vary according to the


code executed because subsequent instructions may depend on
the previous instruction for their execution in a cycle.
2. Programmers and compilers often use complex instructions.
3. RISC processors require very fast memory to save various
instructions that require a large collection of cache
memory to respond to the instruction in a short time.

What is a CPU Cache?

A computer has 2 different types of memory:


1. Used in RAM Modules, which is DRAM or Dynamic RAM

DRAM is a memory that uses capacitors to store data. And


these capacitors have to constantly and dynamically be
refreshed often with electricity in order for them to store
data.

2. SRAM (Static RAM)


It is another type of memory that a computer uses that
doesn’t have to be constantly refreshed. An SRAM is what is
used in the CPU cache. It is a lot faster than DRAM because
it doesn’t have to be constantly refreshed and it is also
very expensive.

The CPU cache is a CPU internal memory. And its job is to store
copies of data and instructions from RAM that’s waiting to be
used by the CPU.

So basically, what the CPU cache does is that it holds a common


data that it thinks the CPU is going to be access over and over
again, because when the CPU needs to access a certain data, it
always checks the faster cache memory first to see if the data
it needs is there.

RISC Architecture

It is a highly customized set of instructions used in portable


devices due to system reliability such as Apple iPod,
mobiles/smartphones, Nintendo DS,
Features of RISC Processor

Some important features of RISC processors are:

1. One cycle execution time: For executing each instruction in


a computer, the RISC processors require one CPI (Clock per
cycle). And each CPI includes the fetch, decode and execute
method applied in computer instruction.
2. Pipelining technique: The pipelining technique is used in
the RISC processors to execute multiple parts or stages of
instructions to perform more efficiently.
3. A large number of registers: RISC processors are optimized
with multiple registers that can be used to store
instruction and quickly respond to the computer and
minimize interaction with computer memory.
4. It supports a simple addressing mode and fixed length of
instruction for executing the pipeline.
5. It uses LOAD and STORE instruction to access the memory
location.
6. Simple and limited instruction reduces the execution time
of a process in a RISC.

CISC Processor

The CISC Stands for Complex Instruction Set Computer, developed


by the Intel. It has a large collection of complex instructions
that range from simple to very complex and specialized in the
assembly language level, which takes a long time to execute the
instructions.

It is an older ISA classification. It tends to use fewer lines


of assembly code, each performing multiple steps in multiple
clock cycles, making it easier to compile higher-level
languages.

CISC chips are relatively slower as compared to RISC chips but


use little instruction than RISC. Examples of CISC processors
are VAX, AMD, Intel x86 and the System/360.

Characteristics of CISC Processor


Following are the main characteristics of the RISC processor:

1. The length of the code is shorts, so it requires very


little RAM.
2. CISC or complex instructions may take longer than a single
clock cycle to execute the code.
3. Less instruction is needed to write an application.
4. It provides easier programming in assembly language.
5. Support for complex data structure and easy compilation of
high-level languages.
6. It is composed of fewer registers and more addressing
nodes, typically 5 to 20.
7. Instructions can be larger than a single word.
8. It emphasizes the building of instruction on hardware
because it is faster to create than the software.

CISC Processors Architecture

The CISC architecture helps reduce program code by embedding


multiple operations on each program instruction, which makes the
CISC processor more complex.

Advantages of CISC Processors

1. The compiler requires little effort to translate high-level


programs or statement languages into assembly or machine
language in CISC processors.
2. The code length is quite short, which minimizes the memory
requirement.
3. To store the instruction on each CISC, it requires very
less RAM.
4. Execution of a single instruction requires several low-
level tasks.
5. CISC creates a process to manage power usage that adjusts
clock speed and voltage.
6. It uses fewer instructions set to perform the same
instruction as the RISC.
Disadvantages of CISC Processors

1. CISC chips are slower than RSIC chips to execute per


instruction cycle on each program.
2. The performance of the machine decreases due to the
slowness of the clock speed.
3. Executing the pipeline in the CISC processor makes it
complicated to use.
4. The CISC chips require more transistors as compared to RISC
design.
5. In CISC it uses only 20% of existing instructions in a
programming event.

Difference between the RISC and CISC Processors

RISC CISC

It is a Reduced Instruction Set It is a Complex


Computer. Instruction Set
Computer.

It emphasizes on software to It emphasizes on


optimize the instruction set. hardware to optimize the
instruction set.

It is a hard-wired unit of Microprogramming unit in


programming in the RISC Processor. CISC Processor.

It requires multiple register sets It requires a single


to store the instruction. register set to store
the instruction.

RISC has simple decoding of CISC has complex


instruction. decoding of instruction.

Uses of the pipeline are simple in Uses of the pipeline are


RISC. difficult in CISC.

It uses a limited number of It uses a large number


instructions that requires less time of instructions that
to execute the instructions. requires more time to
execute the
instructions.

It uses LOAD and STORE that are It uses LOAD and STORE
independent instructions in the instruction in the
register-to-register a program's memory-to-memory
interaction. interaction of a
program.

RISC has more transistors on memory CISC has transistors to


registers. store complex
instructions.

The execution time of RISC is very The execution time of


short. CISC is longer.

RISC architecture can be used with CISC architecture can be


high-end applications like used with low-end
telecommunication, image processing, applications like home
video processing, etc. automation, security
system, etc.

It has fixed format instruction. It has variable format


instruction.

The program written for RISC Program written for CISC


architecture needs to take more architecture tends to
space in memory. take less space in
memory.

Example of RISC: ARM, PA-RISC, Power Examples of CISC: VAX,


Architecture, Alpha, AVR, ARC and Motorola 68000 family,
the SPARC. System/360, AMD and the
Intel x86 CPUs.

In computers, a pipeline is the continuous and somewhat


overlapped movement of instruction to the processor or in the
arithmetic steps taken by the processor to perform an
instruction. Pipelining is the use of a pipeline.

Example:

Number of Bits Used to Represent Data Types

Computer does not understand human language. Any data feed to


the computer should be converted into a machine language first
in order for the computer to understand.

There are 3 forms that a computer represent data:

1. Number Systems
2. Bits and Bytes
3. Text codes

Number Systems

The number system or the numeral system is the system of naming


or representing numbers.

There are different types of number systems in Math like decimal


number system, binary number system, octal number system, and
hexadecimal number system.

Types of Number System


There are various types of number systems in mathematics.
The four most common number system types are:
1. Binary number system (Base- 2) 2 digits >>>>>>> 0, 1
2. Octal number system (Base-8) 8 digits >>>>>>>>> 0, 1, 2,
3, 4, 5, 6, 7
3. Decimal number system (Base- 10) 10 digits >>>> 0, 1, 2,
3, 4, 5, 6, 7, 8, 9
4. Hexadecimal number system (Base- 16) 16 digits >0, 1, 2, 3,
4, 5, 6, 7, 8, 9, A, B, C, D, E, F

Binary Number System (Base 2 Number System)


The base 2 number system is also known as the Binary number
system wherein, only two binary digits exist, 0 and 1.
Specifically, the usual base-2 is a radix of 2. The figures
described under this system are known as binary numbers which
are the combination of 0 and 1.
For example, 110101 is a binary number.
We can convert any system into binary and vice versa.
Example
Conversion of decimal number into binary number.
Write (14)10 as a binary number.
Solution:
14/2 = 7 = 0 MSB
7/2 = 3 = 1
3/2 = 1 = 1
1/2 = 0 = 1 LSB

∴ (14)10 = 11102

Octal Number System (Base 8 Number System)


In the octal number system, the base is 8 and it uses numbers
from 0 to 7 to represent numbers. Octal numbers are commonly
used in computer applications. Converting an octal number to
decimal is the same as decimal conversion and is explained below
using an example.
Example:
Convert (215)8 into decimal.
Solution:
(215)8 = 2 × 82 + 1 × 81 + 5 × 80
= (2 × 64) + (1 × 8) + (5 × 1)
= 128 + 8 + 5
= (141)10

Decimal Number System (Base 10 Number System)


The decimal number system has a base of 10 because it uses ten
digits from 0 to 9.
In the decimal number system, the positions successive to the
left of the decimal point represent units, tens, hundreds,
thousands and so on. This system is expressed in decimal
numbers.
Every position shows a particular power of the base (10).
Example:
The decimal number 1457 consists of the digit 7 in the units’
position, 5 in the tens place, 4 in the hundreds position, and 1
in the thousands place whose value can be written as:
(1×103) + (4×102) + (5×101) + (7×100)
(1×1000) + (4×100) + (5×10) + (7×1)
1000 + 400 + 50 + 7
=145710

Hexadecimal Number System (Base 16 Number System)


In the hexadecimal system, numbers are written or represented
with base 16.
In the hexadecimal system, the numbers are first represented
just like in the decimal system, from 0 to 9. And also, other
numbers are represented using the alphabet from A to F.
The below-given table shows the representation of numbers in
the hexadecimal number system.

Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F

Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Number System Conversion


Numbers can be represented in any of the number system
categories like binary, decimal, octal, and hexadecimal. Also,
any number which is represented in any of the number system
types can be easily converted to each other.
Converting Decimal Number to Binary
Example:
1. (13)10

=11012
Hexadecimal to Octal Number System
Example:
Convert (1056)16 to an octal number.
Solution:
Given, (1056)16 is a hexadecimal number.
First, we need to convert the given hexadecimal number into
decimal number
(1056)16
= 1 × 163 + 0 × 162 + 5 × 161 + 6 × 160
= 4096 + 0 + 80 + 6
= (4182)10
Now we will convert this decimal number to the required octal
number by repetitively dividing by 8.

8 4182 Remainder

8 522 6 MSB

8 65 2

8 8 1

8 1 0

0 1 LSB
Then taking the value of the remainder from bottom to top, we
get;
(4182)10 = (10126)8
Therefore,
(1056)16 = (10126)8
Binary to Decimal Number System
Example:
Convert (1001001100)2 to a decimal number.
Solution:
(1001001100)2
= 1 × 29 + 0 × 28 + 0 × 27 + 1 × 26 + 0 × 25 + 0 × 24 + 1 × 23 +
1 × 22 + 0 × 21 + 0 × 20
= 512 + 64 + 8 + 4
= (588)10

Binary to Octal Number System

Using Grouping

Since, there are only 8 digits (from 0 to 7) in octal number


system, so we can represent any digit of octal number system
using only 3 bits as following below.

Octal Digit Value Binary Equivalent

0 000

1 001

2 010

3 011

4 100

5 101
Octal Digit Value Binary Equivalent

6 110

7 111
So, if you make each group of 3 bit of binary input number, then
replace each group of binary number from its equivalent octal
digits.
That will be octal number of given numbers.
Note that you can add any number of 0’s in leftmost bit (or in
most significant bit) for integer part and add any number of 0’s
in rightmost bit (or in least significant bit) for fraction part
for completing the group of 3 bit, this does not change value of
input binary number.
Example:
Convert (10101)2 to octal number system
Solution:
We can write the given binary number as:
010 101
Now as we know, in the octal number system,
010 → 2
101 → 5
Therefore, the required octal number is (25)8
Hexadecimal to Decimal Number System
Example:

Hexadecimal to Binary Table


Here is the table for hex to binary conversion. The table is
given for the first few numbers up to 16.

Hexadecimal Number Binary Number

0 0

1 1

2 10

3 11

4 100

5 101

6 110

7 111

8 1000

9 1001

A 1010

B 1011
C 1100

D 1101

E 1110

F 1111

Example:
Convert A2B16 to an equivalent binary number.
Solution: Given hexadecimal number = A2B16
First, convert the given hexadecimal to the equivalent decimal
number.
A2B16 = (A × 162) + (2 × 161) + (B × 160)
= (A × 256) + (2 × 16) + (B × 1)
= (10 ×256) + 32 + 11
= 2560 + 43
= (2603)10(Decimal number)

Now we have to convert 260310 to binary


2603/2 = 1301 = 1 MSB
1301/2 = 650 = 1
650/2 = 325 = 0
325/2 = 162 = 1
162/2 = 81 = 0
81/2 = 40 = 1
40/2 = 20 = 0
20/2 = 10 = 0
10/2 = 5 = 0
5/2 = 2 = 1
2/2 = 1 = 0
1/2 = 0 = 1 LSB

The binary number obtained is (101000101011)2


Hence, A2B16 = (101000101011)2

Bits and Bytes

At the smallest scale in the computer, information is stored


as bits and bytes.

Bit

 a "bit" is the smallest unit of storage


 A bit store just a 0 or 1
 "In the computer it's all 0's and 1's" ... bits
 Anything with two separate states can store 1 bit
 In a chip: electric charge = 0/1
 In a hard drive: spots of North/South magnetism = 0/1
 A bit is too small to be much use
 Group 8 bits together to make 1 byte

S0, everything in a computer is 0's and 1's. The bit stores


just a 0 or 1: it's the smallest building block of storage.

Byte

 "Byte" - unit of information storage


 A document, an image, a movie .. how many bytes?
 1 byte is enough to hold about 1 typed character, e.g. 'b'
or 'X' or '$'
 All storage is measured in bytes, despite being very
different hardware
 Kilobyte, KB, about 1 thousand bytes
 Megabyte, MB, about 1 million bytes
 Gigabyte, GB, about 1 billion bytes
 Terabyte, TB, about 1 trillion bytes (rare)

 One byte = collection of 8 bits


 Example: 0 1 0 1 1 0 1 0
 One byte can store one character, e.g. 'A' or 'x' or '$'

How Many Patterns with Number of Bits?


How many different patterns can be made with 1, 2, or 3
bits?

Number of Different
bits Patterns

1 0 1

00 = 0

01 =1
2 =42

10 = 2

11 = 3

000 = 0
3 2 3
=8 001 = 1
010 = 2
011 = 3
100 = 4
101 = 5
110 = 6
111 = 7

0000 = 0
0001 = 1
0010 = 2
0011 = 3
0100 = 4
0101 = 5
0110 = 6
0111 = 7
1000 = 8
4 24 = 16 1001 = 9
1010 = 10 – A
1011 = 11 – B
1100 = 12 – C
1101 = 13 -D
1110 = 14 – E
1111 = 15 - F

 3 bits vs. 2 bits


 Consider just the leftmost bit
 It can only be 0 or 1
 Leftmost bit is 0, then append 2-bit patterns
 Leftmost bit is 1, then append 2-bit patterns again
 3-bits has twice as many patterns as 2-bits

Number of Different
bits Patterns

1 0 1

2 00 01 10 11

000 001 010 011


3
100 101 110 111

 In general: add 1 bit, double the number of patterns


 1 bit - 2 patterns
 2 bits - 4
 3 bits - 8
 4 bits - 16
 5 bits - 32
 6 bits - 64
 7 bits - 128
 8 bits - 256 - one byte
 Mathematically: n bits yield 2n patterns (2 to the nth
power)
One Byte - 256 Patterns

 1 byte is group of 8 bits


 8 bits can make 256 different patterns
 How to use the 256 patterns?
 How to store a number in a byte?
 Start with 0, go up, one pattern per number, until run out
of patterns
 0, 1, 2, 3, 4, 5, ... 254, 255
 One byte can hold a number between 0 and 255
 i.e. with 256 different patterns, we can store a number in
the range 0..255
 Really good for storing characters/letters.

Bytes and Characters - ASCII Code

 Computers work in binary code. Information is coded 0’s


and 1’s. Each 0 or 1 is called a bit. In the early years
of computer development, different computer companies
applied the binary system in their own way. The code for
the letters in the word “cat” was often different in
different brands of computer.
 So, eventually a set of standards was developed.
 Computer manufacturers agreed to use one code called the
ASCII (American Standard Code for Information
Interchange).
 ASCII is an 8-bit code. That is, it uses eight bits to
represent a letter or a punctuation mark. Eight bits are
called a byte.
 A binary code with 8 digits, such as 1101 10112, can be
stored in 1 byte of computer memory.
 The word “CAT” in a word processor becomes 0100, 0011,
0100, 0001, and 0101 0100.
 The word “cat” is 0110 00112, 0110 00012, and 0111 01002.


 Each letter, number, and symbol are represented by an 8-
bit ASCII code.
 In blank space, there is also an ASCII code.
 Each number is stored in one byte (so the number is in
0..255)
 A is 65
 B is 66
 a is 96
 space is 32
 "Unicode" is an encoding for mandarin, Greek, Arabic, etc.
languages, typically 2-bytes per "character"

Typing, Bytes, and You

 Each letter is stored in a byte


 100 typed letters take up 100 bytes
 When you send, say, a text message, the numbers are sent
 Text is quite compact, using few bytes, compared to
images.

N
umbers in Computers

 One byte works well for individual characters, but


computers are also good at manipulating numbers.
 Integers are typically stored with either 4 or 8 bytes
4 bytes can store numbers between -2147483648 and
2147483647
8 bytes can store numbers between -9223372036854775808 and
9223372036854775807
 Adding in binary is just like normal addition with
carrying
But when you run out of bits you can't carry anymore
Leftmost bit indicates sign, so carrying to the leftmost
bit changes a number from positive to negative.
So adding 1 to 2147483647 goes to -2147483648!
Called Integer Overflow
 An integer overflow occurs when you attempt to store
inside an integer variable a value that is larger than the
maximum value the variable can hold.

Text Code

Text Code is a format used to represent alphabets, punctuation


marks, and other symbols.

Text Code composed of:

1. EBCDIC (Extended Binary Coded Decimal Interchange Code)


2. ASCII (American Standard Code for Information Interchange)
3. Extended ASCII
4. Unicode

EBCDIC is an 8-bit binary code for numeric and alphanumeric


characters. It was developed and used by IBM. In this code, each
decimal digit is represented by a 4-bit binary number.

Computation for 10 digits in decimal number system:

r(radix) = 10 (By this information, we can say Decimal Number


System have 10 distinct digits)

They are 0 to r-1

0 to (r-1)
0 to (10 – 1)
0 to 9 (Are the 10 distinct digits we are having in a decimal
digit)

Example:

143 is a decimal number with 3 decimal digits.

By using BCD, we will represent 0 t0 9 decimal by 4 bits binary


number.
BCD Code are also called as 8-4-2-1 Code.

8-4-2-1 is the BCD positional weight.

Positional weights 03211608141201


Writing BCD Code for decimal digit.

Decimal BCD Code for Decimal Digits


Digits
8 4 2 1
MSB
LSB
0 0 0 0
0 We call this as BCD Code for
1 0 0 0 Decimal Digits
1
2 0 0 1
0
3 0 0 1
1 (2+1=3)
4 0 1 0
0
5 0 1 0
1 Invalid or Don’t Care
6 0 1 1
0
7 0 1 1
1
8 1 0 0
0
9 1 0 0
1
10 x x x
x
11 x x x
x
12 x x x
x
13 x x x
x
14 x x x
x
15 x x x
x

Note : 10 to 15 is not a decimal digits

Conversion of Decimal Numbers to BCD

Example:

1. Find out the BCD number representation of (17)10.

17 is a decimal number with 2 decimal digits (1, 7).

1 = 0001
7 = 0111

So, (17)10 = 0001 0111 BCD known as


Packed BCD
2. (156)10 = 0001 0101 0110 BCD

Packed BCD is a BCD which is representing decimal numbers beyond


9.

Conversion of BCD to Decimal Numbers

1. 10100 BCD 0001 0100

Start from right and group it into 4 bits

In BCD code we represent 4 bits in a binary number. So, we will


start from right and make group into 4 bits.

0100 1st group = 4

0001 2nd group = 1

= (14)10 Result

2. 1001001 BCD

1001 1st group = 9

0100 2nd group = 4

= (49)10
8 4 2 1
10001100011 1st 0011 2nd 0110 3rd 0 1 0 0 463

10001010101010 1st 1010 2nd 1010 3rd 0010 4th 0010


x x 2 2
2210

Comparison Between Binary and BCD

Example:

Decimal Binary BCD


(10)10 1010 00000000
(12)10 1100 00010010

1st group = 0000 2nd 0001


0 1 1010

1st 0010 2nd 0001


2 1 1210
BCD is less efficient than binary because it is using more
number of bits . And also it is difficult to perform
mathematical operations in BCD.

ASCII (American Standard Code Information Interchange)

The ASCII Code is a code for representing 128 English characters


as numbers, with each letter assigned a number from 0 to 127.

For example, the ASCII code for uppercase M is 77.

Most computers use ASCII codes to represent text, which makes it


possible to transfer data from one computer to another.
ASCII is used as a method to give all computers the same
language, allowing them to share documents and files.

ASCII is important because the development gave computers a


common language.

As an example, the ASCII code for uppercase A is 65.


Example:

1. Using the ASCII code table above, convert the word “Blue” to
binary.

Letter Decimal Value Binary Value


6 3 1 8 4 2 1
4 2 6
B 66 1 0 0 0 0 1 0
l 108 1 1 0 1 1 0 0
u 117 1 1 1 0 1 0 1
e 101 1 1 0 0 1 0 1

The ASCII code is a 7-bit binary system.

2n-1 = binary nth power formula

So, 2n-1 = 27-1 = 26 = 64

The binary code of the word “Blue” is:

B = 1000010
l = 1101100
u = 1110101
e = 1100101

1000010110110011101011100101

2. Using the ASCII table shown below, convert the following


binary coded message into a word:

1001100 1100101 1101111 1101110

64 32 16 8 4 2 1 Decimal Letter
equivalen assigne
t d
1 0 0 1 1 0 0 76 L
1 1 0 0 1 0 1 101 e
1 1 0 1 1 0 1 109 m
1 1 0 1 1 1 1 111 o
1 1 0 1 1 1 0 110 n

Extended ASCII

Extended ASCII character sets are 8 bits or larger encodings


where the first 7 bits are identical to that of ASCII character
set.

Number of Fancy Combination Example


Bits Maths Bit
7 27 128 1101101
8 28 256 11110000
16 216 65536 11110000101010
24 224 16777216 111100001010101011110000
32 232 4294967296 11110000101010101111000010101
010

To represent text in a computer system, we give each character


its own special number. This number is called its code. We can
then store this code in the computer using binary ones and
zeros.

ASCII code allows computers to understand how to represent text.

In ASCII, each character (letter, number, symbol or control


character) is represented by a binary value.

Extended ASCII is a version that supports representation of 256


different characters.

This is because extended ASCII uses eight bits to represent a


character as opposed to seven in standard ASCII (where the 8th
bit is used for error checking).

The maximum number of characters that can be represented in


Extended ASCII is 256.

UNICODE

Computer knows only 0s and 1s. They go into the computer memory
for processing.

Convert first into 0s and 1s. It could be numbers, characters,


text, audios, or videos.

Another fact is that, all the characters are just symbols.That


means that every character we see on our screen are just
symbols.

These symbols do not make any sense to computers.

Symbols are only for humans.

Based on the picture above, on the left side we have symbols


that human can interact with the computer.

On the other side, we have 0s and 1s, the only language that
computers can understand.

We want computer to process the symbols and then we need to


convert them into 0s and 1s.

But the problem is, we cannot convert the symbols directly into
0s and 1s, because 0s and 1s are actually numbers and belong to
binary number system.

But a number from 1 number system can be converted into another


number system.

Example:

A decimal number 65 can be converted into binary number and the


binary number of 65 can be converted back into decimal number.
65 >>>> 01000001 >>>> 65

Computer scientist came up with a solution. They permanently


assign the decimal number to every symbol and created a table.

The table was created in 1960 and became famous as ASCII table.

After the creation of ASCII table, things become easier.

Symbols or characters got a representation form of numbers.

Whenever a user wants to send a symbol or character for


processing computer decoding system contact with ASCII table and
request for the symbol or characters decimal code.

The decimal code is then converted into binary and send to the
computer for processing.

For example,

If we want to send uppercase letter P for processing, the


computer decoding system received it first, then the decoding
computer system makes a request to the ASCII table and ask for
decimal code for P.

The ASCII table returns the number 80 to the decoding system and
finally the decoding system converts 80 into a binary and then
sends it to the computer for processing.

After the processing, the computer sends back the result in


binary form, now the encoding system comes in action.

The encoding system receives binary and converts binary into


decimal and then makes a request to the ASCII table and ask for
the character symbol equivalent to that number.
The ASCII table fulfills the request and returns the character
symbol to the encoding system.

The character symbol has been sent back to the screen.

This is how decoding and encoding works and the role of ASCII
table.

Computers are busy of decoding and encoding.

The use of computers was not so widespread when ASCII was


created.

Therefore, ASCII has been representing only English alphabet and


some special character symbols.

But today, computers are everywhere. And ASCII is not able to


represent every character in every language that exists in the
world. Because the size of ASCII allows only the representation
of 256 characters.

Inorder to represent characters and special characters include


in every human language that exists in the world, computer
scientist created an enhance version of ASCII. This version is
called UNICODE.

In UNICODE, can support 65,535 characters.

In UNICODE, characters from all other languages got the


representation.
The first 128 characters in UNICODE are the same as in ASCII
table.

That makes UNICODE compatible to used instead of ASCII system.

Today UNICODE has widespread accepted and ASCII is disappearing.

But ASCII will continue to live as a large part in computer


history.

Input-Output (I/O) Mechanism

There are three basic I/O mechanisms that computer systems can
use to communicate with peripheral devices:

 memory-mapped input/output
 I/O-mapped input/output
 direct memory access (DMA).

Memory-Mapped I/O

Memory-mapped I/O uses ordinary locations within the CPU's


memory address space to communicate with peripheral devices.

A memory-mapped peripheral device is connected to the CPU's


address and data lines exactly like regular memory.

So, whenever the CPU writes to or reads from the address


associated with the peripheral device, the CPU transfers data to
or from the device.
This mechanism has several benefits and only a few
disadvantages.

The advantage of a memory-mapped I/O subsystem is that the CPU


can use any instruction that accesses memory, such as mov , to
transfer data between the CPU and a peripheral.

For example, if you are trying to access a read/write or


bidirectional port, you can use an 80x86 read/modify/
write instruction, like add, to read the port, manipulate the
value, and then write data back to the port, all with a single
instruction.

In computer science, read–modify–write is a class of atomic


operations (such as test-and-set, fetch-and-add, and compare-
and-swap) that both read a memory location and write a new value
into it simultaneously, either with a completely new value or
some function of the previous value.

If the port is read-only or write-only, an instruction that


reads from the port address, modifies the value, and then writes
the modified value back to the port will be of little use.

Computer RAM is an example of volatile read-write memory, in


which the information stored in the RAM chips becomes lost or
irretrievable once the computer is turned off. This type of
memory has very fast access times, because it is not physically
encoded on a medium.

The big disadvantage of memory-mapped I/O devices is that they


consume addresses in the CPU's memory map.

Every byte of address space that a peripheral device consumes is


one less byte available for installing actual memory.

Generally, the minimum amount of space you can allocate to a


peripheral device is a page of memory (4,096 bytes on an 80x86
microprocessors).

An 8086 Microprocessor is an enhanced version of 8085


Microprocessor that was designed by Intel in 1976. It is a 16-
bit Microprocessor having 20 address lines and 16 data lines
that provides up to 1MB storage.

It consists of powerful instruction set, which provides


operations like multiplication and division easily.

I/O-mapped input/output

The microprocessor cannot do anything by itself therefore, it


needs to be linked with memory, extra peripherals, or IO
devices. This linking is called Interfacing.
The interfacing of the I/O devices in microprocessors can be
done in two ways:
1. Memory-Mapped I/O Interfacing:

In this kind of interfacing, we assign a memory address that


can be used in the same manner as we use a normal memory
location.

2. I/O Mapped I/O Interfacing:

A kind of interfacing in which we assign an 8-bit address value


to the input/output devices which can be accessed using IN and
OUT instruction is called I/O Mapped I/O Interfacing.

I/O-mapped input/output uses an address space separate from


memory, and it uses special machine instructions to transfer
data between that special I/O address space and the outside
world.

Differences between Memory-Mapped I/O Interfacing and I/O


Mapped I/O Interfacing:

Features Memory Mapped IO IO Mapped IO

IO devices are They cannot be


accessed like any accessed like any
other memory other memory
Addressing location. location.

They are assigned They are assigned


with 16-bit with 8-bit address
Address Size address values. values.

The instruction
used are LDA (load
in location A) and The instruction
Instructions STA(Store in used are IN and
Used location A), etc. OUT.

Cycles involved
Cycles involved during operation
during operation are IO read and IO
are Memory Read, writes in the case
Cycles Memory Write. of IO Mapped IO.

Any register can Only Accumulator


communicate with can communicate
the IO device in with IO devices in
Registers case of Memory case of IO Mapped
Communicating Mapped IO. IO.

216 IO ports are


possible to be Only 256 I/O ports
used for are available for
interfacing in interfacing in
Space case of Memory case of IO Mapped
Involved Mapped IO. IO.

During writing or During writing or


read cycles (IO/M` read cycles (IO/M`
= 0) in case of = 1) in case of IO
IO/M` signal Memory Mapped IO. Mapped IO.

Control No separate Special control


control signal
required since we
have unified
memory space in signals are used
the case of Memory in the case of IO
Signal Mapped IO. Mapped IO.

Arithmetic and Arithmetic and


logical operations logical operations
are performed cannot be
directly on the performed directly
Arithmetic data in the case on the data in the
and Logical of Memory Mapped case of IO Mapped
operations IO. IO.

Data Memory Access (DMA) is a special form of memory-mapped I/O


where the peripheral device reads and writes data located in
memory without CPU intervention.

Memory Addressing Techniques

A memory address is a unique identifier used by a device or CPU


for data tracking. This binary address is defined by an ordered
and finite sequence allowing the CPU to track the location of
each memory byte.

Modern computers are addressed by bytes which are assigned to


memory addresses – binary numbers assigned to a Random-Access
Memory (RAM) cell that holds up to one byte.

Hardware devices and CPUs track stored data by accessing memory


addresses via data buses.

A bus is a link between components or devices connected to a


computer. It carries data between a CPU and the system memory
via the motherboard.
3 Types of buses in a computer:

 data bus
 control bus
 address bus

A data bus—also called a processor bus, is a group of


electrical wires that sends information (data) between two or
more components. It is a computer bus that is used to transmit
data among components.

A data bus has 2 types which can operate as a serial or


a parallel bus.

Serial buses—like USB and FireWire connections—use a single


wire to both send and receive information between components.

FireWire usually refer to the types of cables, ports, and


connectors used to connect these types of external devices to

computers.

Parallel buses—like SCSI (scuzzy) connections—use many wires to


communicate between components. Those buses may be internal to
the processor or external, relative to a given component being
connected.

Small Computer System Interface is a set of standards for


physically connecting and transferring data between computers
and peripheral devices. The SCSI standards define commands,
protocols, electrical, optical and logical interfaces.
 A control bus is a computer bus that is used by the CPU to
communicate with devices that are contained within the computer.
It carries control signals from the processor to other
components.

An address bus is a computer bus architecture. It is used to


transfer data between devices. It is a computer bus that is used
to specify a physical address in the memory.

The address is stored in the form of binary numbers to enable


the data bus to access memory storage.

Before CPU processing, data and programs must be stored in


unique memory address locations.

Memory Addressing modes are methods used to locate data and


instructions in primary memory.

It determines the method used within the program to access data


either from the Cache or the RAM.

There are 5 different modes in memory addressing in Assembly


language:

 Immediate Memory Addressing Mode


 Direct Memory Addressing Mode
 Indirect Memory Addressing Mode
 Register Memory Addressing Mode
 Implied Memory Addressing Mode

Assembly language is a programming language that communicates


with the hardware of a computer directly. It allows a software
developer to code using words and expressions that can be easier
to understand and interpret than the binary or hexadecimal data
the computer stores, reads, and understand.

Common Assembly Language Application software used in Computer


Architecture:

1. IBM PC DOS Operating Systems


2. Turbo Pascal
3. Lotus 1-2-3

Example of Assembly language codes:


1: MOV eax, 3
MOV ebx, 4
ADD eax, ebx, ecx

"1:" is the label which lets the computer know where to begin
the operation.

"MOV" is the mnemonic command to move the number "3" into a part
of the computer processor.

A mnemonic is a term, symbol or name used to define or specify a


computing function.

"eax," "ebx" and "ecx" are the variables assigned in a register.

A register is one of a small set of data holding places that are


part of the computer processor. It may hold an instruction, a
storage address, or any kind of data (such as a bit sequence or
individual characters).

The first line of code loads "3" into the register "eax."

The second line of code loads "4" into the register "ebx."

Finally, the last line of code adds "eax" and "ebx" and stores
the result of the addition, which is seven, in "ecx."

Recently, LMC (Little Man Computer) assembly language is an


assembly language used to see how these 5 modes can impact on
the output or flow of a program.

Remember, with LMC (or any assembly languages) an instruction


consists of an opcode (operation code) followed by an operand.

For instance:

 Instruction: ADD 7
 Opcode (using a mnemonic): ADD
 Operand: 7

In computer assembler (or assembly) language, a mnemonic is an


abbreviation for an operation.

It's entered in the operation code field of each assembler


program instruction.

For example, on an Intel microprocessor, INC ("increase by


one") is a mnemonic. DEC decrement (decrease by 1)

Memory Address Modes

Memory address modes enable us to provide either a hard-coded


value or a memory location for the operand.

Differences between the 5 memory address modes.

Immediate Memory Addressing


It is the simplest form of addressing. It means that the data to
be used is hard-coded into the instruction itself. In this mode
we directly transfer the data into the Register or Accumulator.

An Accumulator is a type of register for short-term,


intermediate storage of arithmetic and logic data in a
computer's central processing unit (CPU).

The 8- or 16-bit data is specified in the instruction itself as


one of its operands.

The simplest way for an instruction to specify an operand is for


the address part of the instruction actually to contain the
operand itself rather than an address or other information
describing where the operand is. Such an operand is called an
immediate operand because it is automatically fetched from
memory at the same time the instruction itself is fetched. It is
immediately available for use.

This is the fastest method of addressing as it does not involve


fetching anything from the main memory at all.

Example:

1) MOV AX, 1234H

Instruction Register/Accumulator Source Operand


(OPCODE>>Operation (Immediate Value)
Code)
MOV AX 1234H
AX = 1234H

MOV (MOVE) is the instruction keyword


AX is the register/accumulator
1234H it is the data given inside the instruction.

1234H is the immediate value or immediate operand which is


provided inside the MOV instruction and then 1234H will go to AX
register.

1234H is the source operand which is stored in register AX.

AX = 1234H

2) MOV BL, 04H

Instruction Register/Accumulator Source Operand


(OPCODE>>Operation (Immediate Value)
Code)
MOV BL 04H
BL = 04H

MOV is the instruction keyword


BL is the register
04H = is the immediate value or source operand
BL = 04H

3) ADD 7 >>> MOV AM 9 AM = 9

Instruction REGISTER/ Source Operand


(OPCODE>>Operation ACCUMULATOR (Immediate Value)
Code)
AM 16
ADD 7

This instruction means that the value 7 will be added to the


value currently stored in the accumulator/register.

AM = 9
AM = 16 final value

4) MVI (Move Immediate) MVI A, 2FH


Instruction Register/Accumulator Source Operand
(OPCODE>>Operation (Immediate Value)
Code)
MVI A 2FH

A = 2FH

Direct Addressing

In this mode, we directly copy the data from the given address
into the register. Whatever the data given in a memory address
will be stored into the register or accumulator.

Example:

1. LDA 5000H, 65H

5000H address will be copied to a register or accumulator

"LDA" is the mnemonic for the opcode (load accumulator A).

The manner of specification of the target address is called the


addressing mode of the machine language instruction.

Instruction Memory Register/ Source


(OPCODE>>Operatio Address Accumulator Operand/Data
n Code)
LDA 4FFFH
5000H A 65H
5001H
5002H
A = 65H
Explanation:

At 5000H memory address, the data is 65H. After the execution of


LDA 5000H instruction, the Register/Accumulator value is 65H at
Memory Address 5000H.

2) LOAD R1, 100H

Instruction Register Memory Address


(OPCODE>>Operation
Code)
LOAD R1 100H

*Load the content of memory address 100H to Register R1


R1 = 100H
3) LOAD R1, R2

Instruction Register
(OPCODE>>Operation
Code)
LOAD R1, R2

*Load the content of register R2 to register R1


R2 = 10H
R1 = 10H

Indirect Addressing

In this mode, data transfer from memory location pointed by


register.

In accumulator, it gets direct data which is pointed by memory


location that is stored in register pair.

Example:

1) LDAX B

LDAX is a mnemonic that stands for LoaD Accumulator from memory


pointed by eXtended register pair denoted as “rp” in the
instruction.

Extended Register Pair (rp)


E
B C Memory Register Data
Address
10H 50H 1050H A 22H
A = 22H

A register pair has some data which will be pointing in memory


address location and that memory location has having data which
is transferred to the Accumulator or Register A.

Register Memory Addressing

In this mode, it lets copy data from one register to other


register.

Example:

1)MOV A, B

Before execution:

A = 10H
B = 20H

After execution, the data of B will be copied to the data of A.

A = 20
B = 20H

Implied Memory Addressing


In this mode, we don’t need any operand.

The execution/operation will happen on the data register only.


The Accumulator result will have to complement on the initial
Accumulator or Register data.

Example:

1) CMP A //CMP means Complement

A = CCH

CCH in binary is equal to: 1100 1100


Complemented: 0011 0011
3 3
A = 33H

After execution, the binary values are complemented.

When we say complemented, each bit is inverted to (like, 0


changes to 1, and 1 changes to 0). This is sometimes called as
1’s complement.

For example: in an 8-bit register:

123H is 0111 1011


1000 0100
8 4
B = 84H
CMP B

78H is 0100 1110


1011 0001
B 1
C = B1H
CMP C

Computer Organization

Computer Organization refers to the operational units and their


interconnections that realize the architectural specifications.

So, for example, the fact that a multiply instruction is


available is a computer architecture issue. How that multiply is
implemented is a computer organization issue.

Examples are things that are transparent to the programmer:

 control signals
 interfaces between computer and peripherals
 the memory technology being used

Control Signals

Control signals are the output of learning and processing block,


which are sent to different output interfaces to produce desired
output in the real physical world.
These signals can derive various output devices like motors,
speakers, and displays, as per requirement of task.
To execute an instruction, the control unit of the CPU must
generate the required control signal in the proper sequence.
There are two approaches used for generating the control
signals in proper sequence:
1. Hardwired Control unit
2. Micro-programmed control unit
Hardwired Control Unit:

A hardwired control unit is a method of generating control


signals with the help of Finite State Machines (FSM).

Finite State Machine is also known as Finite Automata (FA),


which is divided into 2 categories:

1. FA with output
2. FA without output

FA with output has 2 categories:

1. Moore Machine
2. Mealy Machine

FA without output has 3 categories:

1. Deterministic Finite Automata (DFA)


2. Non-deterministic Finite Automata (NFA)
3. Epsilon-Non-deterministic Finite Automata (E-NFA)

FSM is the simplest model of computation and it has a very


limited memory.

DFA BASIC Structure:

1.
The diagram shows the structure of the Deterministic Finite
Automata.

When we look the diagram, we can see:

1. some circles, labeled with A, B, C, D


2. some edges, with arrows pointing it
3. labels of 1, 1, 0, 0, 0, 0, 1, 1

And what are all this?

So, first of all, the first thing that we need to know our
states are the circles which are represented by A, B, C, and D.

The circles are known as states.

So, A, B, C, D are states.

Then we saw some edges:

A >>>>>> B >>1
A >>>>>> C >>0
C >>>>>> A >>0
C >>>>>> D >>1
D >>>>>> C >>1
B >>>>>> D >>0
D >>>>>> B >>0

That edges are called the transitions.

Then, how the transition operates.

A >>>>>>> B transition:

Supposed that we are in state A and that edge is labeled with 1.

The labeling of edges are known as inputs.


For the transitions reading:

If A input 1, from state A goes to state B.

If A input 0, from state A goes to state C.

So, the labeling of the edges are called inputs, and the circles
are called the states.

It shows how the states transit from one to another on getting


certain inputs.

The arrow before A state is the starting or initial state of the


DFA.

Whenever an arrow coming from any of the state which means that
it is the starting point of the reading.

State D has 2 double circles around it. Whenever we see a double


circle, that means that it is the final state order, the
terminating state.

So, the state D represented by 2 circles, is the final state of


DFA.

Those are the main things that we need to know about a DFA.

Every DFA can be designed using 5 tuples (relation instance):

1. Q: finite set of states (is the state of all states)


(Q)
2. ∑: finite set of the input symbol (are inputs) (SIGMA)
3. Q0: initial state or start state (Q NOT-STARTING
POINT)
4. F: is the set of final state (FINAL)
5. δ: Transition function that maps from Q cross
Sigma to Q (DELTA)

In the example, we have 1 final state. But it can have more


than 1
final state.

Example:

We will write the values of the 5 tuples.

Q = {A, B, C, D}
Sigma = {0, 1}
Qo = {A}
F = {D}
δ =

State Inputs
s
0 1
A C B
B D A
C A D
D B C

2.

Q = {q0, q1, q2, q3}


F = {q0}
Q0 = {q1}
Sigma = {1, 0}
Delta =
States Inputs
0 1
Q1 Q0, Q2
Q2 Q3 Q1
Q3 Q2 Q0
Q0 Q1 Q3

3.
Q = {q0. Q1, q2, q3}
F = {q3}
Q0 = {q0}
Sigma = {0.1)
Delta
States Inputs
0 1
Q0 Q1 Q0
Q1 Q2
Q2 Q3
Q3 Q1 Q3

Logic Gates

In the real-world digital devices aren’t the abstract logical


expressions of Boolean algebra, but they are the implementations
of the expressions in hardware.

The logical expressions are translated into device structures


called logic gates.

A logic gates is both a symbolic representation of a logical


operation and, when used in digital electronics, it can be an
actual circuit in hardware.

A single logic gate is usually made of several transistors and


shares space with many others in an integrated circuit.

Each of the basic operators we learned about in


the expressions have a gate symbol.

The symbol takes the place of the operator and the variables are
the inputs to the gate. The resulting value from the expression
equation is the output of the gate.

The output of a gate can be a final result or it can be


connected as an input to yet another gate.

Logic and expressions

The use and study of logic involves finding a new fact by


analyzing whether some other facts together can prove to be
true. Some facts, or conditions, when looked at together may
prove another fact to be true, or maybe false.

For example:

If the temperature outside is below freezing and you don’t have


a coat, you will feel cold. T

If you’re not sick, then you will feel well. T

If you can swim or ride in a boat in water, you will stay


afloat. T

These are statements of fact that result from some condition


being true.

Truth statements
By taking some facts and putting them into a logical form, we
can make an arithmetic that helps us analyze them and make a
conclusion.

Using the examples just mentioned, let’s turn them into some
logical word equations:

 Outside temperature is freezing AND I have no coat = I feel


cold

X and Y = Z

Z = X.Y = XY

 NOT sick = I feel well

~A = B

 I can swim OR I'm in a boat = I'm floating

X or Y = X + Y = Z

Z = X + Y

You see the AND, NOT, and OR in the example word equations.
These are called logical operators.

Every day we make decisions when we think about one or more


facts together using these operators.

Sometimes, it’s necessary for all facts to be true in order for


the conclusion to be true. This is the case when the AND
operator is used.

When analyzing facts with the OR operator, only on fact needs to


be true for the conclusion to be true also.

Making a decision may require more than just one or two facts.

When this happens, another operator is needed to combine the


facts together to make a conclusion.

In the last example word equation, we actually might not be


floating if just those two conditions are true. To correctly
prove that you’re actually floating, you need to state that
you’re in a water too.
 (I can swim OR I'm in a boat) AND I'm in water = I'm
floating

(x + y)Z = r

To prove that you’re floating, the two facts that you can swim
or you are in a boat must be made into a single fact that is
combined with the other fact that you are also in water.

Otherwise, if you’re able to swim but still on land, or in a


boat that is on the beach, you’re not floating.
Boolean algebra
As a way to reduce the conditions, or facts as we’ve called
them, into a form that is more compact, an algebra was invented.

George Boole made a type of arithmetic (Boolean algebra) that


uses symbols for the conditions, the operators, and the result.

The conditions are considered as variables that have the value


of either true or false. The operators like AND, OR, and NOT are
single character symbols.

If we want to change the statement “I’m happy when it’s sunny or


when I’m eating a donut” into a Boolean equation, we could start
by making the conditions into variables.

 Variable A = "It's sunny"


 Variable B = "I've eaten a donut"

The result then, is a variable called Q that is true when you’re


happy and is a value of an operation of A with B.

This operation is OR which is represented by the + symbol.


Q = A + B

The result of Q is true when either it’s sunny or you’ve had a


donut.
If other things make you happy, like being on vacation, you
could add that to the equation.

 Variable C = "I'm on vacation"

Q = A + B + C

It could be that you’re easy to please and you just have to feel
well to be happy.

So, you’re happy when you’re NOT sick. We’ll use the ~ to mean
NOT in our equation.

 Variable A = "I'm sick"

Q = ~A

In the situation where all conditions must be true for the


result to be true, the conditions use the AND operation.

Example:

For the sun to shine on you, the sky must be clear and it has to
be daytime. We put these two facts together with the AND
symbol ·.

 Variable A = "The sky is clear"


 Variable B = "It's daytime"
 Result Q = "The sun is shining"

Q = A · B

Expressions
Sometimes different operations on the same conditions can make
equivalent results.
If we take the opposite case of the last example where the sun
is not shining, the variables for that are:

 Variable A = "The sky is clear"


 Variable B = "It's daytime"
 Result Q = "The sun is shining"
 Result ~Q = "The sun is NOT shining"

To make the opposite of "the sun is shining" we negate, use the


NOT symbol, on both sides of the equation.

~Q = ~(A · B)

Now, let’s think of the sun NOT shining due to negative


conditions.

If the sky isn’t clear OR it’s not daytime, then the sun isn’t
shining.

So, the NOT symbol is put in before the variables for each
condition so that "the sun is NOT shining" has another equation
like this:

~Q = ~A + ~B

We see that the side with the A and B variables in both


equations are equivalent to each other since they both equate
to ~Q:

~(A · B) = ~A + ~B

The logic equation now doesn’t include the result variable Q but
instead there are two expressions that are logically equivalent
on each side.

De Morgan’s Theorem

That last equation, ~(A · B) = ~A + ~B, demonstrates an


important property in Boolean algebra.

It’s called De Morgan’s Theorem which says that the inverse


(NOT) of a conjunction (AND) is logically equivalent to the
disjunction (OR) of two inverses (NOT).

Also, the inverse (NOT) of a disjunction (OR) is logically


equivalent to the conjunction (AND) of two inverses (NOT).
This easier understood by seeing the Boolean equations for both
cases:
~(A · B) = ~A + ~B

– AND –

~(A + B) = ~A · ~B
Truth tables
A truth table is a way to see all possible conditions for the
variables in a logical expression and to chart the results.

Using the truth statement about when it’s freezing outside and
you have no coat, here’s the truth table showing the possible
conditions and their results:

It’s I have no I feel


freezing coat cold
false false false
false true false
true false false
true true true

Because you feel cold only when both conditions are true, the
statement becomes an AND expression in Boolean algebra.

 Variable A = "it's freezing"


 Variable B = "I don't have a coat"

A · B = Q

A truth table for the variables in the expression have the same
values as the table for the truth statement (true and false are
abbreviated to just T and F).

A B Q
F F F
F T F
T F F
T T T

What would happen if we changed the condition of "I have no


coat" to "I have a coat"? How does that affect truth table about
how cold you feel?

It’s I have a I feel


freezing coat cold
false false false
false true false
true false true
true true false
A B Q
F F F
F T F
T F T
T F F

To write a Boolean equation for when you feel cold, we find the
conditions in the table where Q is true.

Here we see that you will feel cold only in one row, when
condition A is true and condition B is false.

The Boolean equation for these conditions is this:

A · ~B = Q

Gate symbols
Logic gates are symbols that can directly replace an expression
in Boolean arithmetic.

Each one has a different shape to show its particular function.

The inputs (Boolean variables) enter at the left of the symbol


and the output leaves from the right.

When combined together, several gates can make a complex logical


evaluation system that has many inputs and outputs.

Digital computers are designed by connecting thousands, or


millions, of these gates together.

NOT gate

The NOT gate is a forward arrow with a small circle at the


output. The circle part of the symbol is what says that the
output is negating the input.

OR gate
Th OR gate has a curved input side and a sharp pointed output.

AND gate

The AND gate has a flat input side and round output side.

Exclusive OR (XOR) gate

The exclusive or gate symbol is just like the OR gate but it has
an additional curved line crossing the inputs.

Combined logic
When you connect multiple gates together you have a combined
logic system or combinatorial logic.

To design a combined logic system, we can use a truth table to


match logical outputs for out various input conditions.

Boolean expressions are written from the conditions in the


table.

Then, we can directly convert the expression into a diagram of


logic gates.
Let’s map the input and output conditions in a truth table for a
combined logic system for XOR.

We’ll find all the conditions that cause a true result and
create a Boolean expression for them.

A ⊕
A B
B
F F F
F T T
T F T
T T F

There are two conditions where the result column


has true values.

The first condition is when A is false and B is true which is


expressed as ~A · B.

The second condition is when A is true and B is false which is


expressed as A · ~B.

Our XOR expression is true when one of these conditions


are true which is written like:

A ⊕ B = (~A · B) + (A · ~B)

In code this expression is formed with these logic blocks:

A not B or AB not and or set Q to

Converting the equation to logic gates makes the following


diagram.

Notice how each gate “connects” the variables together just like
the logic blocks in the code above.

However, if we take the other two unused conditions from the


truth table that make the XOR operation false, can make the
negative equation for XOR, called a NXOR:

~(A ⊕ B) = (~A · ~B) + (A · B)

To get back to A ⊕ B we have to negate this negative equation.


Then, with the help of De Morgan’s Theorem, we get a different
equation for XOR but it’s still logically equivalent to the
original one.
A ⊕ B = (A + B) · ~(A · B)

When this equation is converted to logic gates, there’s one


fewer gate than in the first diagram.

De Morgan’s Theorem

That last equation, ~(A · B) = ~A + ~B, demonstrates an


important property in Boolean algebra.

It’s called De Morgan’s Theorem which says that the inverse


(NOT) of a conjunction (AND) is logically equivalent to the
disjunction (OR) of two inverses (NOT).

Also, the inverse (NOT) of a disjunction (OR) is logically


equivalent to the conjunction (AND) of two inverses (NOT).

This is easier understood by seeing the Boolean equations for


both cases:
~(A · B) = ~A + ~B

– AND –

~(A + B) = ~A · ~B

Micro-programmed Control Unit

Basically, the control unit is a component in the processor that


generates the control signals that are essential to control the
proper functioning of the processor.

To design the control unit there are two approaches used:

1. using a hardwired control unit


2. using a microprogrammed control unit

These two control units can be differentiated on the basis that


the hardwired control unit is designed using hardware components
such as flip-flops, logic gates, and other digital components.
The hardwired control unit is used to design RISC style
processor. It generates control signals faster than a
microprogrammed control unit.

The microprogrammed control unit uses the software approach to


generate the control signals.

The generation of the control signals is determined with the


help of the program.

This program is stored in the special memory of the processor


which is smaller and faster.

This memory is termed as microprogram memory or control store


and the program is termed as the microprogram.

The block diagram of the microprogrammed control unit is


comprised of the components like:

1. instruction registers
2. microprogrammed/microinstruction address generator
3. microprogram counter
4. control signals

An instruction register holds a machine instruction that is


currently being executed. It holds the currently queued
instruction for use.

Microprogrammed address generator determines the address


sequence that is read from control memory.

A microprogram counter is used to cycling the sequence of


control.

A control store is the part of a CPU's control unit that stores


the CPU's microprogram.

It is usually accessed by a microsequencer, a device that


generates addresses in a microprogram.

A control store implementation whose contents are unalterable is


known as a Read Only Memory or Read Only Storage; one whose
contents are alterable is known as a Writable Control Store.

A control signals are used to identify the nature of operation.

There are 3 control signals that are available in 8085


microprocessors:

1. RD (Read)
2. WR (Write)
3. ALE (Address Latch Enable)

RD − This signal indicates that the selected IO or memory device


is to be read and is ready for accepting data available on the
data bus.

WR − This signal indicates that the data on the data bus is to


be written into a selected memory or IO location.

ALE − It is a positive going pulse generated when a new


operation is started by the microprocessor. When the pulse goes
high, it indicates address. When the pulse goes down it
indicates data. It is used to enable or disable the address bus.

Microprogrammed Control Unit Workflow

Step 1: The instruction to be executed is fetched and stored in


the instruction register.

Step 2: The microprogrammed/microinstruction address generator


component fetches the instruction from the instruction register
and decodes the instruction.

Step 3: On decoding the instruction,


microprogrammed/microinstruction address generator generates the
starting address of the corresponding micro routine in the
control store.

Step 4: The microprogrammed/microinstruction address generator


loads the starting address of the microprogram routine into the
microprogram counter. This helps the microinstruction address
generator to track the addresses of successive microinstructions
of the routine.

Step 5: The microprogrammed/microinstruction address generator


increments the microprogram counter to read the successive
instruction in the micro-routine present in the control store.

Step 6: The end of the micro-routine can be determined with the


help of a bit in the last instruction of the micro-routine. This
bit is termed the end bit. When the end bit is equal to 1 it
defines the successful execution of the micro-routine. This
causes the new instruction to be fetched.

Micro-routine is a sequence of control words corresponding to


the control sequence of a machine instruction.
Microprogrammed Control Unit uses a sequence of micro-
instruction in micro-programming language.

The signals are generated by a program which is similar to


machine language programs.

It can be designed after getting the flow.

Flow means at what time or which instruction, which control


signal has to be generated.

It uses fetch and decode instructions.

Example:

Fetch the next


instruction

Decode instruction

Ix Iz
Iy

to D,B,E F,H,G E,H

t1 C,A,H G D,A,C

t2 G,C B,C

3 Instruction Registers:

1.Ix
2. Iy
3. Iz

The instruction registers or current instruction register is the


part of a CPU's control unit that holds the instruction
currently being executed or decoded.

CPU Time: t0, t1, t2

CPU time is the measurement of the length of time that data is


being worked on by the processor and is used as an indicator of
how much processing is required for a process or how CPU
intensive a process or program is.
Control Signals that are generated based on the design:

t0 >>>>> (D,B,E), (F,H,G), (E,H)


t1 >>>>> (C,A,H), (G), (D,A,C)
t2 >>>>> (G,C), (B,C)

Control signals are the output of learning and processing block,


which are sent to different output interfaces to produce desired
output in the real physical world.

There are 2 types of Micro-instructions based on the control


word stored in Control Memory (CM):

1. Horizontal
2. Vertical

Horizontal Micro-instruction is where the control signals are


represented in the decoded binary format that is 1 bit/CS.

Example:

1. If 53 Control signals are present in the processor then


there are 53 bits are required. More than 1 control signal can
be enabled at a time.

2. A computer has 4 instructions (ADD, SUB, MUL, DIV). The


system has 16 General Purpose Registers (GPRs), from R0 – R15.
Perform, MUL R3, R6 using horizontal micro-instruction. Write
the encoded and decoded format.

Solution:

INSTRUCTION ENCODED FORMAT DECODED FORMAT


A B D0 D1 D2 D3
ADD 0 0 1 0 0 0
SUB 0 1 0 1 0 0
MUL 1 0 0 0 1 0
DIV 1 1 0 0 0 1

16 – BITS GPRs
REGIS ENCODE DECODED FORMAT
TERS D
FORMAT
A B C D D D D D D D D D D D D10 D11 D12 D13 D14 D15
0 1 2 3 4 5 6 7 8 9
R0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R2 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
R3 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
R4 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
R5 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
R6 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
R7 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
R8 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
R9 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
R10 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
R11 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
R12 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
R13 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
R14 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
R15 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1

DECODED FORMAT

MUL R3, R6

0010 000100000000000 0000001000000000 ANSWER

Add R7, R9

1000 0000000100000000 0000000001000000

Drawing the format for Horizontal Micro-instruction

Indivi Individu
dual al
CS Control
(Inter Micro-instruction Branch
Signal
nal to Address
lines
CPU)

2. Vertical Micro-instruction

The control signals are represented in the encoded binary


format.
Example

Solution:
INSTRUCTION ENCODED FORMAT DECODED FORMAT
A B D0 D1 D2 D3
ADD 0 0 1 0 0 0
SUB 0 1 0 1 0 0
MUL 1 0 0 0 1 0
DIV 1 1 0 0 0 1

16 – BITS GPRs
REGIS ENCODE DECODED FORMAT
TERS D
FORMAT
A B C D D D D D D D D D D D D10 D11 D12 D13 D14 D15
0 1 2 3 4 5 6 7 8 9
R0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R2 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
R3 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
R4 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
R5 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
R6 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
R7 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
R8 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
R9 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
R10 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
R11 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
R12 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
R13 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
R14 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
R15 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1

ENCODED FORMAT

MUL R3, R6
10 0011 0110 Answer

Control Unit Circuit Design can be done in 2 different ways:

1. Hardware Control Circuit


2. Microprogram Control Unit

Wilkes Design on Microprogrammed Control Unit: (BUS APPROACH)

Data
Source

D1
D2
D3
D4
D5
Return Address Equivalent to Decimal:
1, 2, 3, 6, 4, 5, 7, 7, 7

IR (Instruction Register) temporarily holds/store the current


instruction.

Control Memory Address Register (CMAR) is used to handle the


address transferred to the memory unit, and this can be handled
either using a bus approach or direct input declaration for the
memory.

Control Signals: C0, C1, C2, C3, C4, C5, C6, C7

Return Address Equivalent: 1, 2, 3, 6, 4, 5, 7, 7, 7

A decoder is a combinational logic circuit that is used to


change the code into a set of signals. It is the reverse process
of an encoder.

HARDWARE CONTROL UNIT DESIGN (DIRECT INPUT DECLARATION)

DECODE LINE CONTROL SIGNAL ADDRESS OF NEXT


ACTIVATED GENERATED MICRO-INSTRUCTION
000 C0, C4, C6, C7 001
001 C1, C3 010
010 C2, C4 011
011 C0, C3, C5, C6 ?
EITHER
011 C0, C3, C5, C6 IF TRUE THEN ADDRESS
110
110 C0, C1, C7 111
111 C0, C4, C5, C7 LOAD NEXT
INSTRUCTION IN IR
OR
011 C0, C3, C5, C6 IF FALSE THEN
ADDRESS 100
100 C0, C7 101
101 C3, C5, C6 111
111 C0, C4, C5,C7 LOAD NEXT
INSTRUCTION IN IR

Activity:

References:

https://www.javatpoint.com/risc-vs-cisc#:~:text=Examples%20of
%20CISC%20processors%20are,x86%20and%20the%20System%2F360.

https://www.youtube.com/watch?v=yi0FhRqDJfo

https://byjus.com/maths/number-system/

https://web.stanford.edu/class/cs101/bits-bytes.html#:~:text=a
%20%22bit%22%20is%20atomic%3A,states%20can%20store%201%20bit

https://www.intel.com/content/dam/www/program/education/us/en/
documents/the-journery-inside/digital/tji-digital-info-
handout4.pdf
https://www.youtube.com/watch?v=3CKaka6n_ek

https://www.youtube.com/watch?v=0rLiYpy2CqQ

https://www.webopedia.com/definitions/ascii/#:~:text=It%20is%20a
%20code%20for,from%20one%20computer%20to%20another.

https://www.youtube.com/watch?v=hyXGB8UYDVg
https://www.youtube.com/watch?
v=LNPBr3WvuNg&list=RDLVhyXGB8UYDVg&index=4
https://www.vivaxsolutions.com/web/lmc.aspx
https://tesdanciireviewer.blogspot.com/2012/08/identifying-
motherboard-hardware-parts.html
https://www.javatpoint.com/examples-of-deterministic-finite-
automata
https://www.youtube.com/watch?v=WsGAo-_rHSo

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy