Embedded Systems Design
Topic #1
Introduction to Computing
Topic# 1 INTRODUCTION TO
COMPUTING 3 of 30
Outline
• Gates
• Decision Making Operators
• Number Representation
• Adder/Subtractor
• Memorizing Elements
• Towards a Processor
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 4 of 30
Outline
• Gates
• Decision Making Operators
• Number Representation
• Adder/Subtractor
• Memorizing Elements
• Towards a Processor
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 5 of 30
Gates
Logic Gates
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 6 of 30
Gates
Logic Gates
In electronics what is 1 and what is 0 ????
3.3 V or (5 V) 1
GND 0
A B Q
GND GND GND
3.3 V GND GND
GND 3.3 V GND
3.3 V 3.3 V 3.3 V
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 7 of 30
Outline
• Gates
• Decision Making Operators
• Number Representation
• Adder/Subtractor
• Memorizing Elements
• Towards a Processor
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 8 of 30
Decision Making Operators
Decision/Selection Operators
s s0 y
1
0 0 a
0 1 b
1 0 c
Multiplexer 1 1 d
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 9 of 30
Decision Making Operators
Decision/Selection Operators a b w x y z
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
a b c d w x
1 0 0 0 0 0
Encoder 0 1 0 0 0 1
0 0 1 0 1 0
0 0 0 1 1 1
a b c d w x
Priority 1 x x x 0 0
Encoder 0 1 x x 0 1
0 0 1 x 1 0
0 0 0 1 1 1
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 10 of 30
Outline
• Gates
• Decision Making Operators
• Number Representation
• Adder/Subtractor
• Memorizing Elements
• Towards a Processor
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 11 of 30
Number Representation
Unsigned Number Representation
General Rule for Unsigned Representation of a system having x as
base (where x is 2 in binary system, 8 in octal system 10 in decimal
system and 16 in hexadecimal system)
In x-base system total x characters to represent a number e.g in Binary
(base 2) 0 and 1 to represent a number , in octal 0 to 7, in decimal 0-9
and 0-9, A-F in hexadecimal system.
xn-1 ……x3 x2 x1 x0 . x-1 x-2 x-3 x-4 x-5……. x-m
Integer . Fractional
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 12 of 30
Number Representation
Unsigned Number Representation
Example of Decimal System
……. 103 102 101 100
......1000 100 10 1
e.g a number in decimal system = (5003)10
= 5x103 + 0x102 + 0x101+ 3x100
Example of Binary System
……. 23 22 21 20
.....……8 4 2 1
e.g a number in binary = (1101) 2
In Decimal = 1x23 + 1x22 + 0x21+ 1x20
= 8+4+0+1= (13)10
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 13 of 30
Number Representation
Unsigned Number Representation
Range of Unsigned number = 2no. of bits – 1 e.g. if no. of bits are 3 then range is
= 23 – 1 = 7
22 21 20 Decimal Number
ati ve
0 0 0 0 r n eg
ti veo
0 0 1 1 po si
e
0 1 0
nb
ca2
hic h
0 1 1be r w 3
n u m
1nged0 0 4
S i
wi th 1 0 1 5
d o
at to 1 1 0 6
Wh
1 1 1 7
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 14 of 30
Number Representation
Signed Number Representation
Signed Magnitude Representation 1’s Compliment Representation
S 21 20 Decimal Number Decimal Number
0 0 0 +0 0 0 0 +0
0 0 1 +1 0 0 1 +1
0 1 0 +2 0 1 0 +2
0 1 1 +3 0 1 1 +3
1 0 0 -0 1 0 0 -3
1 0 1 -1 1 0 1 -2
1 1 0 -2 1 1 0 -1
1 1 1 -3 1 1 1 -0
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 15 of 30
Number Representation
Signed Number Representation
2’s Compliment Representation
-22 21 20 Decimal Number
0 0 0 +0
0 0 1 +1
0 1 0 +2
0 1 1 +3
1 0 0 -4
1 0 1 -3
1 1 0 -2
1 1 1 -1
Range of Unsigned number = -2no. of bits-1 to 2no. of bits-1 – 1
e.g. if no. of bits are 3 then range is = -23-1 to 23-1 – 1 = -4 to +3
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 16 of 30
Outline
• Gates
• Decision Making Operators
• Number Representation
• Adder/Subtractor
• Memorizing Elements
• Towards a Processor
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 17 of 30
Adder/Subtractor
Arithmetic Operators
1- Bit Binary Half Adder
A B S C
A Half S 0 0 0 0
B Adder C 0 1 1 0
1 0 1 0
1 1 0 1
Note:
Operand of One Bits
S Total Sum of two bits i.e
1 bit sum and 1 bit carry
C
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 18 of 30
Overview
Arithmetic Operators A B Cin S Cout
0 0 0 0 0
1- Bit Binary Full Adder 0 0 1 1 0
A
Full S 0 1 0 1 0
B Carry Out
Adder 0 1 1 0 1
Carry In 1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
4 - Bit Binary Full Adder
S4
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 19 of 30
Adder/Subtractor
Arithmetic Operators
Subtractor:
To get C = A-B we can do C= A + (-B)
How –B can be achieved
• Take 1’s Complement of ‘B’ by inverting each bit
• Add 1 to 1’s complement of ‘B’
Can we modify adder circuit to behave as combined adder/subtractor.???
Yes why not …
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 20 of 30
Adder/Subtractor
Arithmetic Operators
Combined Adder/Subtractor:
1. When addition we need Cin = 0 and B is transferred as it is to FA.
2. When subtraction is required we put Cin = 1 and it do two things:
1. Inverts each bit of B as b xor 1 = b’
2. Add one to result as Cin = 1
3. Hence S = A + (B’ + 1) = A + (- B)
And this is what we need to perform 2’s complement of B
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 21 of 30
Outline
• Gates
• Decision Making Operators
• Number Representation
• Adder/Subtractor
• Memorizing Elements
• Towards a Processor
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 22 of 30
Memorizing Elements
Flip-Flops without
/with enable
d
• Reset Pin: to force Flip-Flop contents to 0.
• Clk Pin: When rising or falling edge of the clock only then
output is updated and this happens once in a clk period.
• Enable : if enable is 1 and when rising or falling edge of the
clock only then output is updated and this happens once in
a clk period.
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 23 of 30
Memorizing Elements
4 bit - Registres
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 24 of 30
Memorizing Elements
4 Bit 4 Location Memory
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 25 of 30
Outline
• Gates
• Decision Making Operators
• Number Representation
• Adder/Subtractor
• Memorizing Elements
• Towards a Processor
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 26 of 30
Towards a Processor
Small Processor
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 27 of 30
Inside the Computer
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 28 of 30
Inside the Computer
Course Title – Embedded Systems Design
Topic# 1 INTRODUCTION TO
COMPUTING 29 of 30
Inside the Computer
Course Title – Embedded Systems Design