Professional Documents
Culture Documents
Computer program: a set of instructions each specifying a well-defined piece of work for the computer
to carry out.
John von Neumann proposed a fundamental model of a computer for processing computer programs in
1946.
The von Neumann model consists of five parts: memory; a processing unit, input, output, and a
control unit.
Memory
2k x m array of stored bits
Example:
Example:
Processing Unit
The processing unit in a modern computer can consist of many sophisticated complex functional units,
each performing one particular operation (divide, square root, etc.). The simplest processing unit, and
the one normally thought of when discussing the basic von Neumann model, is the ALU, known as
Arithmetic and Logic Unit.
The size of the quantities normally processed by the ALU is often referred to as the word length of the
computer, and each element is referred to as a word.
In the LC-3, the ALU processes 16-bit quantities. LC-3 has a word length of 16 bits.
Each ISA has its own word length, depending on the intended use of the computer.
Most microprocessors today that are used in PCs or workstations have a word length of either
32 bits or 64 bits.
Input/ Output
Computer peripherals: keyboard, mouse, monitor, speaker…
Each device has its own interface, usually a set of registers like the memory’s MAR and MDR
LC-3 supports keyboard (input) and monitor (output)
o Keyboard: data register (KBDR) and status register (KBSR)
o Monitor: data register (DDR) and status register (DSR)
Some devices provide both input and output: disk, network
o Program that controls access to a device is
usually called a driver.
Control Unit
Control Unit: Orchestrates execution of the program.
C O N T R O L U N IT
PC IR
o To keep track of which instruction is being executed, the control unit has an instruction register
to contain that instruction. IR contains current instructions.
o To keep track of which instruction is to be processed next, the control unit has a register that
contains the next instruction's address.
o For historical reasons, that register is called the program counter (abbreviated PC), although a
better name for it would be the instruction pointer, since the contents of this register are, in
some sense, "pointing" to the next instruction to be processed.
Control unit:
• interprets the instruction, generating signals that tell the other components what to do
Instruction Processing
The central idea in the von Neumann model of computer processing is that the program and data are
both stored as sequences of bits in the computer's memory, and the program is executed one
instruction at a time under the direction of the control unit.
Not all phases are needed by every instruction phases may take variable number of machine cycles
The most basic unit of computer processing is the instruction. It is made up of two parts:
A computer’s instructions and their formats is known as its Instruction Set Architecture (ISA).
“Add the value 6 to the contents of R3 to form a memory address. Load the contents of that memory
location to R2.”
FETCH
1. Load next instruction (at address stored in PC) from memory into Instruction Register (IR).
2. Copy contents of PC into MAR.
3. Send “read” signal to memory.
4. Copy contents of MDR into IR.
5. Then increment PC, so that it points to the next instruction in sequence; PC becomes PC+1.
DECODE
In LC-3, this is always the first four bits of instruction.
Example:
Examples:
EXECUTE
Perform the operation, using the source operands.
Examples:
STORE RESULT
Write results to destination (in register or memory)
Examples:
What if we don’t want to always execute the instruction that follows this one?
Need special instructions that change the content of the PC, known as control instructions.
Set the PC to the value contained in a register. This becomes the address of the next instruction to
fetch.
“Load the contents of R3 into the PC.”
Control unit will repeat instruction processing sequence as long as clock is running.
If not processing instructions from your application, then it is processing instructions from the Operating
System (OS).