Number Systems, Operations, and Codes Flashcards Preview

Digital Logic > Number Systems, Operations, and Codes > Flashcards

Flashcards in Number Systems, Operations, and Codes Deck (45)
Loading flashcards...

Largest decimal number with n bits

With n bits, you can count up to a number equal to
(2raise to n) - 1.
Largest decimal number = (2 raise to n) - 1.


Represent fractional bits using binary

Fractional numbers can also be represented in binary by placing bits to the right of the
the binary point, just as fractional decimal digits are placed to the right of the binary point.
The left-most bit(after decimal) is the MSB in a binary fractional number and has a weight of 2^(-1) = 1/2 = 0.5[equivalent decimal weight]
The fractional weights decrease from left to right by a negative power of two for each bit.


Binary weight

All the bits to the left of the
binary point have weights that are positive powers of two, as previously discussed for whole
numbers. All bits to the right of the binary point have weights that are negative powers of
two, or fractional weights.


Binary-to-Decimal Conversion

Add the weights of all 1s in a binary number to get the decimal value.


Decimal whole number to binary:
Sum of weights:

determine the set of binary weights whose sum is equal to the decimal number


Decimal whole number to binary:
Repeated division by 2:

To get the binary number for a given
decimal number, divide the decimal
number by 2 until the quotient is 0.
Remainders form the binary number.
The first remainder to be produced is the LSB and last one is MSB.


Converting Decimal Fractions to Binary:

The sum-of-weights method can be applied to fractional decimal numbers, as shown:
0.625 = 0.5 + 0.125 = 2^-1 + 2^-3 = 0.101
There is a 1 in the 2^-1
position, a 0 in the 2^-2
position, and a 1 in the 2^-3


Converting Decimal Fractions to Binary:
Repeated Multiplication by 2

to convert the decimal fraction 0.3125 to binary, begin by multiplying
0.3125 by 2 and then multiplying each resulting fractional part of the product by 2 until
the fractional product is 0 or until the desired number of decimal places is reached or stop when the fractional part is all zeros.
The carry digits, or carries, generated by the multiplications produce the binary number.
The first carry produced is the MSB, and the last carry is the LSB.


4 Basic rules of binary addition:

0 + 0 = 0 Sum of 0 with a carry of 0
0 + 1 = 1 Sum of 1 with a carry of 0
1 + 0 = 1 Sum of 1 with a carry of 0
1 + 1 = 10 Sum of 0 with a carry of 1


Binary addition, carry situation of adding 3 bits:

Carry bits
1 + 0 + 0 = 01 Sum of 1 with a carry of 0
1 + 1 + 0 = 10 Sum of 0 with a carry of 1
1 + 0 + 1 = 10 Sum of 0 with a carry of 1
1 + 1 + 1 = 11 Sum of 1 with a carry of 1


Binary Subtraction basic rules:

0 - 0 = 0
1 - 1 = 0
1 - 0 = 1
10 - 1 = 1 [0 - 1 with a borrow of 1]


Binary Multiplication, 4 basic rules:

0 * 0 = 0
0 * 1 = 0
1 * 0 = 0
1 * 1 = 1
Binary multiplication of two bits is
the same as multiplication of the
decimal digits 0 and 1.


Binary Division:

Division in binary follows the same procedure as division in decimal


1's complement:

The 1’s complement of a binary number is found by changing all 1s to 0s and all 0s to 1s. here zero has two representations, 0000 0000 and 1111 1111.. not appreciated.


Logical circuit for 1's complement:

Parallel inverters.


2's complement

2's complement = (1's complement) + 1
OR the alternative method is:
Change all bits to the left of the least significant 1 to get 2’s complement.
for zero an overflow would occur but that taken care then main 8 bits represent 0.


Logical circuit for 2's complement:

parallel inverters followed by an adder with a carry input [1].


Get true form (uncomplemented) from 1's or 2's complement:

Simply repeat what u did to get the complement.


Sign Bit

It's the left-most bit in a signed binary number.
A 0 sign bit indicates a +ve number, and a 1 : -ve.


Signed numbers:
Sign Magnitude form

In the sign-magnitude form, a negative number has the same magnitude bits as the corresponding positive number but the sign bit is a 1 rather than a zero.


Signed numbers:

1s complement: 1s complement will be the negative number.
2s complement: 2s complement will be the -ve number.


The decimal value of signed number in 1s complement form and 2s complement:

+ve numbers:
determined by summing the weights in all bit positions where there are 1s.
-ve numbers:
determined by assigning a negative value to the weight of the sign bit, summing all the weights where there are 1s, and
adding 1 to the result.
And in 2s complement same process but no need of adding one to the answer.


For 2’s complement signed numbers, the range of values for n-bit numbers is?

Range = -( 2^[n-1] ) to +( 2^[n-1] - 1)
[1 sign bit and n-1 magnitude bits]


Floating Point Unit

-the coprocessor to free up the CPU (to perform other tasks) and increase speed.
- Performs complicated math operations using floating point numbers.


Single precision
Double precision
Extended precision

32bit floating point numbers - Single precision
64 - Double precision
80 - Extended precision


Floating point Number.

1. Mantissa [ shows magnitude, between 0-1, fractional number]
2. Exponent [ number of places the point has to move, it's the power of 10]



When the addition of same signed bits and 7 magnitude bits are not enough to represent the resulting the magnitude it changes the sign bit to adjust and creates an overflow situation.


Addition vocab:

Addend + augend = sum


Subtraction vocab: and function and how to:

minuend - subtrahend = difference
Basically, the subtraction operation changes the sign of the subtrahend and adds it to the minuend.
To subtract two signed numbers, take the 2’s complement of the subtrahend and
add. Discard any final carry bit.


sirect addition method only

Multiplicand * multiplier = product
Multiplication is equivalent to
adding a number to itself a number
of times equal to the multiplier.
In the direct addition method, you add the multiplicand a number of
times equal to the multiplier