Unit 1
Unit 1
Computer accepts the coded information through input unit , which reads the data.
It converts external world data to the binary format which can be understood by the
CPU.
for example:
❑ Keyboard
❑ Mouse
❑ Scanner
❑ Microphone
❑ Joystick
❑ trackballs etc
Motherboard
It is a circuit that is the foundation of a computer and
allows the CPU, RAM, and all other computer
hardware components to function with each other.
Modem
It is a device that enables a computer to transmit and
receive information over telephone lines.
A memory is just like a human brain. It is used to store data
and instructions. Computer memory is the storage space in
computer where data is to be processed and instructions
required for processing are stored. The memory is divided into
large number of small parts called cells. Each location or cell
has a unique address which varies from zero to memory size
minus one. For example if computer has 64k words, then this
memory unit has 64 * 1024=65536 memory locations. The
address of these locations varies from 0 to 65535.
Memory Unit
• Primary Memory (Main Memory)
Primary memory holds only those data and instructions on which computer is
currently working. It has limited capacity and data is lost when power is switched
off. It is generally made up of semiconductor device. These memories are not as
fast as registers. The data and instruction required to be processed reside in main
memory. It is divided into two subcategories RAM and ROM.
• Characteristics of Main Memory
These are semiconductor memories
It is known as main memory.
Usually volatile memory.
Data is lost in case power is switched off.
It is working memory of the computer.
Faster than secondary memories.
A computer cannot run without primary memory.
Secondary Memory
This type of memory is also known as external memory or
non-volatile. It is slower than main memory. These are used for
storing data/Information permanently. CPU directly does not
access these memories instead they are accessed via input-output
routines. Contents of secondary memories are first transferred to
main memory, and then CPU can access it. For example : disk,
CD-ROM, DVD etc.
Characteristic of Secondary Memory
These are magnetic and optical memories.
It is known as backup memory.
It is non-volatile memory.
Data is permanently stored even if power is switched off.
It is used for storage of data in a computer.
Computer may run without secondary memory.
Slower than primary memories.
Examples of storage
RAM
It is short for Random Access Memory which is the main
memory of the system within a computer. RAM requires
power ; if power is lost, all data is also lost.
Hard Drive
It is a rigid circular disk located inside a computer. The
term hard disk is often used as an abbreviation to hard
disk drive.
Diskette
It can record data as magnetized spots on tracks on its
surface. Diskettes became popular along with the
personal computer mainly to transport data.
CD-R, CD-RW
CD-R is short for CD-Recordable and is a type of writable
disc capable of having information written on it only once
CD-R/W is a drive and/or media that is
capable of being written many times.
BASIC OPERATIONAL
CONCEPTS
The activity in a computer is governed by instructions.
To perform a given task, an appropriate program
consisting of a list of instructions is stored in the
memory. The PC (Program Counter) contains the
memory address of the instruction to be executed.
During execution, the contents of the PC are updated to
point to the next instruction. Every timethat an
instruction is to be executed, the program counter
releases its contents to the internal busand sends it to the
memory address register
The MAR (
Memory Address Register
) holds the address of the location to or from which dataare to be transferred. As
can be seen from the figure above, the connection of the MAR to themain
memory is one-way or unidirectional.The MDR (
Memory Data Register
) contains the data to be written or read out of the addressedlocation.During the
fetch operation, the MDR contains the instruction to be executed or data
neededduring execution. In write operation, MDR the data to be written into the
main memory.The IR (
Instruction Register
) contains the instruction that is being executed. Before the IR executes the
instruction it needs to be decoded first. As soon as the content of the MDR
istransferred to the IR, the decoding process commences. After decoding,
execution of theinstruction will take place
• Operating Steps
• 1. PC is set to point to the first instruction of the program
(the operating system loads thememory address of the first
instruction).2. The contents of the PC are transferred to the
MAR (which is automatically transmitted to theMM) and a
• Read
• signal is sent to the MM.3. The addressed word is read out
of MM and loaded into the MDR
• 4. The contents of MDR are transferred to the IR. The
instruction is ready to be decoded andexecuted.5. During
execution, the contents of the PC are incremented or
updated to point to the nextinstruction.
• CPU Instruction Execution Steps
• Instruction execution in a CPU can now be summarized by the
following steps:1. Fetching the instruction from the memory into
the instruction register.2. Incrementing the PC to point to the next
instruction to be executed.3.
• Determining the type of instruction fetched (
• instruction decoding
• ).4. Determining the location of data in the memory. If the
instruction uses data.5. Fetching the required data into internal
CPU registers.6. Executing the instruction.7. Storing the results in
the designated locations.8. Return to Step 1.This is commonly
referred to as the
• fetch-decode-execute
• cycle
BUS STRUCTURE
• A bus is a set of electrical wires (lines) that
connects the various hardware components of a
computer system.
• It works as a communication pathway through
which information flows from one hardware
component to the other hardware component.
•
• A bus that connects major components (CPU,
memory and I/O devices) of a computer system is
called as a System Bus.
• Why Do We Need Bus?
•
• A computer system is made of different components
such as memory, ALU, registers etc.
• Each component should be able to communicate with
other for proper execution of instructions and
information flow.
• If we try to implement a mesh topology among
different components, it would be really expensive.
• So, we use a common component to connect each
necessary component i.e. BUS.
Components Of A System Bus-
• 1) Data Bus-
•
• As the name suggests, data bus is used for transmitting the data / instruction from CPU to
memory/IO and vice-versa.
• It is bi-directional.
• Data Bus Width
•
• The width of a data bus refers to the number of bits (electrical wires) that the bus can carry at a
time.
• Each line carries 1 bit at a time. So, the number of lines in data bus determine how many bits can
be transferred parallely.
• The width of data bus is an important parameter because it determines how much data can be
transmitted at one time.
• The wider the bus width, faster would be the data flow on the data bus and thus better would be
the system performance.
•
• Examples-
• A 32-bit bus has thirty two (32) wires and thus can transmit 32 bits of data at a time.
• A 64-bit bus has sixty four (64) wires and thus can transmit 64 bits of data at a time.
• 2) Control Bus-
•
• As the name suggests, control bus is used to transfer the control
and timing signals from one component to the other component.
• The CPU uses control bus to communicate with the devices that
are connected to the computer system.
• The CPU transmits different types of control signals to the system
components.
• It is bi-directional.
• What Are Control & Timing Signals?
•
• Control signals are generated in the control unit of CPU.
• Timing signals are used to synchronize the memory and I/O
operations with a CPU clock.
•
Problem-1
• Which of the following system bus is used to
designate the source or destination of the
data on the bus itself?
ALU
• ALU stands for Arithmetic Logic Unit. It is a
combinational digital circuit which does
arithmetic and bitwise operations on integer
binary numbers. It is one of the main
components of the computer's Central
Processing Unit (CPU) that is designed to
perform arithmetic and logical tasks.
• The ALU results in an integer as it not only
performs the calculations concerned with
subtraction and addition but also calculates
the multiplication of two integers as they are
designed to execute integer calculations.
Hence, resulting in an integer. Signals are
received from the external circuits by the
Arithmetic Logic Unit input, and external
electronics get outputs signals from ALU as its
response.
• Signals
• An Arithmetic Logic Unit possesses a variety of input and output nets. The
nets or signals are nothing other than what are used to convey digital
signals between the Arithmetic Logic Unit and external circuitry,
i.e. electrical conductors. External circuits add signals to the Arithmetic
Logic Unit when an Arithmetic Logic Unit is operating. In response to these
signals sent, the Arithmetic Logic Unit then produces and conveys signals
via its outputs to the external circuitry.
• Data: - Three parallel data buses having two input operands and a result
output are the components of the basic Arithmetic Logic Unit.
• Opcode: - The message about an operation selection code is conveyed to
the Arithmetic Logic Unit through this parallel bus. The operation selection
code specifies the desired operation, arithmetic or logic, in an enumerated
value form, which is supposed to be performed by the Arithmetic Logic
Unit.
•
• Status:
– Outputs: Supplemental information concerning the result of the
current operation of the Arithmetic Logic Unit is part of various
individual signals that convey. The general Arithmetic Logic Unit
usually contains status signals like overflow, zero, carry out,
negative, and more. When an ALU completes each operation, the
external registers contain the status output signals. These signals
are made available for future ALU operations stored in the
external registers.
– Inputs: Status inputs allow to make any additional information
available to the Arithmetic Logic Unit while operating. When the
ALU operates, further access to information is permitted by the
status inputs to complete the operation successfully.
Circuit Operation
A simple four-bit Arithmetic Logic Unit is the
combinational logic circuitry. It is part of
the 74181 integrated circuits. An
asynchronous change will occur in an
Arithmetic Logic Unit as a response to the
input changes, as it is a combinational logic
circuit. Stable signals are included in the ALU
inputs in normal operation.
• Functions
• Commonly Arithmetic Logic Unit supports numerous bitwise
logic and basic arithmetic functions. These operations are
typically included in basic general-purpose ALUs
• Arithmetic operations
• Bitwise logical operations
• Bit shift operations
• Applications
• The application of the Arithmetic Logic Unit is as follows:-
• Multiple-precision arithmetic
• Complex operations
• History
• Mathematician John von Neumann was the one who, in 1945, proposed the concept of the
Arithmetic Logic Unit. It was contained in a report produced on the foundations for a new
computer called the EDVAC. It was in the early 1970s that microprocessors began to appear. Often
insufficient die space for a full-word-width ALU, despite smaller transistors, was present. Examples
include the popular Zilog Z80, which has performed the eight-bit additions with a four-bit
Arithmetic Logic Unit.
• Advantages of ALU
• Arithmetic Logic Unit has various advantages, which are as follows:
• Parallel architecture and applications with high performance are supported.
• It can combine integer and floating-point variables and get the desired output simultaneously.
• It can react to a very large set of instructions and has a higher accuracy range.
• The ALU can combine two arithmetic operations in the same code, like subtraction, addition and
multiplication, or any other two operands. For case, A+B*C.
• They remain uniform throughout the whole program and are spaced so they cannot interrupt
parts in between.
• It is very fast in general and hence provides results very quickly.
• No sensitivity issues or memory wastage issues are there with ALU.
• They minimize the logic gate requirements and are less expensive.
Disadvantages of ALU
The disadvantages of the Arithmetic Logic Unit
are discussed below:
Floating variables have more delays, and all
within the ALU do not easily understand the
designed controller.
If memory space were definite, the bugs would
come and interrupt our resulting output.
The Amateurs are hard to understand due to
their complex circuit, and also, it is hard to
understand the concept of pipelining.
The presence of irregularities in latencies is a
proven disadvantage of ALU.
Rounding off is another disadvantage, as it
impacts accuracy.
Control unit
• Structure of the Control Unit
• Control Memory:
– Stores microinstructions for control signals.
– These instructions define the actions needed to execute each instruction.
• Control Logic Circuits:
– Generates control signals based on microinstructions.
– Includes decoders, multiplexers, and other combinational and sequential logic circuits.
• Instruction Register:
– Holds the current instruction being executed.
– Decoded to determine which microinstructions to fetch from control memory.
• Program Counter:
– Keeps track of the address of the next instruction to be executed.
• Timing and Control Signals:
– Manages the timing of instruction cycles (fetch, decode, execute).
– Synchronizes operations within the CPU and with other system components.
• Working of the Control Unit
• Fetch Cycle:
– The control unit retrieves the next instruction from memory.
– The address of the instruction is held in the program counter.
– The instruction is loaded into the instruction register.
• Decode Cycle:
– The instruction in the instruction register is decoded to determine the operation to be
performed.
– The control unit interprets the opcode (operation code) and generates the appropriate
control signals.
• Execute Cycle:
– The control signals generated during the decode cycle direct other parts of the CPU to
execute the instruction.
– This may involve arithmetic or logical operations, data movement, or interaction with I/O
devices.
• Write Back:
– The results of the executed instruction are written back to memory or registers.
– The program counter is updated to point to the next instruction.
• Detailed Steps
• Instruction Fetch:
– Control Signal: READ (fetch from memory).
– The program counter provides the address to memory.
– The fetched instruction is placed into the instruction register.
• Instruction Decode:
– Control Signal: DECODE (interpret instruction).
– The opcode is decoded to understand the required operation.
– The control unit sets up the necessary control signals for the ALU (Arithmetic Logic Unit) and other components.
• Operand Fetch (if necessary):
– Control Signal: FETCH OPERAND (read operand).
– Fetches operands from registers or memory as specified by the instruction.
• Execution:
– Control Signal: EXECUTE (perform operation).
– The ALU performs the required operation (addition, subtraction, etc.).
– Data is moved or manipulated as required by the instruction.
• Result Write Back:
– Control Signal: WRITE BACK (store result).
– The result is written back to a register or memory location.
– The program counter is updated to the next instruction.
• Update Program Counter:
– Control Signal: INCREMENT PC (update address).
– The program counter increments to point to the next instruction.
• Types of Control Units
• Hardwired Control Unit:
– Uses fixed logic circuits to control signals.
– Fast but inflexible, as the control logic is hardwired into the system.
• Microprogrammed Control Unit:
– Uses a set of instructions (microinstructions) stored in control memory.
– More flexible, as it can be easily modified by changing
microinstructions.
• Conclusion
• The control unit is essential for the orderly execution of
instructions within the CPU. It fetches, decodes, and executes
instructions by generating and managing control signals, ensuring
that all components of the computer system work together
efficiently.
+-------------------------+
| Decoder |
+-------------------------+
|
v
+-------------------------+
| Control Address |
| Register (CAR) |
+-------------------------+
|
v
+-------------------------+
| Control Memory |
+-------------------------+
|
v
+-------------------------+
| Control Buffer |
| Register (CBR) |
+-------------------------+
|
v
+-------------------------+
| Control Logic Circuits |
+-------------------------+
v
+-------------------+ +------------------+
| ALU | | Registers |
+-------------------+ +------------------+
```