digital logic rcs

38
Digital Logic

Upload: ramzi-alqrainy

Post on 15-Nov-2014

2.396 views

Category:

Education


7 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Digital Logic Rcs

Digital Logic

Digital Systems Digital systems operate on discrete elements

of information Numbers (eg pocket calculator)

Letters (eg word processor) Pictures (eg digital cameras)

For a digital systems to operate on a continuous data it needs to quantize (digitize) that data first

Covert data into digital representation Digital systems

Cell phone MP3 music player hellip etc

digital camera Ramzi Sh Alqrainy

NumbersEach number is represented by a string of digits in which

the position of each digit has an associated weight

Example

In general any decimal number D of the form

Has the value

Ramzi Sh Alqrainy

What is the range of values of an n-bit number in radix r Minimum value 0

Maximum value rn-1 Number of different values rn

What is the range of values of an 4-bit binary number Minimum value 0

Maximum value 24-1=15 Number of different values 24 = 16

-------------------------------------------------------------------------------

What is the range of values of an 2-bit decimal number Minimum value 0

Maximum value 102-1=99 Number of different values 102 = 100

Ramzi Sh Alqrainy

Number Base Conversions Binary to octal conversion

Starting at the binary point and working left separate the bits into groups of three and replace each group with the corresponding octal digit

(1010011100)2=001 010 011 100(=1234)8

Binary to hexadecimalseparate the bits into groups of four and replace each group with the corresponding hexadecimal digit

(1010011100)2 = 0010 0100 1100( = 29C)16

Ramzi Sh Alqrainy

Conversion of fractionsStarting at the binary point group the binary digits that lie to the right into groups of three or four

(010111)2 = 0101 110( = 056)8

(010111)2 = 01011 1000( = 0 B6)16

Conversion to binary numbersReplace each octal or hexadecimal digit with the corresponding 3 or 4 bit binary string

(4 5 5 6)8

(9 6 E)16

(2414)10=(100101101110)2

Ramzi Sh Alqrainy

COMPLEMENT Complement are used in digital computer for simplifying the

subtraction operation

There are two types of complement for each base-r system

1 -Diminished Radix Complement (r-1)rsquos

2 -Radix Complement rrsquos

the two types are referred to as the 2rsquos complement and 1rsquos complement for binary number

10rsquos complement and 9rsquos complement for decimal number

Ramzi Sh Alqrainy

Observation Subtraction from (rnndash1) will never require a borrow

Diminished radix complement can be computed digit-by-digit

For binary 1 ndash 0 = 1 and 1 ndash 1 = 0

Ex The 1rsquos complement of 1011000 is 0100111

The 1rsquos complement of 0101101 is 1010010

The 1rsquos complement of a binary number is formed by changing 1rsquos to 0rsquos and 0rsquos to 1rsquos

Ramzi Sh Alqrainy

Signed Numbers with Complements 3-bit number

DecimalSigned 2s

complementSigned 1s

complementSigned

Magnitude

+3011011011

+2010010010

+1001001001

0000000000

-0----111100

-1111110101

-2110101110

-3101100111

-4100--------

Ramzi Sh Alqrainy

Signed NumbersHow are signed numbers handled in base 10

~ Plus or minus sign placed in front of numberCan we do that for binary numbers

~ Sign needs to be represented in digital system

~ Only choice are lsquo0rsquo and lsquo1rsquolsquo 0 rsquoindicatesrsquo+lsquo lsquo 1 rsquoindicatesrsquondashlsquo

Examples on five-bit numbers011011110100000 10000

+13 ndash13 +0 ndash0Ramzi Sh Alqrainy

BCD AdditionAddition is done BCD digit by BCD digit

~ 4 bits at the time

Can we use normal binary addition

Problem digits adding up to more than 9

~ Binary addition will result in invalid BCD codes

~ 1010 hellip 1111 are not valid

Solution check if resulting value is greater than 9

~if so add 6

~6 will offset the invalid BCD codes and generate the carry

Ramzi Sh Alqrainy

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 2: Digital Logic Rcs

Digital Systems Digital systems operate on discrete elements

of information Numbers (eg pocket calculator)

Letters (eg word processor) Pictures (eg digital cameras)

For a digital systems to operate on a continuous data it needs to quantize (digitize) that data first

Covert data into digital representation Digital systems

Cell phone MP3 music player hellip etc

digital camera Ramzi Sh Alqrainy

NumbersEach number is represented by a string of digits in which

the position of each digit has an associated weight

Example

In general any decimal number D of the form

Has the value

Ramzi Sh Alqrainy

What is the range of values of an n-bit number in radix r Minimum value 0

Maximum value rn-1 Number of different values rn

What is the range of values of an 4-bit binary number Minimum value 0

Maximum value 24-1=15 Number of different values 24 = 16

-------------------------------------------------------------------------------

What is the range of values of an 2-bit decimal number Minimum value 0

Maximum value 102-1=99 Number of different values 102 = 100

Ramzi Sh Alqrainy

Number Base Conversions Binary to octal conversion

Starting at the binary point and working left separate the bits into groups of three and replace each group with the corresponding octal digit

(1010011100)2=001 010 011 100(=1234)8

Binary to hexadecimalseparate the bits into groups of four and replace each group with the corresponding hexadecimal digit

(1010011100)2 = 0010 0100 1100( = 29C)16

Ramzi Sh Alqrainy

Conversion of fractionsStarting at the binary point group the binary digits that lie to the right into groups of three or four

(010111)2 = 0101 110( = 056)8

(010111)2 = 01011 1000( = 0 B6)16

Conversion to binary numbersReplace each octal or hexadecimal digit with the corresponding 3 or 4 bit binary string

(4 5 5 6)8

(9 6 E)16

(2414)10=(100101101110)2

Ramzi Sh Alqrainy

COMPLEMENT Complement are used in digital computer for simplifying the

subtraction operation

There are two types of complement for each base-r system

1 -Diminished Radix Complement (r-1)rsquos

2 -Radix Complement rrsquos

the two types are referred to as the 2rsquos complement and 1rsquos complement for binary number

10rsquos complement and 9rsquos complement for decimal number

Ramzi Sh Alqrainy

Observation Subtraction from (rnndash1) will never require a borrow

Diminished radix complement can be computed digit-by-digit

For binary 1 ndash 0 = 1 and 1 ndash 1 = 0

Ex The 1rsquos complement of 1011000 is 0100111

The 1rsquos complement of 0101101 is 1010010

The 1rsquos complement of a binary number is formed by changing 1rsquos to 0rsquos and 0rsquos to 1rsquos

Ramzi Sh Alqrainy

Signed Numbers with Complements 3-bit number

DecimalSigned 2s

complementSigned 1s

complementSigned

Magnitude

+3011011011

+2010010010

+1001001001

0000000000

-0----111100

-1111110101

-2110101110

-3101100111

-4100--------

Ramzi Sh Alqrainy

Signed NumbersHow are signed numbers handled in base 10

~ Plus or minus sign placed in front of numberCan we do that for binary numbers

~ Sign needs to be represented in digital system

~ Only choice are lsquo0rsquo and lsquo1rsquolsquo 0 rsquoindicatesrsquo+lsquo lsquo 1 rsquoindicatesrsquondashlsquo

Examples on five-bit numbers011011110100000 10000

+13 ndash13 +0 ndash0Ramzi Sh Alqrainy

BCD AdditionAddition is done BCD digit by BCD digit

~ 4 bits at the time

Can we use normal binary addition

Problem digits adding up to more than 9

~ Binary addition will result in invalid BCD codes

~ 1010 hellip 1111 are not valid

Solution check if resulting value is greater than 9

~if so add 6

~6 will offset the invalid BCD codes and generate the carry

Ramzi Sh Alqrainy

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 3: Digital Logic Rcs

NumbersEach number is represented by a string of digits in which

the position of each digit has an associated weight

Example

In general any decimal number D of the form

Has the value

Ramzi Sh Alqrainy

What is the range of values of an n-bit number in radix r Minimum value 0

Maximum value rn-1 Number of different values rn

What is the range of values of an 4-bit binary number Minimum value 0

Maximum value 24-1=15 Number of different values 24 = 16

-------------------------------------------------------------------------------

What is the range of values of an 2-bit decimal number Minimum value 0

Maximum value 102-1=99 Number of different values 102 = 100

Ramzi Sh Alqrainy

Number Base Conversions Binary to octal conversion

Starting at the binary point and working left separate the bits into groups of three and replace each group with the corresponding octal digit

(1010011100)2=001 010 011 100(=1234)8

Binary to hexadecimalseparate the bits into groups of four and replace each group with the corresponding hexadecimal digit

(1010011100)2 = 0010 0100 1100( = 29C)16

Ramzi Sh Alqrainy

Conversion of fractionsStarting at the binary point group the binary digits that lie to the right into groups of three or four

(010111)2 = 0101 110( = 056)8

(010111)2 = 01011 1000( = 0 B6)16

Conversion to binary numbersReplace each octal or hexadecimal digit with the corresponding 3 or 4 bit binary string

(4 5 5 6)8

(9 6 E)16

(2414)10=(100101101110)2

Ramzi Sh Alqrainy

COMPLEMENT Complement are used in digital computer for simplifying the

subtraction operation

There are two types of complement for each base-r system

1 -Diminished Radix Complement (r-1)rsquos

2 -Radix Complement rrsquos

the two types are referred to as the 2rsquos complement and 1rsquos complement for binary number

10rsquos complement and 9rsquos complement for decimal number

Ramzi Sh Alqrainy

Observation Subtraction from (rnndash1) will never require a borrow

Diminished radix complement can be computed digit-by-digit

For binary 1 ndash 0 = 1 and 1 ndash 1 = 0

Ex The 1rsquos complement of 1011000 is 0100111

The 1rsquos complement of 0101101 is 1010010

The 1rsquos complement of a binary number is formed by changing 1rsquos to 0rsquos and 0rsquos to 1rsquos

Ramzi Sh Alqrainy

Signed Numbers with Complements 3-bit number

DecimalSigned 2s

complementSigned 1s

complementSigned

Magnitude

+3011011011

+2010010010

+1001001001

0000000000

-0----111100

-1111110101

-2110101110

-3101100111

-4100--------

Ramzi Sh Alqrainy

Signed NumbersHow are signed numbers handled in base 10

~ Plus or minus sign placed in front of numberCan we do that for binary numbers

~ Sign needs to be represented in digital system

~ Only choice are lsquo0rsquo and lsquo1rsquolsquo 0 rsquoindicatesrsquo+lsquo lsquo 1 rsquoindicatesrsquondashlsquo

Examples on five-bit numbers011011110100000 10000

+13 ndash13 +0 ndash0Ramzi Sh Alqrainy

BCD AdditionAddition is done BCD digit by BCD digit

~ 4 bits at the time

Can we use normal binary addition

Problem digits adding up to more than 9

~ Binary addition will result in invalid BCD codes

~ 1010 hellip 1111 are not valid

Solution check if resulting value is greater than 9

~if so add 6

~6 will offset the invalid BCD codes and generate the carry

Ramzi Sh Alqrainy

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 4: Digital Logic Rcs

What is the range of values of an n-bit number in radix r Minimum value 0

Maximum value rn-1 Number of different values rn

What is the range of values of an 4-bit binary number Minimum value 0

Maximum value 24-1=15 Number of different values 24 = 16

-------------------------------------------------------------------------------

What is the range of values of an 2-bit decimal number Minimum value 0

Maximum value 102-1=99 Number of different values 102 = 100

Ramzi Sh Alqrainy

Number Base Conversions Binary to octal conversion

Starting at the binary point and working left separate the bits into groups of three and replace each group with the corresponding octal digit

(1010011100)2=001 010 011 100(=1234)8

Binary to hexadecimalseparate the bits into groups of four and replace each group with the corresponding hexadecimal digit

(1010011100)2 = 0010 0100 1100( = 29C)16

Ramzi Sh Alqrainy

Conversion of fractionsStarting at the binary point group the binary digits that lie to the right into groups of three or four

(010111)2 = 0101 110( = 056)8

(010111)2 = 01011 1000( = 0 B6)16

Conversion to binary numbersReplace each octal or hexadecimal digit with the corresponding 3 or 4 bit binary string

(4 5 5 6)8

(9 6 E)16

(2414)10=(100101101110)2

Ramzi Sh Alqrainy

COMPLEMENT Complement are used in digital computer for simplifying the

subtraction operation

There are two types of complement for each base-r system

1 -Diminished Radix Complement (r-1)rsquos

2 -Radix Complement rrsquos

the two types are referred to as the 2rsquos complement and 1rsquos complement for binary number

10rsquos complement and 9rsquos complement for decimal number

Ramzi Sh Alqrainy

Observation Subtraction from (rnndash1) will never require a borrow

Diminished radix complement can be computed digit-by-digit

For binary 1 ndash 0 = 1 and 1 ndash 1 = 0

Ex The 1rsquos complement of 1011000 is 0100111

The 1rsquos complement of 0101101 is 1010010

The 1rsquos complement of a binary number is formed by changing 1rsquos to 0rsquos and 0rsquos to 1rsquos

Ramzi Sh Alqrainy

Signed Numbers with Complements 3-bit number

DecimalSigned 2s

complementSigned 1s

complementSigned

Magnitude

+3011011011

+2010010010

+1001001001

0000000000

-0----111100

-1111110101

-2110101110

-3101100111

-4100--------

Ramzi Sh Alqrainy

Signed NumbersHow are signed numbers handled in base 10

~ Plus or minus sign placed in front of numberCan we do that for binary numbers

~ Sign needs to be represented in digital system

~ Only choice are lsquo0rsquo and lsquo1rsquolsquo 0 rsquoindicatesrsquo+lsquo lsquo 1 rsquoindicatesrsquondashlsquo

Examples on five-bit numbers011011110100000 10000

+13 ndash13 +0 ndash0Ramzi Sh Alqrainy

BCD AdditionAddition is done BCD digit by BCD digit

~ 4 bits at the time

Can we use normal binary addition

Problem digits adding up to more than 9

~ Binary addition will result in invalid BCD codes

~ 1010 hellip 1111 are not valid

Solution check if resulting value is greater than 9

~if so add 6

~6 will offset the invalid BCD codes and generate the carry

Ramzi Sh Alqrainy

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 5: Digital Logic Rcs

Number Base Conversions Binary to octal conversion

Starting at the binary point and working left separate the bits into groups of three and replace each group with the corresponding octal digit

(1010011100)2=001 010 011 100(=1234)8

Binary to hexadecimalseparate the bits into groups of four and replace each group with the corresponding hexadecimal digit

(1010011100)2 = 0010 0100 1100( = 29C)16

Ramzi Sh Alqrainy

Conversion of fractionsStarting at the binary point group the binary digits that lie to the right into groups of three or four

(010111)2 = 0101 110( = 056)8

(010111)2 = 01011 1000( = 0 B6)16

Conversion to binary numbersReplace each octal or hexadecimal digit with the corresponding 3 or 4 bit binary string

(4 5 5 6)8

(9 6 E)16

(2414)10=(100101101110)2

Ramzi Sh Alqrainy

COMPLEMENT Complement are used in digital computer for simplifying the

subtraction operation

There are two types of complement for each base-r system

1 -Diminished Radix Complement (r-1)rsquos

2 -Radix Complement rrsquos

the two types are referred to as the 2rsquos complement and 1rsquos complement for binary number

10rsquos complement and 9rsquos complement for decimal number

Ramzi Sh Alqrainy

Observation Subtraction from (rnndash1) will never require a borrow

Diminished radix complement can be computed digit-by-digit

For binary 1 ndash 0 = 1 and 1 ndash 1 = 0

Ex The 1rsquos complement of 1011000 is 0100111

The 1rsquos complement of 0101101 is 1010010

The 1rsquos complement of a binary number is formed by changing 1rsquos to 0rsquos and 0rsquos to 1rsquos

Ramzi Sh Alqrainy

Signed Numbers with Complements 3-bit number

DecimalSigned 2s

complementSigned 1s

complementSigned

Magnitude

+3011011011

+2010010010

+1001001001

0000000000

-0----111100

-1111110101

-2110101110

-3101100111

-4100--------

Ramzi Sh Alqrainy

Signed NumbersHow are signed numbers handled in base 10

~ Plus or minus sign placed in front of numberCan we do that for binary numbers

~ Sign needs to be represented in digital system

~ Only choice are lsquo0rsquo and lsquo1rsquolsquo 0 rsquoindicatesrsquo+lsquo lsquo 1 rsquoindicatesrsquondashlsquo

Examples on five-bit numbers011011110100000 10000

+13 ndash13 +0 ndash0Ramzi Sh Alqrainy

BCD AdditionAddition is done BCD digit by BCD digit

~ 4 bits at the time

Can we use normal binary addition

Problem digits adding up to more than 9

~ Binary addition will result in invalid BCD codes

~ 1010 hellip 1111 are not valid

Solution check if resulting value is greater than 9

~if so add 6

~6 will offset the invalid BCD codes and generate the carry

Ramzi Sh Alqrainy

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 6: Digital Logic Rcs

Conversion of fractionsStarting at the binary point group the binary digits that lie to the right into groups of three or four

(010111)2 = 0101 110( = 056)8

(010111)2 = 01011 1000( = 0 B6)16

Conversion to binary numbersReplace each octal or hexadecimal digit with the corresponding 3 or 4 bit binary string

(4 5 5 6)8

(9 6 E)16

(2414)10=(100101101110)2

Ramzi Sh Alqrainy

COMPLEMENT Complement are used in digital computer for simplifying the

subtraction operation

There are two types of complement for each base-r system

1 -Diminished Radix Complement (r-1)rsquos

2 -Radix Complement rrsquos

the two types are referred to as the 2rsquos complement and 1rsquos complement for binary number

10rsquos complement and 9rsquos complement for decimal number

Ramzi Sh Alqrainy

Observation Subtraction from (rnndash1) will never require a borrow

Diminished radix complement can be computed digit-by-digit

For binary 1 ndash 0 = 1 and 1 ndash 1 = 0

Ex The 1rsquos complement of 1011000 is 0100111

The 1rsquos complement of 0101101 is 1010010

The 1rsquos complement of a binary number is formed by changing 1rsquos to 0rsquos and 0rsquos to 1rsquos

Ramzi Sh Alqrainy

Signed Numbers with Complements 3-bit number

DecimalSigned 2s

complementSigned 1s

complementSigned

Magnitude

+3011011011

+2010010010

+1001001001

0000000000

-0----111100

-1111110101

-2110101110

-3101100111

-4100--------

Ramzi Sh Alqrainy

Signed NumbersHow are signed numbers handled in base 10

~ Plus or minus sign placed in front of numberCan we do that for binary numbers

~ Sign needs to be represented in digital system

~ Only choice are lsquo0rsquo and lsquo1rsquolsquo 0 rsquoindicatesrsquo+lsquo lsquo 1 rsquoindicatesrsquondashlsquo

Examples on five-bit numbers011011110100000 10000

+13 ndash13 +0 ndash0Ramzi Sh Alqrainy

BCD AdditionAddition is done BCD digit by BCD digit

~ 4 bits at the time

Can we use normal binary addition

Problem digits adding up to more than 9

~ Binary addition will result in invalid BCD codes

~ 1010 hellip 1111 are not valid

Solution check if resulting value is greater than 9

~if so add 6

~6 will offset the invalid BCD codes and generate the carry

Ramzi Sh Alqrainy

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 7: Digital Logic Rcs

COMPLEMENT Complement are used in digital computer for simplifying the

subtraction operation

There are two types of complement for each base-r system

1 -Diminished Radix Complement (r-1)rsquos

2 -Radix Complement rrsquos

the two types are referred to as the 2rsquos complement and 1rsquos complement for binary number

10rsquos complement and 9rsquos complement for decimal number

Ramzi Sh Alqrainy

Observation Subtraction from (rnndash1) will never require a borrow

Diminished radix complement can be computed digit-by-digit

For binary 1 ndash 0 = 1 and 1 ndash 1 = 0

Ex The 1rsquos complement of 1011000 is 0100111

The 1rsquos complement of 0101101 is 1010010

The 1rsquos complement of a binary number is formed by changing 1rsquos to 0rsquos and 0rsquos to 1rsquos

Ramzi Sh Alqrainy

Signed Numbers with Complements 3-bit number

DecimalSigned 2s

complementSigned 1s

complementSigned

Magnitude

+3011011011

+2010010010

+1001001001

0000000000

-0----111100

-1111110101

-2110101110

-3101100111

-4100--------

Ramzi Sh Alqrainy

Signed NumbersHow are signed numbers handled in base 10

~ Plus or minus sign placed in front of numberCan we do that for binary numbers

~ Sign needs to be represented in digital system

~ Only choice are lsquo0rsquo and lsquo1rsquolsquo 0 rsquoindicatesrsquo+lsquo lsquo 1 rsquoindicatesrsquondashlsquo

Examples on five-bit numbers011011110100000 10000

+13 ndash13 +0 ndash0Ramzi Sh Alqrainy

BCD AdditionAddition is done BCD digit by BCD digit

~ 4 bits at the time

Can we use normal binary addition

Problem digits adding up to more than 9

~ Binary addition will result in invalid BCD codes

~ 1010 hellip 1111 are not valid

Solution check if resulting value is greater than 9

~if so add 6

~6 will offset the invalid BCD codes and generate the carry

Ramzi Sh Alqrainy

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 8: Digital Logic Rcs

Observation Subtraction from (rnndash1) will never require a borrow

Diminished radix complement can be computed digit-by-digit

For binary 1 ndash 0 = 1 and 1 ndash 1 = 0

Ex The 1rsquos complement of 1011000 is 0100111

The 1rsquos complement of 0101101 is 1010010

The 1rsquos complement of a binary number is formed by changing 1rsquos to 0rsquos and 0rsquos to 1rsquos

Ramzi Sh Alqrainy

Signed Numbers with Complements 3-bit number

DecimalSigned 2s

complementSigned 1s

complementSigned

Magnitude

+3011011011

+2010010010

+1001001001

0000000000

-0----111100

-1111110101

-2110101110

-3101100111

-4100--------

Ramzi Sh Alqrainy

Signed NumbersHow are signed numbers handled in base 10

~ Plus or minus sign placed in front of numberCan we do that for binary numbers

~ Sign needs to be represented in digital system

~ Only choice are lsquo0rsquo and lsquo1rsquolsquo 0 rsquoindicatesrsquo+lsquo lsquo 1 rsquoindicatesrsquondashlsquo

Examples on five-bit numbers011011110100000 10000

+13 ndash13 +0 ndash0Ramzi Sh Alqrainy

BCD AdditionAddition is done BCD digit by BCD digit

~ 4 bits at the time

Can we use normal binary addition

Problem digits adding up to more than 9

~ Binary addition will result in invalid BCD codes

~ 1010 hellip 1111 are not valid

Solution check if resulting value is greater than 9

~if so add 6

~6 will offset the invalid BCD codes and generate the carry

Ramzi Sh Alqrainy

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 9: Digital Logic Rcs

Signed Numbers with Complements 3-bit number

DecimalSigned 2s

complementSigned 1s

complementSigned

Magnitude

+3011011011

+2010010010

+1001001001

0000000000

-0----111100

-1111110101

-2110101110

-3101100111

-4100--------

Ramzi Sh Alqrainy

Signed NumbersHow are signed numbers handled in base 10

~ Plus or minus sign placed in front of numberCan we do that for binary numbers

~ Sign needs to be represented in digital system

~ Only choice are lsquo0rsquo and lsquo1rsquolsquo 0 rsquoindicatesrsquo+lsquo lsquo 1 rsquoindicatesrsquondashlsquo

Examples on five-bit numbers011011110100000 10000

+13 ndash13 +0 ndash0Ramzi Sh Alqrainy

BCD AdditionAddition is done BCD digit by BCD digit

~ 4 bits at the time

Can we use normal binary addition

Problem digits adding up to more than 9

~ Binary addition will result in invalid BCD codes

~ 1010 hellip 1111 are not valid

Solution check if resulting value is greater than 9

~if so add 6

~6 will offset the invalid BCD codes and generate the carry

Ramzi Sh Alqrainy

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 10: Digital Logic Rcs

Signed NumbersHow are signed numbers handled in base 10

~ Plus or minus sign placed in front of numberCan we do that for binary numbers

~ Sign needs to be represented in digital system

~ Only choice are lsquo0rsquo and lsquo1rsquolsquo 0 rsquoindicatesrsquo+lsquo lsquo 1 rsquoindicatesrsquondashlsquo

Examples on five-bit numbers011011110100000 10000

+13 ndash13 +0 ndash0Ramzi Sh Alqrainy

BCD AdditionAddition is done BCD digit by BCD digit

~ 4 bits at the time

Can we use normal binary addition

Problem digits adding up to more than 9

~ Binary addition will result in invalid BCD codes

~ 1010 hellip 1111 are not valid

Solution check if resulting value is greater than 9

~if so add 6

~6 will offset the invalid BCD codes and generate the carry

Ramzi Sh Alqrainy

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 11: Digital Logic Rcs

BCD AdditionAddition is done BCD digit by BCD digit

~ 4 bits at the time

Can we use normal binary addition

Problem digits adding up to more than 9

~ Binary addition will result in invalid BCD codes

~ 1010 hellip 1111 are not valid

Solution check if resulting value is greater than 9

~if so add 6

~6 will offset the invalid BCD codes and generate the carry

Ramzi Sh Alqrainy

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 12: Digital Logic Rcs

BCD AdditionExample 184 + 576BCD carry 1 1

0001 1000 0100 184

+ 0101 0111 0110+ 576

Binary sum 0111 10000 1010

Add 6 0110 0110

BCD sum 0111 0110 0000 760

Ramzi Sh Alqrainy

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 13: Digital Logic Rcs

Decimal ArithmeticEverything needs to be 4-bit aligned

1048697 lsquo+rsquo represented by 0 )=lsquo0000rsquo( 1048697 lsquondashrsquo represented by 9 )=lsquo1001rsquo(

1048707 Signed magnitude representation or complements 1048697 Signed magnitude hardly use

1048697 10rsquos complement most common1048707 Example 375 + (ndash240)1048697 Negative numbers represented by 10rsquos complement

1048697 10rsquos complement of 240 is 104 ndash 240 = 97601048697 Addition of all digits anddiscard of end carry 0 375

+ 9 760 0 130

1048697 Sign of result automatically correct

Ramzi Sh Alqrainy

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 14: Digital Logic Rcs

Other Decimal CodesDecimals can be encoded in many ways in 4 bits1048707 Weighted codes

Each bit position is assigned a weighting factor Value of code is sum of weights where bits are lsquo1rsquo

Is BCD a weighted code raquo Yes Itrsquos a 8421 code

1048707 Other weighted code raquo 2421 code )yields non-unique coding(

raquo 84-2-1 code1048707 Self-complementing codes

9rsquos complement by exchanging 1rsquos with 0rsquos and 0rsquos with 1rsquos

Excess-3 and 2421 codes are self-complementing

Ramzi Sh Alqrainy

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 15: Digital Logic Rcs

Other Decimal Codes

Ramzi Sh Alqrainy

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 16: Digital Logic Rcs

Gray Code Imaging you code a 2-bit number with two light

switches connected to light bulbs ~ Can you count binary without causing ambiguity

Probably not ~ Switching from 01 to 10 cannot be done simultaneously on both bits

Either 01-gt00-gt10 or 01-gt11-gt10

This brief error or ambiguity can cause problems

Gray code changes only one bit between consecutivenumbers

Ramzi Sh Alqrainy

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 17: Digital Logic Rcs

Gray Code

Ramzi Sh Alqrainy

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 18: Digital Logic Rcs

ASCII Table

Ramzi Sh Alqrainy

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 19: Digital Logic Rcs

Error-Detecting CodeCommunication between systems can be ldquonoisyrdquo

1048697 Environmental conditions can cause bit flips Error-detecting code

1048697 If one bit is flipped the code becomes invalid 1048697 Communication system can detect that and retransmit

bullldquoParity bitrdquo is an extra bit included with a message to make the total number of 1rsquos either even or odd

1048697 ldquoEven parityrdquo choose parity bit such that of 1rsquos is even 1048697 ldquoOdd parityrdquo choose parity bit such that of 1rsquos is odd

Example 1048697 Data=1000001 even parity=0 odd parity=1 1048697 Data=1010100 even parity=1 odd parity=0

Only one parity bit is used

Ramzi Sh Alqrainy

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 20: Digital Logic Rcs

Binary Storage and Registers How is information stored on a digital system

1048697 Bits are stored in ldquobinary cells rdquo 1048697 Binary cell can have two stable states lsquo0rsquo and lsquo1rsquo

Binary cells are grouped into registers 1048697 n cells make up n-bit register

Size of registers is typically predefined 1048697 Simple microcontroller 8 bits = 1 byte

1048697 Pentium 32 bits = 4 bytes 1048697 Mac G5 64 bits = 8 bytes

Digital system can usually process entire registers

1048697 ldquoRegister transferrdquo operation specify processingRamzi Sh Alqrainy

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 21: Digital Logic Rcs

Register Example

Ramzi Sh Alqrainy

Register Transfer Operations

Ramzi Sh Alqrainy

Page 22: Digital Logic Rcs

Register Transfer Operations

Ramzi Sh Alqrainy