Module 1
Module 1
A bus that connects major components (CPU, memory and I/O devices) of a
computer system is called as 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.
• 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.
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.
Example-
3) Address Bus-
Example-
Register Memory
Register memory is the smallest and fastest memory in a computer. It
is not a part of the main memory and is located in the CPU in the form
of registers, which are the smallest data holding elements. A register
temporarily holds frequently used data, instructions, and memory
address that are to be used by CPU. They hold instructions that are
currently processed by the CPU. All data is required to pass through
registers before it can be processed. So, they are used by CPU to
process the data entered by the users.
o The numbers of registers in the CPU are fewer, and they are also
small in size. Its size is fewer than 64 bits.
o The computer provides instructions for the registration number
and the register's address. Various register identifiers include R0,
R1, R7, SP, and PC.
PROGRAM COUNTER
The program counter (PC), commonly called the instruction
pointer (IP) in Intel x86 and Itanium microprocessors, and
sometimes called the instruction address
register (IAR), the instruction counter, or just part of the instruction
sequencer, is a processor register that indicates where a computer is
in its program sequence.
Usually, the PC is incremented after fetching an instruction, and holds
the memory address of ("points to") the next instruction that would be
executed.
.
A branch provides that the next instruction is fetched from elsewhere
in memory. A subroutine call not only branches but saves the
preceding contents of the PC somewhere. A return retrieves the saved
contents of the PC and places it back in the PC, resuming sequential
execution with the instruction following the subroutine call.
Hardware implementation
In a simple central processing unit (CPU), the PC is a digital
counter (which is the origin of the term "program counter") that may
be one of several hardware registers. The instruction cycle begins with
a fetch, in which the CPU places the value of the PC on the address
bus to send it to the memory. The memory responds by sending the
contents of that memory location on the data bus. (This is the stored-
program computer model, in which a single memory space contains
both executable instructions and ordinary data. Following the fetch,
the CPU proceeds to execution, taking some action based on the
memory contents that it obtained. At some point in this cycle, the PC
will be modified so that the next instruction executed is a different
one (typically, incremented so that the next instruction is the one
starting at the memory address immediately following the last
memory location of the current instruction).
Like other processor registers, the PC may be a bank of binary
latches, each one representing one bit of the value of the PC. The
number of bits (the width of the PC) relates to the processor
architecture. If the PC is a binary counter, it may increment when a
pulse is applied to its COUNT UP input, or the CPU may compute
some other value and load it into the PC by a pulse to its LOAD input.
To identify the current instruction, the PC may be combined with
other registers that identify a segment or page. This approach permits
a PC with fewer bits by assuming that most memory units of interest
are within the current vicinity.
Accumulator
Micro operations
In computer central processing units, micro-operations (also known
as micro-ops) are the functional or atomic, operations of a processor.
These are low level instructions used in some designs to implement
complex machine instructions. They generally perform operations on
data stored in one or more registers. They transfer data between
registers or between external buses of the CPU, also performs
arithmetic and logical operations on registers. In executing a
program, operation of a computer consists of a sequence of
instruction cycles, with one machine instruction per cycle. Each
instruction cycle is made up of a number of smaller units – Fetch,
Indirect, Execute and Interrupt cycles. Each of these cycles involves
series of steps, each of which involves the processor registers. These
steps are referred as micro-operations. the prefix micro refers to the
fact that each of the step is very simple and accomplishes very little.
Figure below depicts the concept being discussed
here.
Miniature tasks are performed on the information put away in the registers
inside the computer chip. They are utilized to perform math and intelligent
activities, as well as to move information among registers and memory. A
few instances of miniature tasks include:
1.Load: This miniature activity loads information from memory into a
register.
2.Store: This miniature activity stores information from a register into
memory.
3.Add: This miniature activity adds two qualities and stores the outcome in a
register.
4.Subtract: This miniature activity deducts two qualities and stores the
outcome in a register.
5.And: This miniature activity plays out a legitimate AND procedure on two
qualities and stores the outcome in a register.
6.Or: This miniature activity plays out a legitimate OR procedure on two
qualities and stores the outcome in a register.
7.Not: This miniature activity plays out a legitimate NOT procedure on a
worth and stores the outcome in a register.
8.Shift: This miniature activity moves the pieces of a worth to the left or right.
9.Rotate: This miniature activity pivots the pieces of a worth to the left or
right.
Miniature activities are consolidated to frame more elevated level guidelines
and tasks. For instance, an option activity might be executed utilizing various
miniature tasks, including a heap activity to stack the qualities into registers,
an add activity to play out the option, and a store activity to store the
outcome in memory.
Instruction Register
An instruction register holds a machine instruction that is currently
being executed. In general, a register sits at the top of the memory
hierarchy. A variety of registers serve different functions in a central
processing unit (CPU) – the function of the instruction register is to
hold that currently queued instruction for use.
R1(8-bit)
() Denotes a part of register
R1(0-7)
P : R2 <-
: Denotes conditional operations R1
if P=1
Symbol Description Example
Instruction Cycle
In the instruction cycle, the essential operation of the CPU is the time
required to execute and fetch a complete instruction. Fetch, decode
and execute cycle are the three steps that the CPU repetitively
performs to complete one program instruction.
1. Fetch stage
2. Decode stage
3. Execute stage.
Step 2: The MAR address is added to the address bus. The control
unit then issues a READ command on the control bus, and the result
is displayed on the data bus before being copied into the memory
buffer register (MBR). The program counter is increased by one to
prepare for the next instruction. ( These two actions can be performed
concurrently to save time.)
Let’s take a look at the steps involved in the instruction cycle from the
beginning to the end:
Here, the sequence counter (SC) is set to zero at the start of the
instruction cycle.
SC – 0
Here, the instruction cycle stores the address of the next instruction in
the program counter (PC) register. The PC’s content (address) is
assigned to the address register in the first clock cycle (T-0) ( AR).
PC – AR
In the next clock cycle (T-1), the instruction is read from memory and
loaded into the instruction register (IR), while the program counter
(PC) is also incremented by one. The program counter (PC) now
points to the memory address of the next instruction to be retrieved.
The CPU’s control unit must first decode the type of instruction. The
three types of education are:
The programs are generally written in high-level languages, as it’s a convenient way
in which one can define the variables along with the operations that a programmer
performs on the variables. This program is later compiled so as to generate the
actual machine code. A machine code includes low-level instructions.
A set of low-level instructions has operands and opcodes. An addressing mode has
no relation with the opcode part. It basically focuses on presenting the address of the
operand in the instructions.
You can find the list below, showing the various kind of addressing modes:
• Implied Mode
• Immediate Mode
• Register Mode
• Register Indirect Mode
• Autodecrement Mode
• Autoincrement Mode
• Direct Address Mode
• Indirect Address Mode
• Indexed Addressing Mode
Implied Mode
In the implied mode, the operands are implicitly specified in the definition of
instruction. For instance, the “complement accumulator” instruction refers to an
implied-mode instruction. It is because, in the definition of the instruction, the
operand is implied in the accumulator register. All the register reference instructions
are implied-mode instructions that use an accumulator.
Immediate Mode
In the immediate mode, we specify the operand in the instruction itself. Or, in simpler
words, instead of an address field, the immediate-mode instruction consists of an
operand field. An operand field contains the actual operand that is to be used in
conjunction with an operation that is determined in the given instruction. The
immediate-mode instructions help initialize registers to a certain constant value.
Register Mode
In the register mode, the operands exist in those registers that reside within a CPU.
In this case, we select a specific register from a certain register field in the given
instruction. The k-bit field is capable of determining one 2k register.
The reference to a register is equivalent to specifying any memory address. The pros
of using this type of instruction are that an instruction’s address field would make use
of fewer bits to select a register than would be require when someone wants to
directly specify a memory address.