2.37k likes | 2.39k Views
Explore numeric symbols, base conversions, and logic gates with practical examples. Learn the importance of binary, octal, and hexadecimal systems in computing.
E N D
ITEC 352 Fall 2018
Church-Turing thesis Turing machines
How many numeric symbols do we use? And why? 10 of them, these: 0 9 3 1 8 5 4 6 2 7
In base 10 4,561 5 6 1 ---------------------------------------------------- 1000’s 100’s 10’s 1’s 103 102 101 100
In general , for base B: … b3 b2 b1 b0 The b cubed place the b squared place the b place the 1’s place And while we’re at it: … b3b2 b1 b0 . b-1 b-2 b-3 b-4 …
Bases 32710== 3*100 = 300 2*10 = 20 7*1 = 7 ------ 327 which means 327 in base 10
what is 327 base 10 in base 7? 6457 6*49 = 294 4*7 = 28 5*1 = 5 ------- 32710
Computers use base 2 32710== 1010001112 1*256 = 256 0*128 = 0 1*64 = 64 0*32 = 0 0*16 = 0 0*8 = 0 1*4 = 4 1*2 = 2 1*1 = 1 ------- 327
We care about: base 2 (binary) base 8 (octal) base 16 (hexadecimal or just 'hex') Why octal and hex? What complexity does hex introduce? What do binary, octal, and hex have in common?
Why octal and hex? 1 octal digit = 3 bits 1 hex digit = 4 bits compact, easy conversion to/from binary What complexity does hex introduce? we need more than 10 symbols, 16 in fact What do binary, octal, and hex have in common? powers of 2
Count in powers of 2, from 0 to 1 gig (in base 10) 1 2 4 8 16 32 64 128 256 512 1024 (1 K) 2048 4096 8192 16384 32768 65536 128k 256k 512k 1024k (1 meg)
Now do it in base 2 1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000 10000000000 100000000000 1000000000000 a byte has 2 nibbles: 0000 0001 0000 0010 0000 0100 0000 1000 0001 0000 0010 0000 0100 0000 1000 0000
Now in hex: 1 2 4 8 10 20 40 80 100 200 400 800 1000 2000 4000 8000 10000 20000 40000 We will use a leading “0x” to indicate that the number following is hexadecimal e.g. 0x11 means decimal 17 . .
Know these like you know your times tables Binary Hex Decimal 0000 0x00 0 0001 0x01 1 0010 0x02 2 0011 0x03 3 0100 0x04 4 0101 0x05 5 0110 0x06 6 0111 0x07 7 1000 0x08 8 1001 0x09 9 1010 0x0a 10 1011 0x0b 11 1100 0x0c 12 1101 0x0d 13 1110 0x0e 14 1111 0x0f 15
Why all this is important 0100 0001 == 65 == -v(oltage), +v, -v, -v, -v, -v, -v, +v which may mean: 65 ASCII 'A' the color dark blue a small slice of an audio track a one byte portion of a larger number ... or an infinite number of application defined semantics
Why all this is important Digitization + Boolean Algebra See Claude Shannon
What are the following binary numbers in base 10? 0000 0001 0000 0011 0000 0111 0000 1111 0001 1111 0011 1111 0111 1111 1111 1111 0000 0001 1111 1111 0000 0011 1111 1111 what's the pattern?
What are the following binary numbers in base 10? 1 0000 0001 3 0000 0011 7 0000 0111 15 0000 1111 31 0001 1111 63 0011 1111 127 0111 1111 255 1111 1111 etc. Each is a power of 2 minus 1. When you add one You will go up to the next power of 2.
In base 10: 63 + 1 = 64 In base 2: 0 0 1 1 1 1 1 1 (63) +0 0 0 0 0 0 0 1 (1) --------------------- 0 1 0 0 0 0 0 0 (64, every power of 2 has exactly 1 bit set)
Convert: decimal binary octal hex 7 110 65 12 827 199 100 56 count from 0 to F in binary convert to binary: 0xbed 0xa7 0xf02e 0x31f4 0x76 0xabcdef 0xbadbeef 0xdefaced
Logic Gates: AND given: If Fred is strong and Bob is strong, we will win the football game (“strong” means benches >= 275 pounds) Fred benches 290, Bob benches 310 - Will we win? Fred benches 290, Bob benches 210 – Will we win? Fred benches 135, Bob benches 80 – Will we win? Fred benches 110, Bob benches 300 – Will we win?
AND If Fred is strong and Bob is strong, we will win the football game, otherwise we will lose the football game (“strong” means benches >= 275 pounds) Fred benches 290, Bob benches 310 - Will we win? Fred benches 290, Bob benches 210 – Will we win? Fred benches 190, Bob benches 275 – Will we win? Fred benches 135, Bob benches 80 – Will we win?
AND - ^,juxtaposed Fred Victory Bob F B V 0 0 1 1 0 1 0 1 0 0 0 1 We call this representation a Truth Table
w x y z w x y z (w^x) ^ (y^z) 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 (w ^ x) ^ (y ^ z)
w x y z (w ^ x) ^ (y ^ z) w x w^x y z y^z (w^x) ^ (y^z) 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 1 1 1 1 1 1
OR If Tabitha competes or Katie competes, the world record will be broken Tabitha competes, Katie does not. Will the world record be broken? Katie competes, Tabitha does not. Will the world record be broken? Both Tabitha and Katie compete. Will the world record be broken? Neither Tabitha nor Katie compete. Will the world record be broken?
OR If Tabitha competes or Katie competes, the world record will be broken, otherwise the world record will not be broken. Tabitha competes, Katie does not. Will the world record be broken? Katie competes, Tabitha does not. Will the world record be broken? Both Tabitha and Katie compete. Will the world record be broken? Neither Tabitha nor Katie compete. Will the world record be broken?
OR - ^,+ Tabitha New world record Katie T K WR 0 0 1 1 0 1 0 1 0 1 1 1 OR Truth Table
X Y XY XY+Y Fill out the truth table: X Y XY+Y
NOT - or ' X X'
Truth tables of the basic logic gates nand x y o -------------- 0 0 1 0 1 1 1 0 1 1 1 0 nor x y o --------------- 0 0 1 0 1 0 1 0 0 1 1 0 xor x y o -------------- 0 0 0 0 1 1 1 0 1 1 1 0 not x o -------- 0 1 1 0 xnor x y o -------------- 0 0 1 0 1 0 1 0 0 1 1 1 and x y o -------------- 0 0 0 0 1 0 1 0 0 1 1 1 or x y o -------------- 0 0 0 0 1 1 1 0 1 1 1 1
Boolean functions variables, logic operators, (),= F = xy + y x y F -------------- 0 0 0 0 1 1 1 0 0 1 1 1 or F(x,y)= ∑(1,3)
F(x,y,z) = ∑(1,4,5,6,7) x y z F -------------------- 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 draw the logic gates
F = x + y'z now draw the logic gates is that the simplest form? using boolean algebra lets us simplify
Basic relations of Boolean algebra 1. x + 0 = 9. x + y = 2. x^0 = 10. xy = 3. x + 1 = 11. x + (y + z) = 4. x^1 = 12. x(yz) = 5. x + x = 13. x(y + z) = 6. x ^ x = 14. x + yz = 7. x + x' = 15. (x + y)' = 8. x ^ x' = 16. (xy)' = 17.(x')' = 15,16 == DeMorgan's theorems nand,nor
Basic relations of Boolean algebra 1. x + 0 = x 9. x + y = y + x 2. x^0 = 0 10. xy = yx 3. x + 1 = 1 11. x + (y + z) = (x + y) + z 4. x^1 = x 12. x(yz) = (xy)z 5. x + x = x 13. x(y + z) = xy + xz 6. x ^ x = x 14. x + yz = (x + y)(x + z) 7. x + x' = 1 15. (x + y)' = x'y' 8. x ^ x' = 0 16. (xy)' = x' + y' 17.(x')' = x 15,16 == DeMorgan's theorems nand,nor
F = ((ab')' ^ b')' draw the logic gates give the truth table show the function in the sigma notation simplify using the basic relations of boolean algebra
Simplify using the basic relations f = ((ab')' ^ b')' = ab' + b by 16 ab' + b = b + ab' by 9 =(b + a)(b + b') by 14 =(b + a) ^ 1 by 7 = (b + a) by 4 = (a + b) by 9
Combinational Circuits A connected arrangement of logic gates mapping n inputs to m outputs. n inputs == 2n possible binary input combinations each of which yields exactly one set of outputs m outputs => this is a set of m boolean functions, expressed in terms of the n inputs that completely describe the circuit
Binary/hex addition Add these binary numbers: 0 0 1 1 +0 +1 +0 +1 ----- ----- ---- ---- 0111 110111 + 0101 +110001 --------- ------------ 0101 1100 + 1111 1010 ------------------ Add these hex numbers: ba 3c1 +fe + 75f ----- -------
The Half Adder A combinational circuit with two inputs and two outputs the inputs: x,y are the two bits to be added out outputs: s,c are the sum and carry respectively S = x'y + xy' C = xy 1. draw the circuit 2. simplify it and draw it again 3. give the truth table
The Half Adder x C y S x y c s -------------------- 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0
Full Adder Add two binary bits + incoming carry output sum + outgoing carry x S y Z C
Full Adder Truth Table inputs outputs X Y Z S C -------------------------------- 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1
Flip-Flops (i.e memory) also called a latch S Q Q' R Asynchronous – feedback paths -instability operates with both inputs normally at 1 application of a momentary '0' to the S(et) input causes Q to go to 1 and Q' to go to 0 application of a momentary '0' to the R(eset) input causes Q to go to 0 and Q' to go to 1
Clocked RS Flip Flop S Q cp Q' R S R Q(t+1) --------------------------- 0 0 Q(t) no change 0 1 0 clear 1 0 1 SET 1 1 ? don't do it
D Flip Flop Same as RS, but an inverter generates R from S' D Q cp Q' D Q(t+1) --------------------------- 0 0 clear 1 1 set