0% found this document useful (0 votes)
4 views

01 Introduction

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

01 Introduction

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 86

CS203: Digital Logic Design

Introduction
Neeraj Goel
IIT Ropar
Introduction
• What is a digital systems
– Takes digital input
– Digital output
– Process digital information
• Digital
– Discrete and discontinuous
– Example – decimal digits 0, 1, 2, ...9
– Combination of digits become number – still digital
• We perceive real world as analog – continuous in
values as well as in time
• Can digital system be of any use?

Digital Logic Design:Introduction. 2


Example
• Calculator, computer, laptop, smart phones,
mobiles, internet, routers
• LED TV, smart TV, set-top boxes, digital
cameras
• Automated washing machine, air conditioners,
various parts of our cars,

Digital Logic Design:Introduction. 3


Why this course?
• Digital systems is the core of digital revolution
– Very large scale integration

• 4th industrial revolution – ML, AI, IoT


– Fast, efficient, small digital circuits

• Designing an efficient system in a given cost,


area, performance, and power is the key
Digital Logic Design:Introduction. 4
Design of digital system
1. Representing Information in
digital form

Hardware description
2. Boolean algebra, Logic gates,
Language (Verilog)
optimizations

Simulation and
3. Combinational Synthesis
4. Sequential Logic
Logic

FPGA Implementation
5. System Design

6. Technology aspects,
Synthesis, FPGA
Digital Logic Design:Introduction. 5
Learning Objectives
1. To learn fundamentals of digital design, including
boolean algebra, basic gates, logic minimization, finite
state machines, state minimization.
2. To learn to design standard logic blocks like arithmetic
operations, encoders, multiplexers, counters, registers
using basic logic gates
3. To learn to analyze a digital system for area and delay
4. To learn to design a digital system using basic gates,
standard logic blocks. Digital system may be
combinational or sequential or both

Digital Logic Design:Introduction. 6


Evaluation scheme
• Class performance (10%)
– All individual short quizzes will be given equal weightage, say 1.
Assume total Q quizzes are conducted. Class performance =
min(1, (sum of marks obtained in all quizzes)/(0.8 x Q))) x 10
• Module quizzes (25%). An online quiz after end of each
module is expected. If total N module quizzes are
conducted, performance on best N -1 would be considered.
• Lab assignments (25%) : Most of the lab exercise will be in
Verilog HDL. Lab exercises will also include a course project.
• End term exam (40%) : End term exam will be offline
conducted physically at IIT Ropar

Digital Logic Design:Introduction. 7


Books
• Fundamentals of Logic Design By Charles H.
Roth, Jr., Larry L Kinney, 7th edition
• Digital design by Morris Mano and M.D.
Ciletti, 6th edition, published by Pearson
• Switching and Finite Automata theory by
Kohavi and Jha, 3rd edition.
• Digital Systems Design Using Verilog By
Charles Roth, Lizy K. John, Byeong Kil Lee

Digital Logic Design:Introduction. 8


Logistics
• Course website:
https://sites.google.com/view/neerajgoel/teaching/digital-logic-design
• All the exams/tests are open book but fixed time
• Post your queries on Google classroom
• Late penalty for lab submissions (10% per day)
• For module quizzes and in-class quizzes – fixed
deadline. No re-takes
• Plagiarism penalty
– First instance (-2 * Assignment/lab marks)
– Second instance – F Grade

Digital Logic Design:Introduction. 9


Summary
• Learnt about what is digital system and its
importance

Digital Logic Design:Introduction. 10


Analog Vs Digital
Module 1.02

Digital Logic Design:Introduction. 11


Objective of the lecture
• Digital signal and binary representation

• How digital signals are obtained

• Comparison of digital and analog system

Digital Logic Design:Introduction. 12


Binary representation of digital signal
• Two states of matter – Black/White,
clockwise/anti-clockwise, charged/discharged,
+/- charge
• A binary digit represent two states – 0 and 1
• In electronic system : 1 is high voltage, 0 is low
voltage or vice versa

Digital Logic Design:Introduction. 13


Binary representation
• 1 bit -> represents 2 states
• 2 bits -> represent 4 states (00, 01, 10, 11)
• 3 bits -> represent 8 states
• N bits -> represents 2N states

• 10 bits -> 210 states = 1024 = ~1000


• 20 bits -> 220 states = 210 x 210 = ~106
• 30 bits -> 230 states= ~109
– (approx population of india)

Digital Logic Design:Introduction. 14


Creating digital signal from analog signal
7(111)
6(110)
Values

5(101)
4(100)
3(011)

2(010)
1(001)

1 2 3 4 5 6 Time

•Discretization in time – sampling


•Discretization of values – using quantization

Digital Logic Design:Introduction. 15


Analog Input
Physical/natural signals

ADC
Sensors (image,
microphone, piezoelectric) Digital Input

Digital System
Analog System
Digital Output
DAC

Transducers and
Actuators Analog Output

Digital System Design 16


Digital VS Analog
• Digital systems
+ Accuracy
+ Programmability
+ Maintainability
+ Design automation

- Area (cost), power, performance

Digital Logic Design:Introduction. 17


Applications
• Computing
• IoT
• Communication
• Entertainment
• Manufacturing/industry
• Automotive
• ....

Digital Logic Design:Introduction. 18


Factors pushing the growth story
• Moore’s law

• Technology

• Compute
requirements

• Design
automation
Digital Logic Design:Introduction. 19
Summary M1.02
• Analog to digital conversion

Digital Logic Design:Introduction. 20


How to represent information in Binary
M1.03

Digital Logic Design:Introduction. 21


How to represent information in
binary
• 2 bit numbers – four states
– 00, 01, 11, 10
• Which number should map to which
combination?
• The problem will become more complex with
increase in number of bits

Digital Logic Design:Introduction. 22


Traditional number system
• Historically we have used different base numbers
(10, 12, 15, 16, 20)
• We used symbols representing various numbers,
like in Romon, I, V, X, L, C
• Positional and non-positional number system
– Value of a symbol depend on its positions
• Converged to positional decimal system for
routine task
– Scalable
– Good for calculations

Digital Logic Design:Introduction. 23


Positional number system
• Value of symbol depends on its position and
radix.
– N = (anan-1..a0)R = ∑aiRi
• Example: 483 = 4x100 + 8x10 + 3
• Definition can be extended to fractions
– N = (anan-1..a0a-1a-2...a-m)R = ∑aiRi
• Example 1.74 = 1 + 7/10 + 4/100

Digital Logic Design:Introduction. 24


Positional binary number system
• Radix or base is 2.
128 64 32 16 8 4 2 1
a7 a6 a5 a4 a3 a2 a1 a0
• Example (binary to decimal conversion)
– (101101)2 = 32 + 8 + 4 + 1 = 45
– (101.101)2 = 4 + 1 + 0.5 + 0.125 = 5.625

Digital Logic Design:Introduction. 25


Decimal to binary conversion
• Decimal to base R
– N divide by R, reminder is a0, quotient become N
– Repeat above step to get subsequent digits
• Example
2 53
2 26 1 a0 = 1 (53)10 = (110101)2
2 13 0 a1 = 0
2 6 1 a2=1
2 3 0 a3=0
2 1 1 a4=1
0 1 a5=1
Digital Logic Design:Introduction. 26
Decimal to binary conversion-fractions
• Fraction part (F) to base R
– Multiply F with R, non-fractional part is a-1,
fractional become F
– Repeated multiplication get subsequent digits
• Example 0.7 to binary
0.7 x2 1.4 a-1 = 1
0.4 x2 0.8 a-2 =0
0.8 x2 1.6 a-3 =1 (0.7)10 = (0.101100)2
0.6 x2 1.2 a-4 =1 (0.7)10 = (0.10110)2
0.2 x2 0.4 a-5=0
0.4 x2 0.8 a-6=0
Digital Logic Design:Introduction. 27
Other radix
• Other radix that will be used in course: 16
– Hexadecimal, popularly called hex numbers
– Require 16 symbols
– 0 to 9, A, B, C, D, E, F
• Generally prefixed by 0x
• Example 0xBAD 0x345, 0x500D

Digital Logic Design:Introduction. 28


Binary to Hex & Vice-versa
• Binary to hex
– Make group of 4 bits (nibbles)
– From right to left (LSB to MSB)
• Example
– 10011110001
– 100 1111 0001
– 0x4F1
• Hex to binary – replace binary equivelant to each
digit
– 0xBAD -> 1011 1010 1101

Digital Logic Design:Introduction. 29


Addition in Binary
• Similar to decimal
1 0 1 1 1
additions
1 1 0 1 1 1
1 + 1 = (10)2 + 1 1 0 1 0 1
1 + 1 + 1 = (11)2
1 1 0 1 1 0 0
1 + 0 = (1)2

Digital Logic Design:Introduction. 30


Subtraction in binary
• Similar to decimal subtraction
1–1=0 1 1 1
1–0=1 1 1 0 0 1 1
0 – 1 = 1, borrow 1 - 0 1 0 1 0 1

0 1 1 1 1 0

• What if second number is greater and result is


negative
– How do we represent negative numbers in binary?

Digital Logic Design:Introduction. 31


Summary
• Learnt about positional and non-positional
number system
• Binary positional system
• Decimal to binary conversion
• Binary to hex conversion
• Binary addition/subtraction
Reference: Section 1.2 of Fundamental of Logic
Design by Roth
Digital Logic Design:Introduction. 32
Negative numbers and binary
addition/subtraction
M1.04

Digital Logic Design:Introduction. 33


How to represent negative numbers?
• How to we do it decimal numbers
– Negative sign
• Can we use negative sign in binary
– Computer/digital world only understand 0 and 1
• How about reserving one bit for sign

Digital Logic Design:Introduction. 34


Sign magnitude negative numbers
• MSB is designated to show sign. 1 represents
negative, 0 represents positive.
• Example (8 bit binary number)
– (1001 0011)2 = (-35)10
– (0111 1111)2 = (127)10
• Range for 8 bit number – (127)10 to (127)10
• Two zeros (1000 0000)2 and (0000 0000)2

Digital Logic Design:Introduction. 35


Sign magnitude addition/subtraction
• Addition
– If signs are same –> add
– If signs are different -> subtract
(1000 1111) + (0111 0000)
= 111 0000 – 000 1111 (subtract without sign bit)
= 110 0001 (result without sign bit)
(1000 1111) + (0111 0000) = (0110 0001)
Result’s sign will change if number to be subtracted is bigger
• Subtraction
– If signs are same -> subtract
– If signs are different -> add

Digital Logic Design:Introduction. 36


Sign magnitude summary
• Two zeros create confusion
• Addition may result in addition or subtraction
• Hardware implementation
– Requires both adder and subtractor
– Requires controller that determine which
hardware to use
– Separate handling of sign

Digital Logic Design:Introduction. 37


Alternative – 1’s compliment
• Assume
– For negative number –u flip all bits of +u
– Nth bit represent sign (1 for -ve, 0 for +ve)
– (N-1) bits represent magnitude
• Example (8 bit)
(+13)10 = (0000 1101)2 (-13)10 = (1111 0010)2
(+69)10 = (0010 0101)2 (-69)10 = (1101 1010)2
• Range -2N-1 to 2N-1

Digital Logic Design:Introduction. 38


1’s complement
• Mathematical background of 1’s complement
– 2N -1 = 111.....1
– -u = ~|u| = 2N - 1 - |u|
• Issues
– Two zeros (0000 0000) and (1111 1111)
– Addition and subtraction is challenging
0000 1101 + 1111 0010 = 1111 1111
0000 1101 + 1111 0011 = 0000 0000

Digital Logic Design:Introduction. 39


Another alternative – Bias
• Add a bias to number and find binary
• F(u) = u + bias
• Say bias for 8 bit number is 127
(1)10 = (1000 0000)2
(-127)10 = (0000 0000)2
(+128)10 = (1111 1111)2
• Adding two numbers in binary
– F(u + v) = F(u) + F(v) - bias

Digital Logic Design:Introduction. 40


Summary so far
• Representation should be simple
• Two values of zero are not desirable
• Addition/subtraction should be easy

Digital Logic Design:Introduction. 41


Number circle

Overflow

Underflow

Discontinuity - Breakpoint

https://thesis.laszlokorte.de/demo/number-circle.html

Digital Logic Design:Introduction. 42


Number circle

https://thesis.laszlokorte.de/demo/number-circle.html

Digital Logic Design:Introduction. 43


Number circle

Clockwise – addition
Anticlockwise – subtraction
Positive number
- u clockwise steps from 0
Negative number
- u steps anticlockwise from 0
u clockwise steps =
2N – u anticlockwise u steps

https://thesis.laszlokorte.de/demo/number-circle.html

Digital Logic Design:Introduction. 44


2’s complement
• If u is +ve: F(u) = |u|
• If u is –ve : F(u) = 2N - |u| = ~|u| + 1
• Properties
– Single zero
– MSB represents sign
– Negation rule
• F(-u) =2N – F(u)
– Range (-2N-1) to (2N-1 + 1)

Digital Logic Design:Introduction. 45


2’s complement arithmetic
• Addition
F(u+v) = F(u) + F(v)
– Normal addition will work for both positive and
negative numbers
• Subtraction
F(u – v) = F(u) + F(-v)
• Multiplication (assume no overflow)
F(uxv) = F(u) x F(v)

Digital Logic Design:Introduction. 46


Examples
2 x -3 (using 4 bit) 13 + (-3) 13 – 5 = 13 + (-5)
0010 0000 1101 0000 1101
x1101 + 1111 1101 + 1111 1011
-------- ---------- ----------
0010 1 0000 1010 1 0000 1000
0000
0010
0010
---------
0011010

Digital Logic Design:Introduction. 47


Overflow and underflow
• Overflow/underflow for addition
– If sign of both operands are same and result is of
opposite sign or result is 0 => overflow
– If sign of both operands are different => overflow
can never occur
• Converting N bit number to M bit number
– Sign extension
– 1101 in 4 bit is 1111 1101 in 8 bit

Digital Logic Design:Introduction. 48


Summary
• We understood about negative numbers
• And Arithmetic of numbers

Digital Logic Design:Introduction. 49


Other possible Encoding
M1.05

Digital Logic Design:Introduction. 50


Number encoding problem
• Finding one-to-one mapping between binary
combination and corresponding decimal value
– 4 bit binary number have 16 possible
arrangements
– Which arrangement should be mapped to which
decimal number
– Is any other option other than positional number
system?
• Positional number system is not the only
method!
Digital Logic Design:Introduction. 51
BCD number system
• Problem: we want to represent decimal
numbers in binary
• Solution:
A. Convert decimal number to binary number, use
positional binary number
i. Inconvenient conversion
ii. For display again binary to decimal conversion is
required
B. Represent each digit to corresponding binary:
BCD number system

Digital Logic Design:Introduction. 52


8421 BCD numbers
• Say we want to represent decimal number 5682
to binary?
– 5 -> 0101
– 6 -> 0110
0101 0110 1000 0010
– 8 -> 1000 5 6 8 2
– 2 -> 0010
• Each decimal digit is represented by 4 bits/one
nibble
– Four bits have weight of 8, 4, 2 and 1
– 8421 BCD number (default BCD representation)

Digital Logic Design:Introduction. 53


BCD number advantages
• No conversion from decimal representation
required
– One-to-one mapping with each digit
– More intuitive representation
• Initial computers (example IBM System/360)
used BCD numbers

Digital Logic Design:Introduction. 54


BCD Arithmetic
• BCD addition Algorithm
56 +75 1. Normal binary addition
0101 0110 1100 1011 2. If output of a nibble is more than
+0111 0101 +0110 0110 9 or carry is generated by the
---------- ---------- nibble : add 0110 to the nibble
1100 1011 1 0011 0001 3. Carry pass from one nibble to
another in both steps (1 and 2)
1 3 1

Digital Logic Design:Introduction. 55


Other BCD representation
• Excess 3 code
0 0011
Self complementing
1 0100 After addition of two numbers – need to
2 0101 Add/subtract 3 to fix the final results
3 0110
4 0111
5 1000
6 1001
7 1010
8 1011
9 1100

Digital Logic Design:Introduction. 56


Error resilient codes
• 2 out of 5 code
0 00011
1 00101
2 00110
3 01001
4 01010
5 01100
6 10001
7 10010
8 10100
9 11000

Digital Logic Design:Introduction. 57


Low power code: gray code
• Transition between adjacent number is minimum

0 0000
1 0001 Another sequence for gray code
2 0011 ->0000 -> 0001 -> 0011 -> 0010
->0110 -> 0111 -> 0101 -> 0100
3 0010
->1100 -> 1101 -> 1111 -> 1110
4 0110 ->1010 -> 1011 -> 1001 -> 1000
5 1110
6 1010
Good for counting!
7 1011
8 1001
9 1000

Digital Logic Design:Introduction. 58


Representing characters
• ASCII
– Using 8 bit number for each commonly used
character
• UTF 8
– Compatible with ASCII
– Used 1 to 6 bytes
• UTF-16

Digital Logic Design:Number System. 59


Summary
• There could be different encoding used for
different scenarios
• Purpose of each code could be different

Digital Logic Design:Introduction. 60


Floating point representation
M1.06

Digital Logic Design:Introduction. 61


Representing real numbers
• Digital numbers are discrete
– Can we use them to represent real numbers?
• We learnt to represent fractional part in
binary
• One issue: Decimal point also to be
represented in binary

Digital Logic Design:Introduction. 62


Precision
• Precision is number of digits after decimal
point
– May be due to limitation of our measuring
instrument
– Or due to representation of number
• Denotes smallest number that can be
represented, minimum difference between
two numbers

Digital Logic Design:Introduction. 63


How to represent decimal point
• Fixed point
– Agreement between writer and reader
– Does not change during the program
– Total number of digits remain same
• Example
– Assuming 4 decimal digits can be represented and
decimal point after 2 digits
• 2300, 123, 1, 100 would represent 23.00, 1.23, 0.01, 1.00
– Effectively multiplying a number by 100

Digital Logic Design:Introduction. 64


Fixed point in binary
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

• No decimal point
– Maximum range (0 to 65536) or (-32768 to 32767)
• Decimal point after 4 bits
– Range -2048 to 2047 and 4 bits for fraction
• Decimal point after 8 bits
– Range -256 to 255 and 8 bits for fraction
Limited range and precision – with given number of bits
Digital Logic Design:Introduction. 65
Real numbers
Number of atoms in 1 gram of Hydrogen
602000000000000000000000

Data generated in a day


in 2018 : 2500 peta byte
Weight = 5.972 × 1024 kg

Electron mass: Number of bytes in One peta-byte


9.1093837015×10−31 Kg 1125899906842624 = ~ 1015 bytes

Size of transistor
In latest chips
7nm

image source: google Digital Logic Design:Introduction. 66


Best way to represent real numbers
• Scientific notations X
0.5 x 106

– Normalized 5.0 x 105

• Large as well as small numbers


can be represented
• Exponential in binary
1000001 = 1.000001 x 26
• Representing – decimal point,
exponent in binary?
Digital Logic Design:Introduction. 67
Exponential binary numbers
• Significand (could be +/-) -1.000000 x 2-26
1.101001 x 28
• Fraction or mantissa -1.100010 x 210
1.000001 x 2-18
• Exponent (could be +/-)
• Typical binary representation
– 1 bit for sign of significand
– Few bits for exponent
– Rest bits for mantissa
How to distribute bits in exponent and mantissa?

Digital Logic Design:Introduction. 68


IEEE 754 Floating point
• 32 bit number (single precision)
– 1 bit for sign (s)
– 8 bits for exponent (e) : bias of 127, 0 and 255 are
reserved
– 23 bits for mantissa (m)
3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
s exponent Mantissa

• Number = (-1)s x (1 + 0.m) x 2e

Digital Logic Design:Introduction. 69


Floating point example 1
• Decimal number: 24.25
= 16+8+0.25
• Binary number: 11000.01
• Normal scientific form : 1.100001 x 24
• Sign: 0
• Mantinssa: 100 0010 0000 0000 0000 0000
• Exponent: (127 + 4)10 = (131)10 = (100 0001 1)2
• Floating point number
0100 0001 1100 0010 0000 0000 0000 0000
0x41C20000

Digital Logic Design:Introduction. 70


Floating point example 2
• Decimal number: 0.625
= 0.5 + 0.125
• Binary number: 0.101
• Normal scientific form : 1.01 x 2-1
• Sign: 0
• Mantinssa: 010 0000 0000 0000 0000 0000
• Exponent: (127 -1)10 = (126)10 = (011 1111 0)2
• Floating point number
0011 1111 0010 0000 0000 0000 0000 0000
0x3F200000

Digital Logic Design:Introduction. 71


Floating point example 3
• Decimal number: -2.625
= 2 + 0.5 + 0.125
• Binary number: -10.101
• Normal scientific form : -1.0101 x 21
• Sign: 1
• Mantinssa: 010 1000 0000 0000 0000 0000
• Exponent: (127 +1)10 = (128)10 = (100 0000 0)2
• Floating point number
1100 0000 0010 1000 0000 0000 0000 0000
0xC0280000

Digital Logic Design:Introduction. 72


Floating point example 4
• Decimal number: 1

• Binary number: 1
• Normal scientific form : 1.0 x 20
• Sign: 0
• Mantinssa: 000 0000 0000 0000 0000 0000
• Exponent: (127 +0)10 = (127)10 = (011 1111 1)2
• Floating point number
0011 1111 1000 0000 0000 0000 0000 0000
0x3F800000

Digital Logic Design:Introduction. 73


Summary
• Real number can be represented in binary
form
– Both in fixed point format as well as floating point
format

Digital Logic Design:Introduction. 74


Floating point numbers continued
M1.07

Digital Logic Design:Introduction. 75


Example (continued)
• Floating point to decimal
• Floating point number : 0xc2630000
1100 0010 0110 0011 0000 0000 0000 0000
• Sign: 1
• Exponent:100 0010 0 = 128 + 4 = 132
– Actual exponent = 132 – 127 = 5
• Mantissa: 110 0011 0000 0000 0000 0000
• Binary number = 1. 110 0011 x 25
= 111000.11
= 32 +16 + 8 + 0.5 + 0.25
= 56.75

Digital Logic Design:Introduction. 76


Range
• Largest number: Exponent 254, mantissa all 1’s
– F = 1.111.....1 x 2127 = ~2128 = ~3.4 x 1038
• Smallest number: exponent 1, mantissa 0
– F = 1.0 x 2-126 = ~1.1x10-38
• Zero – Exponent 0, Mantissa 0
Positive 0: 0x0000 0000
Negative 0: 0x8000 0000
A Good online convertor
https://www.h-schmidt.net/FloatConverter/IEEE754.html

Digital Logic Design:Introduction. 77


Number line
0

Largest negative Smallest negative Smallest positive Largest positive


+3.4x1038 -1.1x10-38 1.1x10-38 3.4x1038

Discontinuity at and near 0 and two values of 0


If number is smaller than smallest positive
-> positive 0
If number if smaller than smallest negative
-> negative 0
If number is more than largest positive
-> positive Infinity

Digital Logic Design:Introduction. 78


Reserve exponent values
• E = 255
– If mantissa is 0 -> it represents infinity
– If mantissa is ≠ 0 -> NaN, not a number
• Divide by 0, multiplication of infinity with zero
• E=0
– If mantissa is 0 -> number is 0
– If mantissa is ≠ 0 -> denormal number

Digital Logic Design:Introduction. 79


De-normal numbers
• Numbers smaller than smallest normal
number and larger than 0
• Exponent is zero
• N = (-1)s x P x 2 -126, (P = 0 + M, 0< M < 1)
• Smallest denormal number : 2-149

Digital Logic Design:Number System. 80


De-normal number example
• Smallest normal number
– 1.0 x 2-126
• Number smaller than smallest normal number
0.00011 x 2-126
• Sign: 0
• Mantinssa: 000 1100 0000 0000 0000 0000
• Exponent: (0)10 = (000 0000 0)2
• Floating point number
0000 0000 0000 1100 0000 0000 0000 0000
0x000C0000

Digital Logic Design:Introduction. 81


IEEE 754 Floating point
• 64 bit number (double precision)
– 1 bit for sign (s)
– 11 bits for exponent (e) : bias of 1023, 0 and 2048
are reserved
– 52 bits for mantissa (m) Approx 15 digit of decimal precision

• Half precision number – 16 bits


– 1 bit of sign
– 5 bit of exponent: bias of 15
– 10 bits for mantissa

Digital Logic Design:Introduction. 82


Extended precision numbers
• More precise then double precision
– Non standardized 128 bit or 256 bit
• Intel’s 80 bit format floating point formats

– 1 bit of sign
– 15 bit of exponent
– 64 bit of mantissa

Digital Logic Design:Introduction. 83


Example of half precision
• Decimal number: -2.625
= 2 + 0.5 + 0.125
• Binary number: -10.101
• Normal scientific form : -1.0101 x 21
• Sign: 1
• Mantinssa: 01 0100 0000
• Exponent: (15 +1)10 = (16)10 = (100 00)2
• Floating point number
1100 0001 0100 0000
0xC140

Digital Logic Design:Introduction. 84


Issues with Floating point numbers
• Quantization issues
– Different rounding can lead to different results
– Different formats have different precision
– Accumulation of errors
• Hardware/computational cost

Digital Logic Design:Introduction. 85


Summary
• Binary can be used to represent
– Signed, unsigned numbers, text, floats
– Commands, instructions
• Binary can be used to represent presentations,
documents, movies, etc

Digital Logic Design:Introduction. 86

You might also like