**Arithmetic -- addition** • Binary similar to decimal arithmetic No carries Carries 1+1 is 2 (or 102), which results in a carry

**Arithmetic -- subtraction** No borrows Borrows 0 - 1 results in a borrow Borrow makes it (10)2 =(2)10

**Arithmetic -- multiplication** Successive additions of multiplicand or zero, multiplied by 2 (102). Note that multiplication by 102 just shifts bits left.

**Complements** • Simply Subtraction (Subtraction by addition) • R’s Complement • In Binary 2’s complement • In Decimal 10’s complement • (R-1) Complement • In Binary 1’s complement • In Decimal 9’s Complement

**R, complement/2,s/10,s complement** For a given positive no N in base r with integer part of n digits. The r,s complement of N is defined as rn-N for N not =0 and 0 forN=0 Example 10,s Complement of(52520) is 105-52520=47480 (0.3267)=(1-0.3267=0.6733 No integer so 100=1 2,s Complement of(101100)2= 26-(101100)2=010100 0.01101 = (1-0.0110)=0.1010

**(r-1),s, complement/1,s/9,s complement** For a given positive no N in base r with integer part of n digits and a fraction part of m digits. The( r-1),s complement of N is defined as (rn – rm- N) Example 9,s Complement of(52520) is( 105-100- 52520)=47479 (0.3267)=(1- 10-4- 0.3267=0.6732 No integer so 100=1 1,s Complement of(101100)2= (26- 1)-(101100)2=010011 0.0110 = (1-2-4)- (0.0110)=( 0.1111-0.0110) = 0.1001

**DUALITY METHOD** • 1,S COMPLEMENT OF (10111) • REPLACE 1 BY 0 & O BY 1 • (10111)= (01000) • 2,S COMPLEMENT • REPLACE BY 1,S COMPLEMENT +1 • (10111)=01000+1=01001

**Subtraction with r-Complement** • M-N • Add the minuend, M to r’s complement of Subtrahend, N • M+ (rn -N)= M-N+ rn • If M GTE N then sum will produce end carry . Ignore it • If M LT N (No Carry) then take r’s complement of answer (Negative)

**Subtraction with r’s Complement** • Using 10’s complement subtract 72532-03250 • Using 10’s complement subtract 03250 -72532 • Using 2’s complement subtract 1010100 -1000011 • Using 2’s complement subtract 1000011- 1010100

**Subtraction with r-1 Complement** • Similar to r’s complement • But since r-1 complement is 1 less than r complement, Carry is added back to get the result • If no carry, result is negative1’s complement to get the answer • 1010100-1000011 • 1000000-1010100

**Signed Binary Numbers** • Need notation for negative values • Everything must be represented by binary digits • Signed magnitude convention • Left most bit can be used • 0 Positive • 1 Negative • 01001 is +9 and 11001 is -9 (Not 25. Convention known in advance) • Signed Complement (Store negative as comps) • Signed 1’s complement (8 bits)11110110 • Signed 2’s complement (8 bits)11110111 • Signed Magnitude (8 bits) 10001001

**BCD** • Binary Coded Decimal • Decimal digits stored in binary • Four bits/digit (Use 10 instead of 16) • Like hex, except stops at 9 • Example 931 is coded as 1001 0011 0001 • People understand decimal system better • Written differently but decimal value is same • Decimal 15 in BCD 0001 0101 in Binary it is 1111 Since most computers store data in eight-bit , bytes • Ignore 4 extra bits • one can store two digits per byte, called "packed" BCD

**BCD Addition** • Since each digit is max 9 Sum will always be less than 19= 9+9+1(carry) • Two BCD digits are added as binary numbers • When binary sum is more than binary (1001)2, result is invalid (unlike Hex last 6 were ignored) • Addition of 6=(0110)2 make a correct BCD and produces a carry • Binary Sum carry and Decimal Carry differ by 16-10=6 • 4+5, 4+8, 8+9 • 184+576

**Binary Codes for Numbers** • Binary codes for decimal digits require 4 bits per digit • Many codes use 4 bits in 10 distinct possible combinations (out of 16) • 2421 and Excess 3 are self complementing (1 and 0 9’s Comp of decimal) • Contents can be interpreted differently. • What decimal value does 1100001111001001 represent in different binary codes? Dec Binary BCD Excess-3 2421 84-2-1 Octal Hexadecimal 0 0 0000 0011 0000 0000 000 0000 1 1 0001 0100 0001 0111 001 0001 2 10 0010 0101 0010 0110 010 0010 3 11 0011 0110 0011 0101 011 0011 4 100 0100 0111 0100 0100 100 0100 5 101 0101 1000 1011 1011 101 0101 • 110 0110 1001 1100 1010 110 0110 • 111 0111 1010 1101 1001 111 0111 • 1000 1000 1011 1110 1000 - 1000 • 1001 1001 1100 1111 1111 - 1001 • 1010 - - - - - 1010 A • 1011 - - - - - 1011 B …

**Other Codes Exist** Gray Code/Reflected Code • Only one bit changes at a time • 0000,0001,0011,0010,0110,0111,0101,0100,1100,1101,1111,1110,1010,1011,1001,1000 • Why is this useful?The no changes by one digit. It is used to represent the digital data converted from Analog data.Where as in Binary all numbers changes. • 01111000 (All Four bits need to be changed)

**Character Codes** • ASCII • Many applications require handling of not only numbers but letters and special characters • Stands for American Standard Code for Information Interchange • 7 Bits to store 128 characters • In ASCII, every letter, number, and punctuation symbol has a corresponding number, or ASCII code • This encoding system not only lets a computer store a document as a series of numbers, but also lets it share such documents with other computers that use the ASCII system.

**11000011 11001001 If ASCII with even parity then “C” and** “I”. If odd Parity then error

**Even Parity** • Sometimes high-order bit of ASCII coded to enable detection of errors • Even parity – set bit to make number of 1’s even • Examples A (01000001) with even parity is 01000001 C (01000011) with even parity is 11000011

**Odd Parity** • Similar except make the number of 1’s odd • Examples A (01000001) with odd parity is 11000001 C (01000011) with odd parity is 01000011

**Error Detection** • Note that parity detects only simple errors • One, three, etc. bits • More complex methods exist • Some that enable recovery of original info • Cost is more redundant bits

**Binary Storage and Registers** • Physical existence in information storage medium for storing individual bits • A binary cell is a device that posses stable stages and is capable of storing one bit of information • A Register is a group of binary cells. • Can store any discrete quantity of information that contains n bits. • 1100001111001001 is a 16 bit register • 2n possible states to store 0 to 2n -1 number • Contents can be interpreted differently

**Register Transfers** • Basic Operation in digital systems • When Key is pressed 8 bit alphanumeric character code in to Input Register • Contents of Input Register are transferred to eight least significant cells of a Processor Register • After every transfer input register is cleared for new keystroke • Each eight bit character transfer to the processor register is preceded by shift of previous character to next eight cells on its left • When Processor Register is full, its contents are transferred to the Memory Register

**Manipulation of binary variable** • Adding two 10 bit binary numbers • Memory Unit • Processor Unit

**Binary Logic** • Variables have two possible distinct values, 0 and 1 • Three Logic operations • AND “ . ” If and only if all variable are 1 • OR “ + ” If any one or more of the variable is 1 • NOT “ ’ ” Complement (Reverse) • Unlike binary arithmetic 1 +1 is not 10 but 1 • Truth Table of Logical Operations

**Representation of Binary variables** • Different Digital Systems represent 0 and 1 differently • Logical 0 as 0 volts. Logical 1 as 4 volts • Range

**Logic Gates** Logic Gates are electronic circuits that operate on one or more input signals to produce an output signal

**Gates with Multiple Inputs**

**LOGIC CCTS CHARACTERISTICS** • Fan out. It is the max no of iutputs that can be connected to the output of a gate. • Power Dissipation.It is the power dissipated in the gate(mw). • Propagation Delay.It is the transition delay time from i/p to o/p, expressed in nano second. • Noise Margin.It is the noise which does not cause change in the o/p