Module1 2-Functional Components
Module1 2-Functional Components
Arithmetic
Input and
logic
Memory
Memory
Output Control
I/O Processor
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 2
I / O Unit
• Input Unit:
• Consists of input devices that are attached to the
computer
• These devices take input and convert it into binary
language that the computer understands.
• Examples: keyboard, mouse, joystick, scanner etc.
• Output Unit:
• Consists of output devices attached to the computer
• Converts the binary data coming from CPU to
human understandable form
• Example: printer, monitor, etc.
• Some units provide both input and output functions.
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 3
Memory Unit
• Used to store data and programs
• The total memory capacity of a computer can be visualized as being a hierarchy of
components.
• Memory hierarchy system consists of all storage devices from the slow but
high-capacity secondary or auxiliary memory to the relatively faster main
memory, to an even smaller and faster cache memory.
• Bottom of the hierarchy – slower units (auxiliary memory)
Cache
• Middle – main memory
• Top – cache memory
Main
• Goal – obtain highest possible average access speed Memory
while minimizing the total cost of the memory system
Secondary Memory
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 4
Memory Unit – Classification
Memory
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 5
Primary Memory / Main Memory
• Central storage unit in a computer system
• Directly accessible by the processor (smaller access time)
• Only programs and data currently needed by the processor reside here.
• Contains a large number of semiconductor storage cells, each capable of storing 1
bit of information
• Cells are read from or written into in groups of fixed size called words.
• A distinct address is associated with each word location.
• Made of RAM integrated circuit chips – Volatile
• A small portion is constructed with ROM chips, which store an initial program
called the bootstrap loader (loads the OS when the computer is turned on)
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 6
Primary Memory (contd.)
• Primary memory – types
• RAM (Random Access Memory)
• Volatile – retains data only while powered on
• Static RAM (SRAM)
• Uses transistors/flipflops to store binary information
• Stored information remains valid as long as power is applied
• Dynamic RAM (DRAM)
• Data stored as charge on capacitors
• Since capacitors have a tendency to discharge, DRAM requires
periodic charge refreshing to maintain data storage.
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 7
Primary Memory (contd.)
• DRAM vs SRAM
DRAM SRAM
Memory cell is simpler and Memory cell is more complex
smaller (more cells and larger (less cells per unit
accommodated per unit area) area)
Less expensive More expensive
Requires refresh circuitry to Does not require a refresh
maintain the data stored circuitry to retain data
Slower Faster
Used in main memory Used in cache memory
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 8
Primary Memory (contd.)
• ROM (Read-Only Memory)
• Non-volatile – data retained even after the computer is turned off
• Read-only – data cannot be modified, cannot write new data – data is wired
into the chip during fabrication
• Types of ROM:
• Programmable ROM (PROM) – data can be written electrically after
fabrication but only once
• Erasable PROM (EPROM) – all cells can be erased by exposing to UV
light and then written into
• Electrically Erasable PROM (EEPROM) – data can be written into
without erasing previous content; data erased using field electron emission
• Flash memory – Can erase a block of memory in a flash (1 or few
seconds); does not provide byte-level erasure
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 9
Primary Memory (contd.)
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 10
Secondary Memory and Cache Memory
• Secondary memory – External or auxiliary memory
• Non-volatile and provide backup storage
• Less expensive and can be used to store larger amount of data than the main
memory
• Used to store information that is less frequently accessed
• Communicate with the processor through an I/O processor
• Cache memory
• Small, expensive, very-high-speed RAM units
• Used to compensate for the difference between main memory access time and
processor logic, which is much faster
• Holds the programs/instructions and data that are most frequently used
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 11
Processor
• Processor (CPU):
• Once the information is entered into the computer by the input device, the
processor processes it.
• CPU – brain of the computer, since it is the control center of the computer
• It first fetches instructions from memory and then interprets them so as to know
what is to be done.
• If required, data is fetched from memory or an input device.
• Thereafter CPU executes or performs the required computation and then either
stores the output or displays on the output device.
• The CPU has three main components which are responsible for different functions
– Arithmetic Logic Unit (ALU), Control Unit (CU) and Registers.
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 12
Processor (contd.)
• Arithmetic and Logic Unit (ALU):
• Performs mathematical calculations and takes logical decisions
• Arithmetic calculations – addition, subtraction, multiplication, division
• Logical decisions – comparison of two data items to see which one is larger or
smaller or equal
• Control Unit:
• Coordinates and controls the data flow in and out of CPU and controls all the
operations of ALU, memory registers and also input/output units.
• It is also responsible for carrying out all the instructions stored in the program.
• It decodes the fetched instruction, interprets it and sends control signals to
input/output devices.
• Registers: High-speed storage elements that can store one word of data
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 13
Registers
• Very fast computer memory, used to store data/instruction
• Consist of a group of flipflops and gates
• Categories of registers:
• User-visible registers – Can be referenced by means of the machine language
that the processor executes; used to enable the programmer to minimize main
memory references by optimizing use of registers
• Control and status registers – Used by the control unit to control the operation
of the processor and by privileged, operating system programs to control the
execution of programs
Note: There is not a clean separation of registers into these two categories. For example, on some machines the
program counter is user visible (e.g., x86), but on many it is not.
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 14
User-Visible Registers
• General purpose registers – can be used for a variety of functions; can contain the
operand for any instruction
• Accumulator – Used to store data taken out from the memory
• Data registers – Can be used only to hold data and cannot be involved in the
calculation of addresses
• Address registers – Employed in the calculation of addresses
• Segment pointers – hold the base address of a segment in a machine with
segmented addressing
• Index registers
• Stack pointers
• Condition codes – bits set by the processor hardware as the result of operations;
partially visible to the user
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 15
Control and Status Registers
• Four registers essential to instruction execution
• Program counter (PC) – Contains the address of the instruction to be fetched
next
• Instruction register (IR) – Contains the most the recently fetched instruction
• Memory address register (MAR) – Contains the address of a location in
memory
• Memory buffer register (MBR) – Contains a word of data to be written to
memory or the word most recently read
• These registers are used for the movement of data between the processor and
memory.
Typically, the processor updates the PC after each instruction fetch so that the PC always points to the next instruction to be
executed. A branch or skip instruction will also modify the contents of the PC. The fetched instruction is loaded into an IR,
where the opcode and operand specifiers are analyzed. Data are exchanged with memory using the MAR and MBR.
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 16
Control and Status Registers
• Many processor designs include a register or set of registers, often known as the
program status word (PSW), that contain condition codes plus other status
information.
• Common fields or flags:
• Sign: Contains the sign bit of the result of the last arithmetic operation.
• Zero: Set when the result is 0.
• Carry: Set if an operation resulted in a carry (addition) into or borrow
(subtraction) out of a high-order bit.
• Auxiliary Carry: Set if there is a carry from the lower four bits to the upper
four bits
• Parity: Set if the parity is even (i.e. if the number of set bits in the result of an
arithmetic operation is even)
• Equal: Set if aPrepared
logicalby Dr. compare result
G. Anushiya Rachel, Dr. K.M. is equality.
Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 17
Control and Status Registers
• Common fields or flags (contd.):
• Overflow: Used to indicate arithmetic overflow.
• Direction: Used to determine the direction for moving string data
• Interrupt Enable/Disable: Used to enable or disable interrupts.
• Supervisor: Indicates whether the processor is executing in supervisor or user
mode. Certain privileged instructions can be executed only in supervisor
mode, and certain areas of memory can be accessed only in supervisor mode.
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 18
Example Processor Register Organization
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 19
Typical Operating Steps with Registers
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 20
Typical operating steps with registers
• Programs reside in the memory and usually get there through the input unit.
• Execution of the program starts when the PC is set to point to the first instruction of the
program.
• The contents of the PC are transferred to the MAR and a Read control signal is sent to the
memory.
• After the time required to access the memory elapses, the addressed word is read out of the
memory and loaded into MDR.
• Next the contents of MDR are transferred to the IR. At this point, the instruction is ready to
be decoded and executed.
• If the instruction involves an operation to be performed by the ALU, it is necessary to
obtain the required operands.
• If an operand resides in the memory, it has to be fetched by sending its address to the MAR
and initiating a Read cycle.
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 21
Typical operating steps with registers
• When the operand has been read from the memory into the MDR, it is transferred from
the MDR to the ALU.
• After one or more operands are fetched in this way, the ALU can perform the desired
operation.
• If the result of this operation is to be stored in the memory, then the result is sent to the
MDR.
• The address of the location where is result is to be stored is sent tot MAR and write cycle
is initiated.
• Then contents of PC are incremented so that the PC points to the next instruction to be
executed.
• As soon as the execution of the current instruction is completed, a new instruction fetch
may be started.
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 22
Interconnection of Components
• A group of lines that serves as a connecting path for several devices is called a
bus.
• The simplest way to interconnect functional units is to use a single bus.
Prepared by Dr. G. Anushiya Rachel, Dr. K.M. Monica, Dr. R.V. Aswiga, SCOPE, VIT Chennai 23