Unit2 21CSS201T Modified
Unit2 21CSS201T Modified
AND ARCHITECTURE
Course Outcome
– Data PROCESSING
– Data STORAGE Data = Information
– Data MOVEMENT
– CONTROL Coordinates How
Information is Used
Functions of a computer
The operations performed by a computer using the
functional units can be summarized as follows:
• It accepts information (program and data) through
input unit and transfers it to the memory.
• Information stored in the memory is fetched, under
program control, into an arithmetic and logic unit for
processing.
• Processed information leaves the computer through
an output unit.
• The control unit controls all activities taking place
inside a computer.
Information in a computer -- Instructions
• Instructions specify commands to:
– Transfer information within a computer (e.g., from memory to
ALU)
– Transfer of information between the computer and I/O devices
(e.g., from keyboard to computer, or computer to printer)
– Perform arithmetic and logic operations (e.g., Add two
numbers, Perform a logical AND).
• A sequence of instructions to perform a task is called a program,
which is stored in the memory.
• Processor fetches instructions that make up a program from the
memory and performs the operations stated in those instructions.
Information in a computer -- Data
• Data are the “operands” upon which instructions
operate.
• Data could be:
– Numbers,
– Encoded characters.
• Data, in a broad sense means any digital information.
• Computers use data that is encoded as a string of
binary digits called bits.
Input unit
Binary information must be presented to a computer in a specific format. This
task is performed by the input unit:
- Interfaces with input devices.
- Accepts binary information from the input devices.
- Presents this binary information in a format expected by the computer.
- Transfers this information to the memory or processor.
Memory unit
• Memory unit stores instructions and data.
– Recall, data is represented as a series of bits.
– To store data, memory unit thus stores bits.
R2
Example
Add R1, R2
T1 Enable R1
T2 Enable R2
T3
Enable ALU for addition operation
W/R 0 1 1
CS RD
A0 PROCESSOR
1 0 0
A1
A2
1 0 1
ADDRESS BUS
1 1 0
D7 D0
D0 D7 1 1 1
DATA BUS
•23 = 8 i.e. 3 address line is required to select 8 location
word length.
• The memory of a computer •
can be schematically •
•
last word
represented as a collection
of words as shown in Figure Main Memory words.
1.
Memory Locations And Addresses
•Main memory is the second major subsystem in a computer. It
consists of a collection of storage locations, each with a unique
identifier, called an address.
Example 2
A computer has 128 MB of memory. Each word in this computer is
eight bytes. How many bits are needed to address any single word in
memory?
Solution
The memory address space is 128 MB, which means 227. However,
each word is eight (23) bytes, which means that we have 224 words. This
means that we need log2 224, or 24 bits, to address each word.
Memory Operations
• Today, general-purpose computers use a set of instructions called a
program to process data.
• A computer executes the program to create output data from input
data
• Both program instructions and data operands are stored in memory
• Two basic operations requires in memory access
• Load operation (Read or Fetch)-Contents of specified
memory location are read by processor
• Store operation (Write)- Data from the processor is stored in
specified memory location
Assignment of Byte Address
• Big-endian and little-endian are terms that describe
the order in which a sequence of bytes are stored in
computer memory.
• Big-endian is an order in which the "bigend" (most
significant value in the sequence) is stored first (at the
lowest storage address).
• Little-endian is an order in which the “Little end"
(least significant value in the sequence) is stored first
(at the lowest storage address).
Memory stores both data and instructions
• Consider 32-bit long word in each location which can
store
– 32-bit 2’s
n-1complement
n-1 number (integer):
(-2 ) – (2 –
1)
= 230 )
• If n = 32: - 2G – 2G-1 (recall that G
- It is often
– 4 ASCII characters convenient to
byte byte address operands
which are as short
byte as 1 byte
byte
Op Code Address information
– A machine instruction
byte
Assignment of byte addresses
• Little Endian (e.g., in DEC, Intel)
» low order byte stored at lowest address
» byte0 byte1 byte2 byte3
• 8000 54
• 8001
• 96
8002
• 8003 78
• 8004 46
|
Big Endian
0 0 1 2 3 0 3 2 1 0
4 4 5 6 7 4 7 6 5 4
• •
• •
• •
k k k k k k k k k k
2 -4 2 -4 2 -3 2- 2 2 - 1 2 - 4 2- 1 2 - 2 2 -3 2 -4
• R2 [LOCN]
• R4 [R3] +[R2]
Data transfer Instructions
They are also called copy instructions.
Some instructions in 8086:
MOV -Copy from the source to the destination
LDA - Load the accumulator
STA - Store the accumulator
PUSH - Push the register pair onto the stack
POP - Pop off stack to the register pair
Data Manipulation Instructions
Load address to PC
Load content of PC to IR
Execute Instruction
Effective Address
= Content of Index Register +
Address part of the instruction
Relative Addressing
A version of displacement addressing
In this addressing mode,
• Effective address of the operand is obtained by adding
the content of program counter with the address part of the
instruction.
Effective Address
= Content of Program Counter +
Address part of the instruction
Auto increment mode
A special case of Register Indirect Addressing Mode where
Effective Address of the Operand
= Content of Register
Address bus
ALU Register
Section
Data bus
• More compactly as
message DB ’Bye’,0DH,0AH
DUP
• Allows a sequence of storage locations to be defined or
reserved
• Only used as an operand of a define directive
DB 40 DUP (?) ; 40 words, uninitialized
DW 10h DUP (0) ; 16 words, initialized as 0