0% found this document useful (0 votes)
9 views35 pages

3

The document discusses the organization of memory, including the concepts of bits, addresses, and word lengths, as well as the operations of loading and storing data between memory and the processor. It also covers instruction types in assembly language, including three-address, two-address, and one-address instructions, along with examples of register transfer notation. Additionally, it highlights the importance of general-purpose registers and the speed of data access within the processor compared to memory transfers.

Uploaded by

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

3

The document discusses the organization of memory, including the concepts of bits, addresses, and word lengths, as well as the operations of loading and storing data between memory and the processor. It also covers instruction types in assembly language, including three-address, two-address, and one-address instructions, along with examples of register transfer notation. Additionally, it highlights the importance of general-purpose registers and the speed of data access within the processor compared to memory transfers.

Uploaded by

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

Addresses and Memory locations

• Bits - the basic unit of memory is the binary


digit, a bit contains a "0" or "1".

• The memory is organized so that the contents


of one word, containing n bits, can be stored or
retrieved in one basic operation.

• Each word is located by a distinct address.


• Addresses- distinct name for location in
memory where data is stored or retrieved
• Have 2k addressable locations .
• Use no:s from 0 to 2k – 1
• Byte is 8 bit
• Word length ranges from 16 to 64 bits
• Can have
1k (210 ) i.e 1024 bytes
1M(220), 1G(230 ), 1T (240) locations/address
spaces.
• The name big-endian is used when lower byte
addresses are used for the most significant
bytes (the leftmost bytes) of the word.

• The name little-endian is used for the


opposite ordering, where the lower byte
addresses are used for the less significant bytes
(the rightmost bytes) of the word.
• Word locations have aligned addresses.
• Words are said to be aligned in memory if
they begin at a byte address that is a
multiple of the number of bytes in a word.
• if the word length is 16 (2 bytes), aligned
words begin at byte addresses 0, 2,
4, . . . , and for a word length of 64 (23
bytes), aligned words begin at byte
addresses 0, 8, 16, . . . .
Memory Operations
• Operands and results must also be
moved between the memory and
the processor.

• Two basic operations involving the


memory are needed, namely, Load
(or Read or Fetch) and Store (or
Write).
• The Load operation transfers a copy of
the contents of a specific memory
location to the processor. The memory
contents remain unchanged.

• To start a Load operation, the processor


sends the address of the desired
location to the memory and requests
that its contents be read. The memory
reads the data stored at that address
and sends them to the processor.
• The Store operation transfers an item
of information from the processor to a
specific memory location, destroying
the former contents of that location.

• The processor sends the address of


the desired location to the memory,
together with the data to be written
into that location.
Instructions & Instruction
Sequencing
• The tasks carried out by a computer
program consist of a sequence of
small steps, such as
 adding two numbers,
 testing for a particular condition,
reading a character from the
keyboard,
sending a character to be displayed
on a display screen.
A computer must have instructions
capable of performing four types of
operations:

• Data transfers between the memory


and the processor registers
• Arithmetic and logic operations on
data
• Program sequencing and control
• I/O transfers
Register Transfer Notations

• The transfer of information from


one location in the computer to
another.

• Possible locations - memory


locations, processor registers, or
registers in the I/O subsystem.
For example,
• the addresses of memory locations
may be LOC, PLACE, A,VAR2;

• Processor register names may be


R0, R5;

• I/O register names may be DATAIN,


OUTSTATUS,
Ex:1
• The contents of a location are
denoted by placing square brackets
around the name of the location.
R1 ← [LOC]
means that the contents of memory
location LOC are transferred into
processor register
R1.
Ex:2
• To adds the contents of registers R1 & R2,
and then places their sum into register R3.
R3 ← [R1] + [R2]
This type of notation is known as Register
Transfer Notation (RTN).

• the R.H.S of an RTN expression always


denotes a value, and the L.H.S is the name
of a location where the value is to be
placed, overwriting the old contents of that
location.
Assembly Language Notation

• Another type of notation to


represent machine instructions
and programs- Assembly
Language Format
• The transfer from memory location
LOC to processor register R1, is
specified by the statement

Move LOC,R1
• The contents of LOC are unchanged
by the execution of this instruction,
but the old contents of register R1 are
overwritten.
• Adding two numbers contained in
processor registers R1and R2 and
placing their sum in R3 can be
specified by the assembly
language statement

Add R1,R2,R3
BASIC INSTRUCTION TYPES
3 address instruction:-

C ← [A] + [B]

Add A,B,C

Operands A and B are called the source operands,


C is called the destination operand

Operation Source1,Source2,Destination
two-address instructions is :-

Add A,B
(B is source & destination)

B←[A] + [B].

Operation Source,Destination
Move B,C

(copying content of B to C,
contents of location B unchanged.)

C←[B]
Therefore C←[A] + [B] can be done
in 2 steps:-

Move B,C
Add A,C

(original values in A,B are


unchanged,result is in C)
Generally, in the assembly language
expressions:-

The source operands are specified


first, followed by the destination.
one-address instruction:-
• specify only one memory operand.
When a second operand is needed,
it is understood implicitly to be in a
unique location.
• A processor register, called
the accumulator, may be used
for this purpose.
Add A

Add the contents of memory location


A to the contents of the
accumulator register and place the
sum back into the accumulator.
Load A

The Load instruction copies the contents


of memory location A into the
accumulator,

Store A

The Store instruction copies the contents


of the accumulator into memory
location A.
C←[A]+[B]

can be performed by executing the


sequence of instructions

Load A
Add B
Store C

(address A,B specifies the source operand, and the


destination location, the accumulator, is implied.
C denotes the destination location in the Store
instruction, whereas the source, the
accumulator, is implied.)
The operand specified in the
instruction may be a source or
a destination, depending on
the instruction.
• Modern computers have a number of
general-purpose processor registers
- typically 8 to 32, and even
considerably more in some cases.
• Access to data in these registers is
much faster than to data stored in
memory locations because the
registers are inside the processor
• Registers are used to store data
temporarily in the processor during
processing.
Generalization
• Let Ri represent a general-purpose
register.
The instructions
Load A,Ri
Store Ri ,A
Add A,Ri

• Register Ri performs the function of the


accumulator.
• When a processor has several
general-purpose registers, many
instructions involve only operands
that are in the registers

• Eg 1:
Add Ri,R j

Ri & Rj are source operands


Rj is destination operand
Eg 2:
Add Ri,R j,Rk

Ri & Rj are source operands


Rk is destination operand
• to transfer data between different
locations.
• places a copy of the contents of
Source into Destination.

Move Source,Destination

Eg:
Move A,Ri
or
C = A + B task can be performed by
the instruction sequence,

Move A,Ri
Move B,R j
Add Ri,R j
Move R j,C
• The speed with which a given task
is carried out depends on the time
it takes to transfer instructions
from memory into the processor
and to access the operands
referenced by these instructions.
• Transfers that involve the memory
are much slower than transfers
within the processor.

You might also like