COA ClassSlideChapter2 (1)
COA ClassSlideChapter2 (1)
COA ClassSlideChapter2 (1)
Module# Topics
Module-1 Basic structures of Computers: Computer Architecture vs. Computer Organization,
Functional units, Operational concepts, Registers, Bus Structure, Performance
Consideration, SPEC rating.
Module-2 Memory location and addresses, Big-endian and Little-endian representation, Instruction
format, Instruction set Architecture, RISC vs. CISC, Addressing modes, Instruction
Sequencing, Subroutines.
Module-3 Binary Arithmetic: Addition and subtraction of signed numbers, Design of fast adders,
Multiplication of positive numbers, Signed operand multiplication, Fast multiplication,
Integer division, Representation of floating point numbers.
Module-4 Memory System: Basic Concepts, Speed, Size and cost, Cache memory concepts, Cache
memory mapping techniques, Performance consideration; Virtual memory concepts,
Translation look-aside buffer, Replacement techniques, Secondary Storage.
Module-5 Basic Processing Units: Fundamental concepts, Execution cycle, Single-Bus and Multi-Bus
Organization, Execution of complete instruction, Hardwired control, Micro programmed
control, Accessing I/O devices.
Memory location and addresses
(Chapter 2)
• Memory location and addresses
• Memory consists of many millions of storage cells (flip-flops).
• Each cell can store a bit of information i.e. 0 or 1 (Figure 2.1).
• Data is usually accessed in n-bit groups.
• Each group of n bits is referred to as a word of information, and
n is called the word length.
• The word length can vary from 8 to 64 bits.
• A unit of 8 bits is called a byte.
• Accessing the memory to store or retrieve a single item of
information (word/byte) requires distinct addresses for each item
location.
Memory Words and Locations
• If the address is of k bits, then 2k = no. of addressable locations.
• So 2k addresses constitute the address-space of the computer.
• For example, a 24-bit address generates an address-space of 224 locations (16 MB) (1M=220).
• It is customary to use numbers from 0 through 2k-1 as the addresses of successive-locations in the memory
32-bit word length example
Memory Words and Locations
BYTE-ADDRESSABILITY
• It is impractical to assign distinct addresses to
individual bit locations in the memory.
• The most practical assignment is to have successive
addresses refer to successive byte locations in the
memory – byte-addressable memory.
• In byte-addressable memory, successive addresses
refer to successive byte locations in the memory.
• Byte locations have addresses 0, 1, 2. . . . .
• If the word-length is 32 bits, successive words are
located at addresses 0, 4, 8. . with each word having
4 bytes.
BIG-ENDIAN & LITTLE-ENDIAN ASSIGNMENTS
IF ID EX MEM WB
Instruction Execution & Straight Line Sequencing
• The program is executed as follows:
1) Initially, the address of the first instruction is loaded into PC .
2) Then, the processor control circuits use the information in the
PC to fetch and execute.
3) During the execution of each instruction, PC is incremented by 4
(assuming word size = 4 bytes) to point to next instruction.
•To execute the Load instruction, the processor uses the value B, which is in
register R5, as the effective address of the operand.
•It requests a Read operation to fetch the contents of location B in the
memory.
•The value from the memory is the desired operand, which the processor
loads into register R2.
INDEXING AND ARRAYS
Index mode
•The effective address of the operand is generated by adding a constant
value to the contents of a register.
•We will refer to the register used in this mode as the index register.
•We indicate the Index mode symbolically as
X(Ri)
where X denotes a constant signed integer value contained in the
instruction and Ri is the name of the register involved.
•The effective address of the operand is given by
EA = X + [Ri]
Relative Mode
• This is similar to index-mode with one difference:
• The effective-address is determined using the PC in place of the general
purpose register Ri.
• The operation is indicated as X(PC).
• X(PC) denotes an effective-address of the operand which is X locations
above or below the current contents of PC.
• Since the addressed-location is identified "relative" to the PC, the name
Relative mode is associated with this type of addressing.
• This mode is used commonly in conditional branch instructions.
• An instruction such as
Branch > 0 LOOP ;
Causes program execution to go to the branch target location
identified by name LOOP if branch condition is satisfied
Auto Increment Mode
• Effective-address of operand is contents of a register
specified in the instruction
• Accessing the operand, the contents of this register are
automatically incremented to point to the next item in a list.
• Implicitly, the increment amount is 1/2/4 depending on the
size of operand.
• This mode is denoted as (Ri)+ ; where Ri = pointer-register.
Add R1, (R2)+ // OR R1 = R1 +M[R2]
R2 = R2 + d
Useful for stepping through arrays in a loop. R2 – start of array d – size of an element
Auto Decrement Mode
• The contents of a register specified in the instruction are first
automatically decremented and are then used as the effective-
address of the operand.
• This mode is denoted as -(Ri) ;where Ri = pointer-register.
• Auto increment and decrement modes can be used together to
implement an important data structure called a stack.
Add R1,-(R2)
//OR R2 = R2-d
R1 = R1 + M[R2]
Question 1
An instruction is stored at location 300 with its address field at location 301. The
address field has the value 400. A processor register R1 contains the number
200.Evaluate the effective address if the addressing mode of the instruction is