Professional Documents
Culture Documents
Input Unit - accepts coded information from human operators using devices such
as keyboard and mouse.
Memory Unit - stores the information received from the input unit.
Arithmetic and Logic Unit - performs operations such as addition, subtraction,
multiplication division, or comparison of numbers
Output Unit - sends processed information. Examples are printers and plotters.
Control Unit - manages all the activities in the computer are directed by the control
unit.
Basic Operational Concepts
Most computer operations are executed in the ALU (Arithmetic and Logic unit)
of a processor.
Example: Adding two (2) numbers that are both located in memory
Load R2, LOC
1
Prepared by: Engr. B. Ladesma
The complete instruction cycle involves three (3) operations:Instruction fetching, opcode
decoding and instruction execution as shown in Figure 2.1. Processor executes a program
with the help of program counter (PC). PC holds the address of the instruction to be
executed next. To begin execution of a program, the address of its first instruction is placed
into the PC. Then, the processor control circuits use the information (address of memory)
in the PC to fetch and execute instructions, one at a time, in the order of increasing
addresses. This is called straight-line sequencing.
During the execution of instruction, the PC is incremented by the length of the current
instruction in execution. For example, if currently executing instruction length is 4
bytes, then PC is incremented by 4 so that it points to instruction to be executed next.
Addressing Modes
The different ways in which the location of an operand is specified in an instruction are
referred to as addressing modes.
1. Register addressing mode - The operand is the content of a processor register; the
name (address) of the register is given in the instruction.
Example: Move R1, R2
2. Absolute addressing mode - The operand is in a memory location; the address of this
location is given explicitly in the instruction.
Example: Move LOC, R2
3. Immediate addressing mode - The operand is given explicitly in the instruction.
Example: Move #200, R0
The above statement places the value 200 in the register R0. A common convention is to
use the sharp sign (#) in front of the value to indicate that this value is to be used
as an
immediate operand.
4. Indirect addressing mode - The effective address of the operand is the contents of
a register or memory location whose address appears in the instruction.
Example: Add (R2), R0
Register R2 is used as a pointer to the numbers in the list, and the operands are
accessed indirectly through R2. The initialization section of the program loads the
counter value
n from memory location N into R1 and uses the immediate addressing mode to place
the address value NUM 1, which is the address of the first number in the list, into R2.
5.
automatically decremented and is then used as the effective address of the operand.
4
Prepared by: Engr. B. Ladesma