CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
COA-Unit-1-Basics.ppt
1. A computer is an electronic device which accepts information and processes the
information according to the program and produces the output.
-- used for information processing.
A computer has four functions:
1. Accepts data Input ---- The Information Processing Cycle
2. Processes data --------- Processing
3. Produces output ------ Output
4. Stores results ----------- Storage
List of instructions are called programs & internal storage is called computer
memory
INTRODUCTION
What is a computer?
2. Basic terms:
Computer architecture
» The functional operation of the individual H/W units in a computer
system & the flow of information & controlling.
» The structure & behavior of the computer as seen by the user
» Include instruction formats, instruction set, addressing etc.
Computer organization
» Describes the function & design of the various units of computer that
store & process information. It also deals with the interface & external
devices.
» The way the H/W components operate & connected together to form a
computer system.
INTRODUCTION
3. Some Beginning Terms
Hardware : The hardware includes devices such as keyboard, monitor,
mouse etc.
Software : The software tells the computer what to do in the form of
instructions.
Data : Data is the raw facts given to the computer. Individual facts like
first name, price, quantity ordered etc.
Information : Data which has been messaged into a useful form.
14. 5. Handheld PCs (PDAs)
The most popular hand-held computers are those that are specifically
designed to provide PIM (personal information manager) functions, such as
a calendar and address book.
15. 6. Smart Phones:
Can send and receive SMS, MMS
Uses s/w like personal organizers,
Equipped with cameras and music players
Can access Web, send and receive E-mails.
19. 2. Mainframe Computers:
Large computer system, occupies a large area.
Connected to desktop computers and mini comps near by.
32 bit or 64 bit computers.
can handle up to 64 to 100 terminals.
CPU speed 100MIPS.
IBM-370/168,IBM-3033/3090,UNIVAC1100/60, VAX-8000
MAINFRAME ENVIRONMENT:
Terminals:
1. Dumb terminals.
-does not store or process
-an i/p or o/p device.
2. Intelligent terminals
- Can process, no storage.
- smart terminals.
22. A minicomputer, is a computer of a size intermediate between a microcomputer
and a mainframe.
a multi user system
CPU speed 10-30 MIPS
16-96 Main memory capacity.
Disk size 40-80 GB.
Typically, minicomputers have been stand-alone computers (computer systems
with attached terminals and other devices)
Used in small and mid-size business applications and to large enterprises for
department-level operations.
3. Minicomputer:
In recent years, the minicomputer has evolved into the "mid-range server"
and is part of a network. IBM's as/400e is a good example.
23. A supercomputer generates large amounts of heat and must be cooled.
In modern supercomputers built of many conventional CPUs running in
parallel.
4. Supercomputers
Supercomputers consume and produce massive amounts of data
in a very short period of time .
The fastest type of computer.
Supercomputers are very expensive and are employed for specialized
applications that require immense amounts of mathematical calculations.
For example, weather forecasting requires a supercomputer. Other uses of
supercomputers include animated graphics, fluid dynamic calculations,
nuclear energy research, and petroleum exploration
27. Programming:
A computer program is just a collection of the instructions necessary to solve
a specific problem .
The approach or method that we use to solve the problem is called an
algorithm
High level languages like Pascal, Fortran, Cobol , C, C++ and so on.
Assembly language
29. Three types of programming languages are;
1. Machine languages :
» Strings of numbers giving machine specific instructions
» Example:
1001010101
1. Assembly languages
» English-like abbreviations representing elementary computer
operations (translated via assemblers)
» Example:
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY
Programming Languages:
30. 3. High-level languages
» Codes similar to everyday English
» Use mathematical notations (translated via compilers)
» Example:
gross Pay = base Pay + overtime Pay
33. A computer consists of five functionally independent main parts:
1. Input Unit 2. Memory Unit
3. Arithmetic & Logic unit (ALU) 4. Output Unit
5. Control unit.
Fig: Basic functional units of a computer
Basic Functional unit
34. Input Unit
Everything we tell the computer is Input.
Types of Input:
Data is the raw facts given to the computer.
Programs are the sets of instructions that direct the computer.
Commands are special codes or key words .
--a menu of commands like "Open" on the File menu.
User response is the user's answer to the computer's question,
-- OK, YES, or NO
-- or by typing in text, for example the name of a file.
43. What is Output?
Output is data that has been processed into useful form, now called Information.
Types of Output :
Hard copy:
printed on paper or other permanent media
Soft copy:
displayed on screen or by other non-permanent means
Output Unit
44. Categories of Output
Text documents including
Reports ,letters, etc.
Multimedia
Combination of text,
Graphics, video, audio
Graphics
Charts ,graphs, pictures
46. Arithmetic & Logic unit (ALU)
Performs basic arithmetic such as addition, subtraction,
division and multiplication operations.
Also logical operations are performed here under the
supervision of control unit.
47. Functions of control unit:
Fetching data and instructions from the memory.
Interpreting the instructions.
Controlling the transfer of data and instructions to and
from memory.
Controlling the input and output devices.
The overall supervision of a computer
Control unit
48. Memory Unit:
CPU Registers.
The memory unit can be either primary (RAM) or secondary memory
Memory unit takes the data from input device and stores it until the
computer is ready to process it.
Main memory (temporary): RAM is a volatile memory.
Secondary memory (permanent): The data or results be stored
permanently using secondary storage devices such as hard disc drive
or CD-ROM etc.
Cache memory: In-built to the processor or outside the processor,
speed increases.
49. A memory address holds 1 byte of data where
1 bit =0 or 1, on or off
1 byte = 8 bits
1 kilobyte (K or KB) =1024 bytes
1 megabyte (MB) =1024 kilobytes
Why 1024 instead of 1000 bytes per kilobyte.
That is because computers don't count by tens like people.
Computers count by twos and powers of 2.
1024 is 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 that is 2 times itself ten
times.
MIPS (million instructions per second), is one way to measure
computer speeds
53. To perform a given task an appropriate program consisting of a list of
instructions is stored in the memory.
Individual instructions are brought from the memory into the processor, which
executes the specified operations.
Data to be stored are also stored in the memory.
Examples: - Add LOCA, R0
This instruction requires the performance of several steps,
First the instruction is fetched from the memory into the processor.
The operand at LOCA is fetched and added to the contents of R0
Finally the resulting sum is stored in the register R0
Basic Operational Concepts
54. Example 2:
Load LOCA, R1
Add R1, R0
Transfers between the memory and the processor are started by sending the
address of the memory location to be accessed to the memory unit and
issuing the appropriate control signals.
The data are then transferred to or from the memory.
55. Figure 1.2. Connections between the processor and the memory.
Processor
Memory
PC
IR
MDR
Control
ALU
Rn 1
-
R1
R0
MAR
n general purpose
registers
IR – Instruction Register; PC – Program Counter;
MAR – Memory Address Register; MDR – Memory Data Register
56. The instruction register (IR):- Holds the instructions that is currently being
executed. Its output is available for the control circuits which generates the
timing signals that control the various processing elements in one execution of
instruction.
The program counter PC:-
This is another specialized register that keeps track of execution of a program. It
contains the memory address of the next instruction to be fetched and executed.
Besides IR and PC, there are n-general purpose registers R0 through Rn-1.
57. The other two registers which facilitate communication with memory are: -
• MAR – (Memory Address Register):- It holds the address of the location to be
accessed.
• MDR – (Memory Data Register):- It contains the data to be written into or
read out of the address location.
58. Operating steps are:
Programs reside in the memory & usually get these through the I/P unit.
Execution of the program starts when the PC is set to point at the first instruction
of the program.
Contents of PC are transferred to MAR and a Read Control Signal is sent to the
memory.
After the time required to access the memory elapses, the address word is read
out of the memory and loaded into the MDR.
Now contents of MDR are transferred to the IR & now the instruction is ready to
be decoded and executed.
If the instruction involves an operation by the ALU, it is necessary to obtain the
required operands.
59. An operand in the memory is fetched by sending its address to MAR &
Initiating a read cycle.
When the operand has been read from the memory to the MDR, it is
transferred from MDR to the ALU.
After one or two such repeated cycles, the ALU can perform the desired
operation.
If the result of this operation is to be stored in the memory, the result is sent
to MDR.
Address of location where the result is stored is sent to MAR & a write cycle
is initiated.
The contents of PC are incremented so that PC points to the next instruction
that is to be executed.
60. A group of lines that serve as a connecting path for several devices is called a bus.
The simplest and most common way of interconnecting various parts of the
computer.
To achieve a reasonable speed of operation, a computer must be organized so
that all its units can handle one full word of data at a given time.
In addition to the lines that carry the data, the bus must have lines for address
and control purpose.
Bus structure
62. • Receiving and interpreting user commands
• Entering and editing application programs and storing them as files in secondary
storage devices
• Managing the storage and retrieval of files in secondary storage devices
• Running standard application programs (e.g. word processors, games or user’s
applications) with data supplied by the user
• Controlling I/O units to receive input information and produce output results
• Translating programs from source form prepared by the user into object form
consisting of machine instructions
• Linking and running user-written application programs with existing standard
library routines, such as numerical computation packages
Software
64. 1. High processing speed.
The immense speed of the computer enables it to do millions of such steps in
a second. (MIPS)
2. Accuracy.
3. Reliability (Consistent results)
Failures are usually due to human error, -Gives consistent results.
4. Versatility (wide area of applications)
5. Storage capacity
A computer can keep huge amounts of data.
6. Diligence (unrest)
Characteristics of a computer:
65. Processor Clock
A clock – a timing signal that controls processor circuits
A clock cycle – a regular time interval during which the
processor performs a single basic step
Each instruction to be performed by the processor is
divided into a sequence of basic steps
P – the length of one clock cycle
R=1/P (clock rate)
66. Basic Performance Equation
N S
T
R
N is the actual number of instruction executions
S is the average number of basic steps needed to
execute one machine instruction
R is the clock rate
T is the processor time required to execute a program
that has been prepared in some high-level language
67. Historical Overview
• “The 1st Generation”: vacuum tube technology (1945-1955)
A few milliseconds per arithmetic operation
• “The 2nd Generation”: transistor technology (1955-1965)
High-level languages, compilers, separate I/O processors
• “The 3rd Generation”: Integrated-circuit technology(1965-1975)
Operating systems, Microprogramming, multiprogramming,
pipelining, cache memories, IC, MSI, LSI.
Electronic Computers
68. Historical Overview
• “The 4th Generation”: VLSI (Very Large Scale Integration) (1975- present)
Microprocessors, virtual memories, concurrency, networks,
high resolution graphics, Personal Computer (Apple,
Microsoft, etc.), Internet
• Beyond the 4th Generation: artificial intelligence, massively
parallel machines, extensively distributed systems
Electronic Computers
69. • Numbers, arithmetic operations, characters.
• Addition of unsigned numbers
• Subtraction of unsigned numbers
• Addition of positive numbers
• Subtraction of positive numbers
• Addition/subtraction of signed numbers
• Overflow of arithmetic operation.
• Carry of arithmetic operation
Machine instructions and programming
• Sign-And-Magnitude
• 1’s Complement
• 2’s Complement
75. Lower byte addresses are used for the
more significant bytes (left most)
Lower byte addresses are used for the
least significant bytes (right most)
Big-endian and Little-endian memory organization
79. Perform –10 add –13
-10 decimal = 10110
-13 decimal = 10011
sum = 1 ) 01001
Actually 101001 is –23, but uses 6 bits
Result range is 5 bits !!
So considered as overflow
80. -14 decimal
01110 is + 14 decimal
10001 + 1 is 2’s complement of +14
10010 is –14 decimal
perform -14 add 11
10010
+ 01011
= 11101 is –3 decimal
81. Exercises
Address in Hex Data stored (binary)
2000 0011 1000
2001 0011 0100
2002 0011 0010
2003 0011 1001
Interpret the storage
1) Big-endian storage of 2 hex words of 4-digits each
2) Big-endian storage of 2 BCD words of 4-digits each
3) Little-endian storage, in ASCII, of a4-digit signed hex word
4) Little-endian storage, in ASCII, of a 4-digit BCD word
82. 1) 3834 H and 3239 H ; convert it to decimal (14388 & 12857)
2) 3834 & 3239 decimal
3) 9248 hexa signed. - 28088 Decimal
4) 9248 decimal.
83. Single address example
Load A
Add B
Store C
C [A] +[B]
Two address example
Move A, R1
Add B, R1
Move R1, C
C [A] +[B]
84. •Word alignment
•Even address boundary !!??
•Word address, character address
•Memory access: load (Read or Fetch ) / store instructions
85. Instructions and instruction sequencing
• Program consists of sequence of instructions
• data transfers between the memory and processor registers
• Arithmetic and logic operations on data
• Program sequencing and control
• I/O transfers
86. Instructions and instruction sequencing
Register transfer notation
R1 [LOC]
R3 [R1] +[R2]
Assembly language notations
assembly language ?
MOV LOC, R1
ADD R1, R2, R3
87. Instructions and instruction sequencing
Basic instruction types
C = A + B ; high level notation
ADD A, B, C ; i.e. C [A] + [B]
Generally,
operation source1, source2, destination
One address instructions
Two address instructions
Three address instructions
88. One address instructions
ADD A
LOAD A
STORE A
ADD B
STORE C etc
Two address instructions
MOVE B, C
ADD A, C ; C [A] + [C]
Three address instructions
ADD A, B, C etc
89. Instruction execution and straight line sequencing
C [A] +[B]
Load A
Add B
Store C
Load A, Ri
Store Ri, A
Add A, Ri
90. Instruction execution and straight line sequencing
ADD Ri, Rj
ADD Ri, Rj, Rk
MOVE A, Ri
LOAD A, Ri
MOVE Ri, A
MOVE A, Ri
MOV B, Rj
ADD Ri, Rj
MOVE Rj, C
MOVE A, Ri
ADD B, Ri
MOVE Ri, C
96. Generating Memory Addresses
Addressing Modes
Different ways in which the location of an operand is specified in an instruction.
1. Immediate
2. Register
3. Absolute (Direct)
4. Indirect
5. Index
6. Base with index
7. Base with index and offset
8. Relative
9. Auto-increment
10. Auto-decrement
# Value Operand =Value
Ri EA = Ri
LOC EA = LOC
(Ri) EA = [Ri]
(LOC) EA = [LOC]
X(Ri) EA = [Ri] + X
(Ri,Rj) EA = [Ri] +[Rj]
X(Ri, Rj) EA = [Ri] +[Rj] + X
X(PC) EA = [PC] + X
(Ri) + EA = [Ri] ; Increment Ri
-(Ri) Decrement Ri ; EA = [Ri]
EA is
Effective Address
97. Generating Memory Addresses
Addressing Modes
Register Mode
The operand is the contents of a processor register.
The name of the register is given in the register.
MOVE R1, R2
Absolute (Direct) Mode
The operand is in a memory location; the address of this
location is given explicitly in the instruction.
MOVE LOC, R2
ADD R2, COUNT
98. Generating Memory Addresses
Addressing Modes
Immediate Mode
The operand is given explicitly in the instruction
MOVE 200, R0 ; 200 is immediate data
MOVE #200, R0
MOVE B, R1
ADD #6, R1 ; A = B + 6
MOVE R1, A
99. Generating Memory Addresses
Addressing Modes
Indirection and Pointers
Indirect Mode
The Effective Address of the operand is the contents
of a register or memory location whose address
appears in the instruction.
ADD (R1), R0 ; Register Indirect
ADD (A), R0 ; Memory Indirect
Fig 2.11 page 50 Fig 2.12 :Program –sorting ‘n’ words
100. Indexing and Arrays
Add 20(R1), R2
.
.
.
.
.
.
Operand
1000
1020
20 = offset
1000 R1
Offset is given as a constant
Adding a constant to the register.
Case 1
101. Indexing and Arrays
Add 1000(R1), R2
.
.
.
.
.
.
Operand
1000
1020
20 = offset
20 R1
Offset is given as a constant
Adding a constant to the register.
Case 2
102. n
Student ID
Test 1
Test2
Test3
Student ID
Test1
Test2
Test3
.
.
.
N
LIST
LIST+4
LIST+8
LIST+12
LIST+16
Student 1
Student 2
An example of indexing: add the test scores
Move #LIST, R0
Clear R1
Clear R2
Clear R3
Move N, R4
LOOP Add 4(R0), R1
Add 8(R0), R2
Add 12(R0), R3
Add #16, R0
Decrement R4
Branch>0 LOOP
Move R1, SUM1
Move R2, SUM2
Move R3, SUM3
103. Relative Addressing
0FF4 Move N, R1
0FF8 Move #NUM1, R2
0FFC Clear R0
1000 LOOP Add (R2), R0
1004 Add #4, R2
1008 Decrement R1
100C Branch >0 LOOP
100F Move R0, SUM
The relative address is –16
-16(PC)
104. Auto Increment Mode
0FF4 Move N, R1
0FFB Move #NUM1, R2
0FFC Clear R0
1000 LOOP Add (R2) +, R0
1004 Decrement R1
1008 Branch >0 LOOP
1012 Move R0, SUM
An example …
Post increment !
106. Assembly Language
Mnemonics (acronyms of the operation to be performed)
Assembly language: (complete set of symbolic names and rules for
their use constitute a programming language )
Syntax : (set of rules for using the mnemonics in the specification
of complete instructions and program )
Assembler:
Source program:
Object program:
Opcode:
107. Assembler Directives
How to interpret the names
Where to place the instructions in the memory
Where to place the data operands in the memory
Instruction format
Label Operation Operand(s) Comments
108. Assembler Directives
SUM EQU 200
ORIGIN 204
N DATAWORD 100
NUM1 RESERVE 400
ORIGIN 100
START MOVE N, R1
MOVE #NUM1, R2
CLR R0
LOOP ADD (R2), R0
ADD #4, R2
DEC R1
BGTZ LOOP
MOVE R0, SUM
RETURN
END START
100 Move N, R1
104 Move #NUM1, R2
108 Clear R0
LOOP 112 Add (R2), R0
116 Add #4, R2
120 Dec R1
124 Branch>0 LOOP
128 Move R0, SUM
132 ….
….
….
SUM 200
N 204 100
NUM1 208
NUM2 212
….
….
NUMn 604