View by Category

Loading...

PPT – Arithmetic operations in binary PowerPoint presentation | free to download

The Adobe Flash plugin is needed to view this content

About This Presentation

Write a Comment

User Comments (0)

Transcript and Presenter's Notes

Arithmetic operations in binary

- Addition / subtraction
- 01011
- 111
- ?
- Method exatly the same as decimal

Arithmetic operations in binary

- Addition
- X xn xi x0
- Y yn yi y0
- __________________
- di
- di (xi yi ) mod r carry-in

Addition

- For ( i 0n ) do
- di (xi yi carry-in) mod r
- carry-out (xi yi carry-in) div r
- End for

Arithmetic operations in binary

- Subtraction
- Can you write an equivalent method (algorithm)

for subtraction? - Algorithm a systematic sequence of

steps/operations that describes how to solve a

problem

Arithmetic operations in binary

- Subtraction
- X xn xi x0
- ? Y yn yi y0
- __________________________________________________

_ - di
- For ( i 0n ) do
- di ( xi ? yi ? bi-1 ) mod r
- borrow-out ( xi ? yi ? bi-1 ) div r
- End for

Subtraction

Arithmetic operations in binary

- Multiplication
- For ( i 0n ) do
- di ( xi ? yi ci-1 ) mod r
- ci ( xi ? yi ci-1 ) div r
- End for
- Is this correct?

Negative numbers (4 traditions)

Signed magnitude Radix complement Diminished

radix complement Excess-b (biased)

e.g. n 4, r 10 7216 --gt 9999 - 7216 1

2784 (10s complement) n 4, r 2 0101 --gt

1111 - 0101 1 1011 (2s complement)

diminished radix complement is

e.g. n 4, r 10 7216 --gt 9999 - 7216 2783

(9s complement) n 4, r 2 0101 --gt 1111 -

0101 1010 (1s complement)

Note operation is reversible (ignoring

overflow) i.e. complement of complement returns

original pattern (for both radix and diminished

radix forms) for zero and its complement 10s

complement 0000 --gt 9999 1 10000 --gt

0000 9s complement 0000 --gt 9999 --gt 0000

Arithmetic with complements n 4 r 2

Excess-8

Signed number representations

- N rn ( rn N ) N
- ( N N ) mod rn 0
- Example (n 4)
- 5 ? 0101
- -5 ? 1011
- 10000 ? 24
- N N mod 24 0
- N 5 r 10 N 32546
- N 105 32546 (67454)10

Twos complement arithmetic

- ( an-1, an-2, a0 ) in 2-s complement is
- Example (n 4)
- 0101 ? ?0?23 1?22 0?2 1?1 4 1 5
- 1011 ? ?1?23 0?22 1?2 1?1 ?8 2 1

?5 - Addition/subtraction (n 5)
- 10 ? 01010
- 3 ? 00011
- 01101 ? 13

Twos complement arithmetic

- Addition/subtraction (n 5)
- 10 ? 01010
- 7 ? 00111
- Overflow 10001 ? ?15
- 15 ? 01010
- ?13 ? 10011
- Discard 100010 ? 2

When can overflow happen? Only when both operands

have the same sign and the sign bit of the result

is different.

Cyclic representation (n 4, r 2) avoid

discontinuity between 0111 and 1000

Add x move x positions clockwise Subtract

x move x positions counterclockwise move (16 -

x) positions clockwise (i.e. add radix

complement)

How to detect discontinuity?

no overflow (in 4-bit register) but, carry into

most significant bit is 1 while carry out is 0

Same circuitry signed numbers add subtract

(use 2s complement of subtrahend) Intel

architecture OF (overflow flag) detects

out-of-range result

unsigned numbers same protocol but

discontinuity is now between 0000 and

1111 detect with overflow for

addition lack of overflow for

subtraction Intel uses CF (carry flag) to

detect out-of-range result

Codes 4-bit codes for digits 0

through 9 (BCD 8421 weighted) 2421 and Excess-3

are self-complementing (complement bits to get

9s complement representation) Biquinary has two

ranges 01 and 10 one-bit error produces

invalid codeword

(No Transcript)

Number representation inside computer

- Integers represented in 2s complement
- Single precision 32 bits
- Largest positive integer is 231-1
- 2,147,483,647
- Smallest negative integer is -231
- 2,147,483,648

Number representation inside computer

- Floating point
- Scientific notation
- 0.0043271 0.43271?10-2
- normalized number
- The digit after the decimal point is ? 0
- Normalized notation maximizes the use of

significant digits.

Floating point numbers

- Floating point
- N (-1)S ? m ? rE
- S 0 ? positive
- S 1 ? negative
- m ? normalized fraction for radix r 2
- As MSB digit is always 1, no need to explicitly

store it - Called hidden bit ? gives one extra bit of

precision

Floating point formats

- IEEE format (-1)S?(1.m)?2E-127
- DEC format (-1)S?(0.m)?2E-128

Floating point formats

- Different manufacturers used different

representations

Mechanical encoder with sequential sector

numbering At boundaries can get a code

different than either adjacent sector

Gray code

Gray code algorithm input (binary)

output (Gray code)

e.g. n 3 6 -gt 110 -gt 101 n 4 10 -gt 1010

-gt 1111

Representing non-numeric data

- Code systematic and preferably standardized way

of using a set of symbols for representing

information - Example BCD (binary coded decimal) for decimal

s - It is a weighted code ? the value of a symbol

is a weighted sum - Extending number of symbols to include alphabetic

characters - EBCDIC (by IBM) Extended BCD Interchange Code
- ASCII American Standard Code for Information

Interchange

Codes

Cyclic codes

- A circular shift of any code word produces a

valid code word (maybe the same) - Gray code example of a cyclic code
- Code words for consecutive numbers differ by one

bit only

Ascii, ebcdic codes State codes, e.g.

Consequences of binary versus one-hot coding

n-cubes of codewords

Hamming distance between x and y is count of

positions where x-bit differs from y-bit Also

equals link count in shortest path from x to y

Gray code is path that visits each vertex

exactly once

Error-detecting codes

concept choose code words such

that corruption generates a non-code word to

detect single-bit error, code words must

occupy non-adjacent cube vertices

Error-correcting codes minimum distance between

code words gt 1

Write minimum distance as 2c d 1 bits

gt corrects c-bit errors and detects (c

d)-bit errors Example min distance 4 2(1)

1 1

But also, 4 2(0) 3 1

Why? suppose minimum distance is h

c

c

h - 2c

?

d h - 2c -1

pair of closest nodes maximally distant from

left with entering correction zone 2c d 1

2c (h - 2c - 1) 1 h

Hamming codes

number bit positions 1, 2, 3, ... n from right to

left bit position is a power of 2 gt check bit

else gt information bit e.g. (n

7) check bits in positions 1, 2, 4 information

bits in positions 3, 5, 6, 7

Create group for each check bit Express check

bit position in binary Group all information

bits whose binary position has a one in same

place e.g. (n 7) check information 1 (001) 3

(011), 5 (101), 7 (111) 2 (010) 3 (011), 6

(110), 7 (111) 4 (100) 5 (101), 6 (110), 7 (111)

Code information packets to maintain even parity

in groups e.g. (n 7) packet is 1011 gt

positions 7, 6, 5, 3 7 6 5 4 3 2 1 1 0 1 x 1 x x

Consult group memberships to compute check

bits check information 1 3, 5, 7 gt bit 1 is 1

2 3, 6, 7 gt bit 2 is 0 4 5, 6, 7 gt bit 4

is 0 Code word is 1010101

Note Single bit error corrupts one or more

parity groups gt minimum distance gt 1 Two-bit

error in locations x, y corrupts at least one

parity group gt minimum distance gt 2 Three-bit

error (i.e. 1, 4, 5) goes undetected gt minimum

distance 3 3 2(1) 0 1 2(0) 2 1 gt

can correct 1-bit errors or detect errors of

size 1 or 2.

Group 8 Group 4 Group 2 Group 1

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

- Pattern generalizes to longer bit strings
- Single bit error corrupts one or more parity

groups gt minimum distance gt 1

- Consider two-bit error in positions x and y. To

avoid corrupting all groups -- avoid group 1

bit 1 (lsb) same for both x and y -- avoid group

2 bit 2 same for both -- avoid group 4 bit 3

same for both, etc. -- forces x y - So true two-bit error corrupts at least one

parity group gt min distance gt 2 - Three-bit error (two msb and lsb) goes

undetected gt minimum distance 3 - Conclude process always produces a Hamming code

with min distance 3

Traditional to permute check bits to far

right Used in memory protection schemes

Add traditional parity bit (for entire word) to

obtain code with minimum distance 4

For minimum distance 4

Number of check bits grows slowly with

information bits

Two-dimensional codes (product codes)

min distance is product of row and column

distances for simple parity on each (below) min

distance is 4

Scheme for RAID storage CRC is extension of

Hamming codes each disk is separate row column

is disk block (say 512 characters) rows have CRC

on row disk columns have even parity

Checksum codes mod-256 sum of info bytes becomes

checksum byte mod-255 sum used in IP

packets m-hot codes (m out of n codes) each

valid codes has m ones in a frame of n bits min

distance is 2 detect all unidirectional

errors bit flips are all 0 to 1 or 1 to 0

Serial data transmission (simple) transmit clock

and sync with data (3 lines) (complex) recover

clock and/or sync from data line

Serial line codes

NRZ clock recovery except during long sequences

of zeros or ones NRZ1 nonreturn to zero, invert

on one zero gt no change, one gt change

polarity RZ clock recovery except during long

sequences of zero DC balance Bipolar return to

zero (aka alternate mark inversion send one as

1 or -1) Manchester zero gt 0 to 1 transition,

one gt 1 to 0 transition at interval center

About PowerShow.com

PowerShow.com is a leading presentation/slideshow sharing website. Whether your application is business, how-to, education, medicine, school, church, sales, marketing, online training or just for fun, PowerShow.com is a great resource. And, best of all, most of its cool features are free and easy to use.

You can use PowerShow.com to find and download example online PowerPoint ppt presentations on just about any topic you can imagine so you can learn how to improve your own slides and presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

You can use PowerShow.com to find and download example online PowerPoint ppt presentations on just about any topic you can imagine so you can learn how to improve your own slides and presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

Recommended

«

/ »

Page of

«

/ »

Promoted Presentations

Related Presentations

Page of

Page of

CrystalGraphics Sales Tel: (800) 394-0700 x 1 or Send an email

Home About Us Terms and Conditions Privacy Policy Contact Us Send Us Feedback

Copyright 2014 CrystalGraphics, Inc. — All rights Reserved. PowerShow.com is a trademark of CrystalGraphics, Inc.

Copyright 2014 CrystalGraphics, Inc. — All rights Reserved. PowerShow.com is a trademark of CrystalGraphics, Inc.

The PowerPoint PPT presentation: "Arithmetic operations in binary" is the property of its rightful owner.

Do you have PowerPoint slides to share? If so, share your PPT presentation slides online with PowerShow.com. It's FREE!

Committed to assisting Umbc University and other schools with their online training by sharing educational presentations for free