Download presentation
Presentation is loading. Please wait.
1
cpe 252: Computer Organization1 Lo’ai Tawalbeh Lecture #2 Standard combinational modules: decoders, encoders and Multiplexers 1/3/2005
2
cpe 252: Computer Organization2 Decoders General decoder structure Typically n inputs, 2 n outputs –2-to-4, 3-to-8, 4-to-16, etc.
3
cpe 252: Computer Organization3 Binary 2-to-4 decoder Note: “x” = (don’t care) cases.
4
cpe 252: Computer Organization4 Decoder Use – Operation Decoding Microprocessor instruction decoding other fields opcode field instruction 4-input binary decoder En 1 0 1 2 ………. 15 jump load store add decoded instructions
5
cpe 252: Computer Organization5 2-to-4-decoder logic diagram
6
cpe 252: Computer Organization6 3-input Binary Decoder E x 2 x 1 x 0 x y 7 y 6 y 5 y 4 y 3 y 2 y 1 y 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 1 0 1 0 1 0 2 0 0 0 0 0 1 0 0 1 0 1 1 3 0 0 0 0 1 0 0 0 1 1 0 0 4 0 0 0 1 0 0 0 0 1 1 0 1 5 0 0 1 0 0 0 0 0 1 1 1 0 6 0 1 0 0 0 0 0 0 1 1 1 1 7 1 0 0 0 0 0 0 0 0 - - - - 0 0 0 0 0 0 0 0 Inputs: x = (x 2, x 1, x 0 ), with x i in {0,1} and E in {0,1} Outputs: y = (y 7,y 6,y 5,…,y 1,y 0 ) with y i in {0,1} Function: yi = E. m i (x), i = 0,1,…,7
7
cpe 252: Computer Organization7 Implementing functions using a Binary Decoder and OR Gates x 2 x 1 x 0 z 2 z 1 z 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 1 0 1 1 0 1 0 1 0 0 0 0 1 1 0 1 1 1 0 0 1 0 1 1 1 1 0 0 Function 210210 0123456701234567 Binary Decoder E 1 x2x1x0x2x1x0 z2z2 z1z1 z0z0 Remember that any function can be represented as a sum of minterms
8
cpe 252: Computer Organization8 Binary Encoders Only one input I j has value 1 at any given time Output Y corresponds to the binary code of j when I j = 1
9
cpe 252: Computer Organization9 8-to-3 Binary Encoders Y0 = I1 + I3 + I5 + I7 (odd input indices) Y1 = I2 + I3 + I6 + I7 Y2 = I4 + I5 + I6 + I7 (indices > 3)
10
cpe 252: Computer Organization10 Multiplexers MUX 1 0 01230123 selection inputs data inputs 101101 0 101101 0 1 101101 1 0
11
cpe 252: Computer Organization11 4-input Multiplexer
12
cpe 252: Computer Organization12 Typical Multiplexer use selection between multiple paths to a functional unit
13
cpe 252: Computer Organization13 Multiplexers as universal modules Universal module: using only this module you are able to implement ANY logic function. NAND and NOR gates for example are universal gates. Question: how do you assign inputs for the multiplexer in order to implement a given function?
14
cpe 252: Computer Organization14 Exercise Implement the following function using: a) 8-input multiplexer. b) 4-input multiplexer. F= x,y,z (1,2,6,7)
15
cpe 252: Computer Organization15 Lo’ai Tawalbeh Lecture #2 Signed and Unsigned Numbers
16
cpe 252: Computer Organization16 4-bit Unsigned Numbers Range of values for n-bit vector is: 0 ≤ x ≤ (2^n-1)
17
cpe 252: Computer Organization17 Representation of Signed Integers and Basic Operations Two common representations –Sign and Magnitude (SM) –True and Complement (TC) In both cases there is a mapping from signed values to positive values.
18
cpe 252: Computer Organization18 Sign and Magnitude x represented by a pair (s,m) where – s is the sign: 0 for positive and 1 for negative – m is the magnitude –example: (-23)10 = -(10111) = (1,10111) Range of values for n-bit vector ( n-1 bits for m ) – - (2 n-1 – 1) ≤ x ≤ (2 n-1 – 1) Two representations for zero
19
cpe 252: Computer Organization19 2’s complement No separation between sign and magnitude Signed integer x represented by positive integer x R such that: Example: n=4, 2^4=16. To represent x = -7; x R = 9 Range of values for n-bit vector ( 2’s comlement) – - (2 n-1 ) ≤ x ≤ (2 n-1 – 1)
20
cpe 252: Computer Organization20 4-bit Two’s Complement Numbers
21
cpe 252: Computer Organization21 Change of Sign 1.complement each bit of x 2.add 1 Example: n = 4 x = (0011) 2 = 3 x’ = 1100 + 1 1101 representation of -3
22
cpe 252: Computer Organization22 Positive integer addition/subtraction
23
cpe 252: Computer Organization23 Two’s complement addition/subtraction Addition: same as positive integer addition –just discard carry out Subtraction: x - y –step 1: change the sign of y to obtain -y –step 2: add x and -y Example: x = 8, y = 5, 5- bit vectors y = 00101 -y = 11011 <<< change sign x - y = 01000 11011 + 00011 << carry out discarded
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.