Lecture 3
Lecture 3
Lecture 03
Operational concepts of a Computer
Topics in this chapter:
•Registers
•CPU Registers
•Word
•Memory Organization
•Memory Addresses
•Word Alignment
•Memory Operations
•Primitive Operations
•Register Transfer Language and Assembly Language
•Using CPU Registers
•Branching
•Status Register
•Addressing Modes
•Simple Addressing Modes
•CISC vs RISC
•CISC and RISC Examples
Registers
In computer architecture, a Processor Register is a quickly accessible location
available to a computer's central processing unit (CPU).
Almost all computers, load data from a larger memory into registers where it is
used for arithmetic operations and is manipulated. Manipulated data is then often
stored back to main memory.
CPU Registers
• Instruction register (IR): In computing, an instruction register (IR) is the part of a CPU's
control unit that holds the instruction currently being executed or decoded.
• Program counter (PC): A program counter is a register in a computer processor that contains
the address (location) of the instruction being executed at the current time. As each
instruction gets fetched, the program counter increases its stored value by 1.
• General-purpose register: General purpose registers are used to store temporary data and
addresses within the microprocessor.
Execution
•
•
•
last word
– 64-bit 8word: 16
word addresses:
24 32 0, 8,16,….
40 (6448Bit CPU)
56 64
Memory Operations
• The machine instructions of the processor do not have these structures, nor does
assembly language. When you program in assembly language you must build these
structures out of basic assembly instructions. These basic instructions are
the jump instructions and the conditional branch instructions.
• Jump Instruction:
– j instruction (jump)
• Conditional Branch Instructions:
– beq instruction (branch equal)
– bne instruction (branch not equal)
Status Register
• A status register, flag register, or condition code register (CCR) is a collection of status flag bits for
a processor. An example of Status Register is the FLAGS register of the x86 architecture.
• The status register is a hardware register that contains information about the state of the processor.
The status register lets an instruction take action based on the outcome of a previous instruction.
• Flags in the status register are modified as effects of arithmetic and bit manipulation operations. For
example, a Z bit may be set if the result of the operation is zero and cleared if it is nonzero.
• Q. What is a Flag?
• A. In programming, a flag is a predefined bit or bit sequence that holds a binary value. Typically, a
program uses a flag to remember something or to leave a sign for another program.
Addressing Modes
• Q. What is an Instruction Set Architecture (ISA)?
• A. An instruction set architecture (ISA) is an abstract model of a computer. It is also referred
to as architecture or computer architecture. A realization of an ISA is called
an implementation. An ISA permits multiple implementations that may vary in performance.
• Absolute or direct
• PC-relative
• This is particularly useful in connection with jumps, because typical jumps are to nearby instructions (in a high-level
language most if or while statements)
Simple Addressing Modes
• Register indirect
CPUs that do not use sequential execution with a program counter are extremely rare. In some CPUs, each
instruction always specifies the address of next instruction. Such CPUs have an instruction pointer that
holds that specified address; it is not a program counter because there is no provision for incrementing it.
Such CPUs include some drum memory computers such as the IBM 650, the SECD machine, and the RTX
32P.
Simple Addressing Modes
• Skip
• Skip addressing may be considered a special kind of PC-relative addressing mode with a fixed "+1" offset.
Addressing Modes
• Following are the most commonly used addressing modes:
• Indirect
• Data referred to through a pointer or address.
• Immediate
• Data embedded directly in an instruction or command list.
• Index
• A dynamic offset, typically held in an index register.
• Offset
• An immediate value added to an address.
• Relative
• An address formed relative to another address.
• Post increment
• The stepping up of an address past data used.
• Pre decrement
• The decrementing of an address prior to use.
Addressing Modes
• Different computer architectures vary greatly as to the number of addressing modes they
provide in hardware. There are some benefits to eliminating complex addressing modes and
using only one or a few simpler addressing modes.
• It has proven much easier to design CPUs if the only addressing modes available are simple
ones.
• Most RISC architectures have only about five simple addressing modes while CISC architectures
have over a dozen addressing modes.
• A complex instruction set computer (CISC) is a computer in which a single instruction can
execute several low-level operations (such as a load from memory, an arithmetic operation, and
a memory store).
• A reduced instruction set computer (RISC) is one whose instruction set architecture (ISA) allows
it to have fewer cycles per instruction (CPI) than a complex instruction set computer (CISC).
• In the 21st century, the smart phones and tablet computers such as the iPad and Android devices provided a wide user base for
RISC-based systems. RISC processors are also used in supercomputers such as Summit, which, as of November 2018, is the
world's fastest supercomputer as ranked by the TOP500 project.