Presentation is loading. Please wait.

Presentation is loading. Please wait.

Number Systems with special emphasis on Binary Last lecture Spring 2016 BRAC University Dept. of EEE. 24/01/2016 Rachaen M. Huq1.

Similar presentations


Presentation on theme: "Number Systems with special emphasis on Binary Last lecture Spring 2016 BRAC University Dept. of EEE. 24/01/2016 Rachaen M. Huq1."— Presentation transcript:

1 Number Systems with special emphasis on Binary Last lecture Spring 2016 BRAC University Dept. of EEE. 24/01/2016 Rachaen M. Huq1

2 Quick Recap – Signed Numbers - 2’s complements – addition subtraction If I ask you… What would be a computer system’s 100100 in decimal? What you be your answer? Rachaen M. Huq2

3 Quick Recap – Signed Numbers - 2’s complements – addition subtraction If you had attended the last class, your response would be… The question does not provide “sufficient” information. Two more things need to be clarified. Rachaen M. Huq3

4 1)What is the bit-length of your system? (Just to make sure if you have or haven’t ignored the least significant zeros when you wrote the number. E.g. is it 00100100? Like an 8 bit system? Or 100100, in 6 bit system ? 2) Is the number signed or unsigned. (Most important question). Rachaen M. Huq4 Quick Recap – Signed Numbers - 2’s complements – addition subtraction

5 Lets say it’s a 6 bit system. That means it is 100100, as it is. NOW: If it is unsigned The value would be __________________? Rachaen M. Huq5 Quick Recap – Signed Numbers - 2’s complements – addition subtraction

6 If it is signed.. 1 00100 – The MSB 1 represents it’s a negative number To get the value, need to complement again. Notice that after complementing, the MSB 1 becomes 0 For a signed number: 1 in MSB means –ve, 0 means +ve. So the value would be _____________________? Then the absolute value would be______________? Rachaen M. Huq6 Quick Recap – Signed Numbers - 2’s complements – addition subtraction

7 Express -7 in an 8 bit system which uses a 2’s complement mechanism to represent negative numbers Rachaen M. Huq7 Quick Recap – exercise

8 Finding the largest possible numbers to express at a particular length For unsigned, its more straightforward. We know it already In decimal, what is the maximum number for a 3 digit space? Rachaen M. Huq8

9 Finding the largest possible numbers to express at a particular length Can we generalize this? (Base ^(space) ] -1 So what would it be in binary ? Rachaen M. Huq9

10 Finding the largest possible numbers to express at a particular length 111 Rachaen M. Huq10 [2 ^ (3) ] -1 Makes sense? What would be the case for an 8 bit unsigned number? In other words, what is the maximum number expressed with 8 bits in an unsigned system?

11 Finding the largest possible numbers to express at a particular length What if the number is signed? What is the largest positive number in an 8 bit signed number system ? The number is ______________________ Remember, 0 means positive, 1 means negative. What is the value in decimal? What is the absolute value? Rachaen M. Huq11

12 Finding the largest possible numbers to express at a particular length BONUS +1. What is the largest negative number in an 8 bit signed number system? Hints: MSB =1 for sure. To find out the abs. value of a negative number, the representation is complemented again So you need to make sure that you are reaching the maximum absolute value when complemented. Common sense says (comparing with the unsigned cased) that it should be - 127 But should it be so? Rachaen M. Huq12

13 Last semester midterm question (weight 3/20) fraction of students who got it right  3/41 Consider an 8 bit adder/subtractor simple computer It takes TWO 8 bit signed numbers as inputs Gives ONE 8 bit signed number as an output. The result is the addition of the two numbers. (note that since it deals with signed numbers, addition also could mean subtraction, e.g a+(-b) = a-b What is the working range of the computer. That means, what must be the limitation of the input bit-lengths, (or How would you LIMIT the input bit-lengths) so that the output can show meaningful results. Rachaen M. Huq13

14 Other representation of signed numbers Sign & magnitude. Example: _____________________________ Simple, more “human-like”, but not much useful. Doesn’t help in calculations. 2’s complement also clarifies the difference between +ve and –ve numbers using only MSB but it has the additional benefit of helping in subtractions. Rachaen M. Huq14

15 Binary codes Useful for human-machine-interfaces, where the calculations are not primary concerns, rather One-to-One correspondence. ASCII Codes. (Table 1-5 Morris Mano ) BCD (will be used in this course a lot) Excess-3 (will be used later) See examples in black board. Rachaen M. Huq15

16 END OF OUR TARGET TOPICS in Number Systems… Introduction to Binary Logic / Digital Logic. Rachaen M. Huq16

17 Binary LOGIC, Boolean variables Rachaen M. Huq17 “A”, “B”, and “Lamp” are Binary Variables, i.e. can take values only 1 and 0 (only two states) See the table for ALL Possible combinations of A, B, and Lamp A practical example ABLamp 000 010 100 111 Its called a Binary AND Logic

18 Representation of AND Rachaen M. Huq18 Note the symbol of an AND Logic, a.k.a. AND Gate. There are other symbols for other kind of logics. Its called a GATE because the inputs are given to the “gates” of the MOSFETS. Hence, the logic gate symbols exist in reality as a combination of MOSFETS. The inputs are either a Low, (0V or -5V) or High(5V). Low =0, High = 1. Expressed as: Output = A.B The expression is a Boolean algebraic equation, driven by Boolean variables “output”, “B” and “B”. This logical relationship table is called a truth table

19 Inside an AND GATE Rachaen M. Huq19 Apply 5V in Both A and B, you will get 5V in “Out” directly from Vdd biasing (5V). Any of them is 0V, the line disconnects, but below, one line is activated which makes OUT to be connected to Vss- (0V).

20 Practical Example of an OR Gate Rachaen M. Huq20 Expressed as: Output = A + B

21 NOT gate (inverter) Rachaen M. Huq21 Note that a NOT gate can have only ONE input and only ONE output Expressed as: C = A’

22 Summary of Basic gates Rachaen M. Huq22 AND/OR Gates may have more than two inputs… Depending one How many MOSFETS are in series/parallel! Guess the truth tables

23 Other gates Rachaen M. Huq23 Output = ??

24 Rachaen M. Huq24 NAND Negative OR Invert First Then OR ABCOut = C’ ABAB Out ABAB AA’BB’Out C

25 Do the same for NOR and Neg. AND You will find that they eventually lead to Boolean algebraic identities. (A+B)’ = A’. B’ (AB)’ = A’ + B’ Its called De Morgan’s Law. This is just an identity which applies in Boolean Algebra, just like the (a+b)^2 identity applies in traditional algebra. Rachaen M. Huq25

26 Exclusive (X-__) gates Rachaen M. Huq26 Symbol? Output = A__?__B Symbol? Output = A__?__B

27 A summary of all the gates are available at Section 2-7 Morris Mano Page 57 Rachaen M. Huq27


Download ppt "Number Systems with special emphasis on Binary Last lecture Spring 2016 BRAC University Dept. of EEE. 24/01/2016 Rachaen M. Huq1."

Similar presentations


Ads by Google