Unit 1 Introduction To Processing Units
Unit 1 Introduction To Processing Units
Unit 1 Introduction To Processing Units
1
Unit 1: Syllabus
Introduction to Processing units
Computer System, Processor, Block diagram, Processor logic unit, Control unit,
Instruction format, Assembly language, High level language, Embedded computing
applications, Microcontroller, Instruction set architectures (CISC, RISC), Harvard
and Von Neumann, Floating and fixed point
Introduction of controller families: 8-bit, 16-bit,32-bit,64-bit, ARM Processor
families, Cortex A, Cortex R and Cortex M, Thumb 2 instruction set
2 MGR,ECE,RVCE
Block diagram of a
computer system
MP
IC
4 MGR,ECE,RVCE
Processor
A processor unit is that part of a computer system or digital system
that implements the operations in the system.
A Processor IC interfaced with many other components to realize
computer system.
The user is expected to give instructions to the processor by writing
a program in assembly or high level language.
5 MGR,ECE,RVCE
Processor: Block Diagram
Central
Processing
Other Units
Unit
(CPU)
IC package
6 MGR,ECE,RVCE
CPU: Block diagram
Processor
Control Unit
Logic Unit
7 MGR,ECE,RVCE
Processor Logic Unit(PLU)
In most of the processors, the different operations are implemented by means of
arithmetic & logical operations.
The processor logic unit consists of circuits to implement simple basic operations
like add, shift, etc…
The other operations are generated by using basic operations available with the
support of control unit.
E.g. Multiplication operation is generated by repeated add instruction/ Shift
instruction
Processor logic unit consists of circuits to implement Arithmetic & Logic
operations. These circuits are called as Arithmetic & Logic Unit(ALU).
8 MGR,ECE,RVCE
PLU….
The ALU receives the information(operands) from the registers and performs a
given operation as specified by control unit.
The operation to be performed (instruction) by CPU is specified by the user by
writing programs.
E.g. C program.
So, the PLU consists of ALU( additional digital circuits also) & registers
connected by buses.
9 MGR,ECE,RVCE
Simple PLU:
Bus
Organization
10 MGR,ECE,RVCE
Bus Organization
Different units are connected by buses: Bus organization
Bus organization is also called as data path architecture because
different functional units & their connectivity through buses is
specified.
Each register is connected to two multiplexers( MUX) to form input
buses A & B.
The input buses A & B are applied to a ALU.
The function selected in the ALU determines the particular operation
that is to be performed.
The result of the operation goes through the output bus S into the
inputs of all registers.
The shift operation is implemented in the shifter.
11 MGR,ECE,RVCE
Bus Organization: An Example
Operands:
- MUX A selector: One among 4 registers is to be connected to input
bus A & B , hence at least two select line(bits) are required.
MUX –A MUX-B
Select lines Register Select lines Register
A1 A0 Selected B1 B0 Selected
0 0 R0 00 R0
0 1 R1 01 R1
1 0 R2 10 R2
1 1 R3 11 R3
12 MGR,ECE,RVCE
Number of multiplexers
One MUX is required to connect a bit of register to ALU, the number MUX required
is equal number of bits(size of ALU).
E.g: Size of ALU=4 bits => Register Size=4 bits
0 0 0 0
13 MGR,ECE,RVCE
Bus Organization: An Example
ALU
Assume ALU performs 8 different operations.
Hence, requires at least 3 bits of input to differentiate the operation.
The ALU performs different operations according to table shown below.
14 MGR,ECE,RVCE
Bus Organization: An Example
Shifter
Assume if Shift select=1, shift the data,
shift select=0, no shift
Decoder
Decoder select a register to store data after operation.
Assume decoder generate load signal to different register according to table shown below.
Destination Register
select Selected
D1 D0
00 R0
01 R1
10 R2
11 R3
15 MGR,ECE,RVCE
So the control unit is ………
Operation and
Operands
Control Signals
16 MGR,ECE,RVCE
Example:
Assume: Operation to be performed is addition (by user)
R1 R1+R2
Operation is called as an instruction.
R2 is source operand & R1 is source as well as destination
17 MGR,ECE,RVCE
Example contd…
18 MGR,ECE,RVCE
Example…
So, for the operation assumed, the control signals to be
generated are,
19 MGR,ECE,RVCE
So,
how to write
instructions?
Mnemonics
20 MGR,ECE,RVCE
Machine Independent High level languages
MGR,ECE,RVCE
Source: T.L Floyd, “Digital Fundamentals”, 9e
21
Example….
Compiler & assembler generates machine codes, based on instruction format
of the processor.
Instruction format or control word of the PLU considered:
22 MGR,ECE,RVCE
Timing Sequence
Each micro operation assumed takes some time for completion.
The control signals are expected to generate in a sequence starting from source
operand selection.
Assume, different successive times instants during which control signals generated
to complete the operation.
T0 is time instant during which control signals for register selection are generated.
T0: Register selection (MUX A Sel=01, MUX B Sel= 10)
T1: Addition (Opcode=000)
T2: Shift( Shift Select=0)
T3: Destination Selection(Decoder input=01)
To complete all micro operations, at least 4 time instants are required.
The sequence of time instants form timing sequence.
23 MGR,ECE,RVCE
Control unit modified
Operation and
Operands
Clock
24 MGR,ECE,RVCE
Questions?
What is instruction code?
What determines frequency of the clock?
What is micro and macro instruction?
What is control signal?
What is mnemonics?
What is an ALU size?
What is a bus?
25 MGR,ECE,RVCE
Control Unit(CU) Basics
CU generates different control signals needed to perform different operations in data
path.
2 ways to implement: Hardwired & Micro programmed
E.g: Consider a assembly program as follows for the PLU Considered.
(Note: Instructions & Mnemonics assumed are arbitrary.)
Begin
SUB R2,R1 Assembler Directives
CPL R3
AND R2,R3
OR R2,R3
end Instructions
Assembler directives are used to give information to assembler only, no machine codes are generated,
hence called as pseudo instructions in the program.
(Assembler directives are similar to pre processor directives of high level languages).
26 MGR,ECE,RVCE
Assembly Program with machine codes
If the sequence of machine codes to be generated are known, then a digital circuit can be
designed to generate the machine codes => “Hardwired” Control Unit
So, hardwired control unit is predesigned hardware capable of generating one sequence
of machine codes.
27 MGR,ECE,RVCE
Control unit: Micro programmed
The sequence of control signals(micro program) necessary to execute the
different instructions are stored in ROM called control ROM( Micro program
memory/Program memory).
To execute instructions, the control signals stored in the ROM can be
accessed.
The control signals read from the ROM are used to control the micro
operations associated with different instructions to be executed at any time.
The address of the next instruction is generated by a special hardware called
micro program sequencer.
28 MGR,ECE,RVCE
Micro programmed Control unit
29 MGR,ECE,RVCE
Questions
1. Mention different functional units of a computer.
2. What is a processor?
3. What is Processor unit & Control unit ?
4. What is address bus, data bus, control bus?
5. What is address space of the processor?
6. What is the size of the memory supported by processor?
30 MGR,ECE,RVCE
Questions
1. What is required in a processor to support memory?
2. What is data memory?
3. What is program memory?
4. What is chip select signal?
5. How many memory chips of size 4k x 4 are required to
realize 8k x 8 memory?
31 MGR,ECE,RVCE
Microprocessor (MP) & Microcontroller (MC)
MP MC
A silicon chip representing a Central • A microcontroller is a highly
Processing Unit (CPU), which is capable integrated chip that contains a CPU,
of performing arithmetic as well as RAM, On Chip ROM/FLASH
logical operations according to a pre- memory for program storage, Timer
defined set of Instructions. and Interrupt control units and
dedicated I/O ports.
It is a dependent unit. It requires It is a self contained unit and it
the combination of other chips like doesn’t require external Interrupt
Timers, Program and data memory Controller, Timer, UART etc. for
chips, Interrupt controllers etc. its functioning.
for functioning.
32 MGR,ECE,RVCE
Microprocessor (MP) & Microcontroller (MC)
MP MC
Doesn’t contain a built in I/O Most of the controllers contain multiple
port. The I/O Port functionality built-in I/O ports which can be
operated as a single 8 or 16 or 32 bit
needs to be implemented with the Port or as individual port pins.
help of external Programmable
Targeted for embedded market
Peripheral Interface Chips.
where performance is not so
Targeted for high end market
critical (At present this
where performance is important. demarcation is invalid).
Most of the time general purpose
Mostly application oriented or
in design and operation. domain specific.
Limited power saving options
Includes lot of power saving
compared to microcontrollers. features.
33 MGR,ECE,RVCE
Microprocessor (MP) & Microcontroller (MC)
E.g:8051,STM32F407VG
E.g:8086,Intel I5,I7
34 MGR,ECE,RVCE
Instruction Set Architectures(ISAs)
An instruction set, or instruction set architecture (ISA), is the part of the
processor architecture related to programming.
All processors are supported by instruction set /instructions (Assembly
instructions) which are dependent on organization of different components in
PLU.
Depending upon the way of supporting different instructions, the ISA is divided
into
-Reduced Instruction Set Computer(RISC)
-Complex Instruction Set Computer(CISC)
Other types of ISA
- Very Long Instruction Word(VLIW), etc….
35 MGR,ECE,RVCE
CISC & RISC Design Philosophy: CISC Vs RISC
CISC RISC
More number of instructions Lesser no. of instructions.
Instructions are complex to Instructions are Easier to
understand. understand.
• Hardware support for many • Software support for many
instructions (More silicon Usage) instructions/operations.
A programmer can achieve the desired (Less silicon usage)
functionality with a single instruction which Programmer needs to write more code to
in turn provides the effect of using more execute a task since the instructions are
simpler single instructions in RISC simpler ones
• Clock cycles per instruction(CPI) is Clock cycles per instruction(CPI) is
more. less.
36 MGR,ECE,RVCE
CISC & RISC Design Philosophy: CISC Vs RISC
CISC RISC
Code density is more. Code density is less.
Less number of registers. More number of registers.
Memory to memory operations No memory to memory operations
are supported. are supported.
Load & store operations in a Load & store operations not in
instruction a instruction ( So called as
load-store architecture)
NOTE: The fact is, the designers are not worried about the architecture(CISC/RISC). So,
the features from both the architectures are mixed up to increase the performance(Increase
speed & reduce memory consumption).
38 MGR,ECE,RVCE
Questions
What is code density?
What is an orthogonal instruction set?
Why CPI is less in RISC architecture?
Which is the preferable control unit to support complex operations ?
What is the advantage/disadvantage of fixed length instructions?
What is hardware support for an instructions?
39 MGR,ECE,RVCE
Von Neumann & Harvard Architecture
This classification is based on processor architecture design to support memory.
Address Space:
- No. of locations a processor/controller can address.
E.g: 8086: Address bus=20 bits, so address space is 1 Mb
(00000H-FFFFFH)
8051: Address bus=16 bits, so address space is 64 Kb
(0000h-FFFFh)
ARM Cortex M4: Address bus= 32 bits, So address space is
4GB(00000000h-FFFFFFFFh).
40 MGR,ECE,RVCE
Von Neumann/Princeton Architecture
In this architecture, address space is
shared between program memory &
data memory.
E.g: STM32F407VG(based on Cortex M4)
-Total Address space is 4GB(32 bit address)
- The address space is shared between code
(Program flash), data(SRAM)
IO( peripheral),etc.
41 MGR,ECE,RVCE
Von Neumann/Princeton Architecture….
42 MGR,ECE,RVCE
Harvard Architecture
In this architecture, address space
is not shared between program
memory & data memory.
E.g:8051 0xFFFF 0xFFFF
- Total address space for program
memory is 64KB & for data
64 KB 64 KB
memory is 64KB. Data
Program
- Program memory & data memory Memory Memory
0x0000 0x0000
43 MGR,ECE,RVCE
Harvard Architecture...
44 MGR,ECE,RVCE
Von Neumann & Harvard Architecture…
Final Note:
Though STM32F407VG is Von Neumann address space, the architecture
is supported with separate buses for program and data space to increase
the speed.
In fact, many controllers are based on separate bus architecture for
program and data memory.
Von Neumann address space and Harvard bus architecture
45 MGR,ECE,RVCE
Endianness
• Endianness refers to the sequential order in which bytes are arranged
into larger numerical values when stored in memory.
-Wiki
• Little-endian Operation
• E.g:STM32F407VG
46 MGR,ECE,RVCE
Endianness…
Big-endian Operation
47 MGR,ECE,RVCE
Fixed point and Floating point Processors
The term ‘fixed point’ refers to a fixed number of digits after the decimal point.
E.g. 123.45, 1234.56, 12345.67
With ‘floating-point’ representation, the placement of the decimal point can
‘float’ relative to the significant digits of the number.
E.g.1.234567,123456.7,0.00001234567, 1234567000000000
The floating-point computation assures a much larger dynamic range - the largest
and smallest numbers that can be represented.
Floating-point processing yields much greater precision(accuracy) than fixed-
point processing.
49 MGR,ECE,RVCE
Fixed point and Floating point ...
51 MGR,ECE,RVCE
Fixed point and Floating point ….
Double precision(DP) floating point number representation
53 MGR,ECE,RVCE
8 bit MCUs
54 MGR,ECE,RVCE
What is Arm(earlier ARM)?
The Arm holdings design 32/64 bit reduced instruction set computer
(RISC) instruction set architecture (ISA) (?)
ARM does not manufacture silicon.
ARM's business is to sell IP cores, which licensees use to create
microcontrollers and CPUs based on this core.
IP cores:
-Gate Netlist (Hard)
-Synthesizable RTL code (Soft)
55 MGR,ECE,RVCE
IPs Vs Silicon
56 MGR,ECE,RVCE
ARM Design Features
Conditional execution of most
instructions, reducing branch overhead
and compensating for the lack of a branch
predictor(?).
In ARM assembly, the loop is:
It avoids branch instructions when
loop :CMP Ri, Rj ; set condition "NE" if (i != j):
generating code for small if statements.
“ GT" if (i > j) or "LT" if (i < j)
In the C programming language, the loop is:
SUBGT Ri, Ri, Rj ; if "GT" (greater than), i = i-j;
while (i != j) SUBLT Rj, Rj, Ri ; if "LT" (less than), j = j-i;
{
BNE loop ; if "NE" (not equal), then loop
if (i > j)
The Conditional execution avoids the branches
i -= j;
around the then and else clauses.
else
57 j -= i; MGR,ECE,RVCE
}
Design Features contd..
• Another feature of the instruction set is the ability to fold shifts and rotates
into the data processing instructions. For example, the C statement:
a += (j << 2);
could be rendered as a single-word, single-cycle instruction on the ARM.
ADD Ra, Ra, Rj, LSL #2
This results in the typical ARM program being denser than expected with
fewer memory accesses; thus the pipeline is used more efficiently.
• Enhanced DSP/SIMD/VFP instructions are added to standard ARM
instruction set to support faster operation.
58 MGR,ECE,RVCE
Design Features contd..
Advanced Microcontroller Bus Architecture (AMBA) has been widely used for ARM
59 www.arm.com
MGR,ECE,RVCE
ARM Processor Families
60 MGR,ECE,RVCE
ARM Cortex Processor Families
A Profile : Application processors which are designed to handle complex applications such as
high-end embedded operating systems (OSs)
-These processors requiring the highest processing power, virtual memory system support with
memory management units (MMUs).
E.g: High-end mobile phones(Samsung S6: Samsung Eqynos).
R Profile: Real-time, high-performance processors targeted primarily at the higher end of the
real-time market.
-Those applications, such as high-end breaking systems and hard drive controllers, in which
high processing power and high reliability are essential and for which low latency is important.
M Profile : Processors targeting low-cost applications in which processing efficiency is
important and cost, power consumption, low interrupt latency, and ease of use are critical.
61 MGR,ECE,RVCE
Typical Application Domains
Source: google
62 MGR,ECE,RVCE
ARM Cortex-M Series
64 MGR,ECE,RVCE
ARM Instruction Versions
Security
ML
DSP
ARMv9
66 MGR,ECE,RVCE
Traditional Arm ISAs
Problem with ARM and Thumb: Interworking
BX instruction is to be executed transfer control from ARM mode the Thumb
mode and to return to ARM mode.
67 MGR,ECE,RVCE
Traditional Arm ISAs
Solution is Thumb-2: Mixture of 16 bit and 32 bit instructions.
Microcontroller used in lab is based on Thumb-2.
68 MGR,ECE,RVCE