Lec 2 Microprogramming
Lec 2 Microprogramming
DCS114/SSS114
DSE114/CSE114
LECTURE 2
BY
Mr. Bagaiga Richard
Email: [email protected]
1
Microprogramming
2
Microinstruction
■ Definition: A single instruction in microcode. It is the most elementary
instruction in the computer, such as moving the contents of a register to the
arithmetic logic unit (ALU).
■ It takes several microinstructions to carry out one complex machine instruction
(CISC). Also called a "micro-op" or "µop," microinstructions differ within the
same computer family and even the same vendor.
3
Microprogramming Process
4
What Goes in a Microinstruction?
Designing the Microinstruction set
■ How many fields?
■ what does each field represent?
■ What control signals are controlled by each field?
■ How will sequencing (next microinstruction to execute) be determined?
5
6
CONTROL UNIT
7
Control Unit
■ The control unit (CU) is a component of a computer's central processing unit (CPU)
that directs the operation of the processor.
■ It tells the computer's memory, arithmetic/logic unit and input and output devices
on how to respond to a program's instructions
8
Two major types of Control Unit
■ Hardwired Control :
• The control logic is implemented with gates, decoders, and other digital circuits +
• +Fast operation,
• -Wiring change(if the design has to be modified) is difficult.
■ Microprogrammed Control :
• The control information is stored in a control memory, and the control memory is
programmed to initiate the required sequence of microoperations for an instruction
• + Any required change can be done by updating the microprogram in control
memory,
• - Slow operation
9
10
11
Control unit
In a microprogrammed processor, the control unit consists of:
■ Control address register –contains the address of the next microinstruction
to be executed.
■ Control buffer register –contains the microinstruction to be executed.
■ The sequencer–determines the next address from within control memory
■ Control memory – where microinstructions are stored.
12
Microprogrammed Control Unit
■ A control unit with its binary control values stored as words in memory is called as
microprogrammed control.
■ Each word in the control memory contains microinstruction that specifies one or
more microperations for the system. A sequence of microinstructions constitutes a
micro program.
■ Microprogrammed implementation is a software approach in contrast to the
hardwired approach.
■ It deals with various units of software but at the micro level i.e. micro-operation,
micro-instruction, micro-program etc.
13
Microprogrammed Control
Unit Organization
14
■ Sequencing:
It loads the control Address register with the address of the next instruction
to be read and issues a read command to control memory.
■ Control Address Register (CAR):
It contains the address of next microinstruction to be read. This is similar to
the program counter(PC) which stores the address of the next instruction.
■ Control Memory:
The set of microinstruction is stored in control Memory (CM) also called as
control store.
■ Control Buffer Register(CBR):
When microinstruction is read from the control memory, it is transferred to a
control Buffer Register (CBR), which is similar to the instruction Register (IR)
that stores the opcode of the instruction read from the memory.
15
What are the basic tasks performed by a microprogrammed control unit?
■ Microinstruction sequencing:
■ Get the next microinstruction from the control memory. Microinstruction
execution:
■ Generate the control signals needed to execute the microinstruction
16
Control memory
17
Sequencer
■ The sequencer generates a new address by:
–incrementing the CAR
–loading the CAR with an address from control memory.
–transferring an external address or
–loading an initial address to start the control operations.
■ Depending on the condition and on the branching type, it will be:
– an external (mapped) address
– the next microinstruction
– a return from a subroutine
– the address indicated in the microinstruction.
18
Micro program routine
Microinstructions are usually stored in groups where each group specifies a routine, where
each routine specifies how to carry out an instruction.
Each routine must be able to branch to the next routine in the sequence.
■ Routine :
• Every block of code is “Routine.”
• Group of microinstructions stored in control memory.
Each computer instruction has its own microprogram routine to generate microoperations that
execute the instruction.
■ Subroutine:
Sequence of microinstructions used by other routines to accomplish particular task
Example: • Subroutine to generate effective address of operand for memory reference
instruction
19
Advantages and Disadvantages of
Microprogramming
■ Simplifies design of control unit
■ Cheaper
■ Less error-prone
disadvantage
■ Slower
20
common applications of
microprogramming
■ Realization of computers.
■ Operating system support.
■ Realization of special-purpose devices.
■ High-level language support.
■ Micro diagnostics.
■ User Tailoring.
21
ALU EXECUTION OF MACRO-
INSTRUCTION
22
Arithmetic logic unit
■ An arithmetic logic unit (ALU) is a digital electronic circuit that performs arithmetic
and bitwise logical operations on integer binary numbers.
■ ALUs are designed to perform integer calculations. Therefore, besides adding and
subtracting numbers, ALUs often handle the multiplication of two integers, since the
result is also an integer.
■ However, ALUs typically do not perform division operations, since the result may be a
fraction, or a "floating point" number. Instead, division operations are usually handled
by the floating-point unit (FPU), which also performs other non-integer calculations
23
Arithmetic logic unit
.
■ While the ALU is a fundamental component of all processors, the design and function of
an ALU may vary between different processor models. For example, some ALUs only
perform integer calculations, while others are designed to handle floating point
operations as well.
■ Some processors contain a single ALU, while others include several arithmetic logic
units that work together to perform calculations.
■ Regardless of the way an ALU is designed, its primary job is to handle integer
operations. Therefore, a computer's integer performance is tied directly to the
processing speed of the ALU.
24
The Simplest Computer Building Blocks
25
Function of ALU:.
■ It accepts operands from registers.
■ It performs arithmetic and logical operations.
■ It returns results to register or a memory.
■ The status of an ALU operation (negative, carry, zero, overflow) is available for
writing into Flags register (FL).
26
Typical Schematic Symbol of an ALU
■ A and B: the inputs to the ALU (aka operands)
■ R: Output or Result
■ F: Code or Instruction from the Control Unit (aka as op-
code)
■ D: Output status; it indicates cases such as:
• carry-in
• carry-out,
• overflow,
• division-by-zero
• And . .
27
Circuit operation
■ An ALU is a combinational logic circuit
■ Its outputs will change asynchronously in response to input
changes
■ The external circuitry connected to the ALU is responsible for
ensuring the stability of ALU input signals throughout the
operation.
28
THE END