Description

Survey: 2\'s Complement. 20. 21. 22. 23.

Transcripts

Number juggling Circuits Didn\'t I figure out how to do expansion in the second grade? UNC courses aren\'t what they used to be... 01011 +00101 10000 Finally; time to manufacture some genuine utilitarian squares We\'ll require a considerable measure of boxes

Review: 2\'s Complement N bits - 2 N-1 2 N-2 … 2 3 2 1 2 0 Range: – 2 N-1 to 2 N-1 – 1 "sign piece" "paired" point 8-bit 2\'s supplement case: 11010110 = –2 7 + 2 6 + 2 4 + 2 + 2 1 = – 128 + 64 + 16 + 4 + 2 = – 42 If we utilize a two\'s-supplement representation for marked whole numbers, a similar twofold option method will work for including both marked and unsigned numbers. By moving the certain "double" point, we can speak to parts as well: 1101.0110 = –2 3 + 2 + 2 0 + 2 - 2 + 2 - 3 = – 8 + 4 + 1 + 0.25 + 0.125 = – 2.625

A B CO CI S A B CO CI S A B CO CI S A B CO CI S A B CO CI S FA Carries from past section 1 0 1 Adding two N-bit numbers delivers a (N+1)- bit result Let\'s begin by building a piece that includes one segment: Then we can course them to include two quantities of any size… A3 B3 A2 B2 A1 B1 A0 B0 S4 S3 S0 S1 S0 Binary Addition Here\'s a case of parallel option as one may do it by "hand": A: 1101 B: + 0101 10010

Designing a "Full Adder": From Last Time Start with a truth table: Write down eqns for the "1" yields C o = C i AB + C i AB + C i AB + C i AB S = C i AB + C i AB + C i AB + C i AB Simplifing a bit C o = C i (A + B) + AB S = C i A B C o = C i (A B) + AB S = C i ( A B)

A B "Convey" Logic CI CO "Total" Logic S For Those Who Prefer Logic Diagrams … somewhat precarious, yet just 5 doors/bit C o = C i (A B) + AB S = C i ( A B)

A B CO CI S A B CO CI S A B CO CI S A B CO CI S FA ~ = bit-wise supplement B 0 B 1 B So we should manufacture a number-crunching unit that does both option and subtraction. Operation chose by control input : B3 B2 B1 B0 Subtract But shouldn\'t something be said about the "+1"? A3 A2 A1 A0 S4 S3 S0 S1 S0 Subtraction: A-B = A + (- B) Using 2\'s supplement representation: –B = ~B + 1

- or-Condition Codes Besides the total, one frequently needs four different bits of data from a number juggling unit: To look at An and B, perform A–B and utilize condition codes: Signed examination: LT N V LE Z+( N V) EQ Z NE ~Z GE ~( N V) GT ~(Z+( N V)) Unsigned correlation: LTU C LEU C+Z GEU ~C GTU ~(C+Z) Z (zero): result is = 0 major NOR door N (negative): result is < 0 S N-1 C (convey): demonstrates that include the most critical position delivered a convey, e.g., "1 + (- 1)" from last FA V (flood): shows that the answer has an excessive number of bits to be spoken to effectively by the outcome width, e.g., "(2 i-1 - 1)+ (2 i-1 - 1)"

A B CO CI S A B CO CI S A B CO CI S A B CO CI S A B CO CI S FA A B CI CO S T PD of Ripple-Carry Adder A n-1 B n-1 A n-2 B n-2 A 2 B 2 A 1 B 1 A 0 B 0 C … S n-1 S n-2 S 2 S 1 S 0 Worse-case way: convey spread from LSB to MSB, e.g., while including 11… 111 to 00… 001. t PD = (t PD,XOR +t PD,AND + t PD,OR ) +(N-2)*(t PD,OR + t PD,AND ) + t PD,XOR (N) A,B to CO CI to CO CI N-1 to S N-1 (N) is perused "arrange N" and lets us know that the inactivity of our viper develops in extent to the quantity of bits in the operands.

Faster Carry Logic Carry-Lookahead Adders (CLA) Carry-Skip Adders Carry-Select Adders

An A B Add/Sub S Adder Summary Adding is a typical, as well as has a tendency to be a standout amongst the most time-incredulous of operations. Subsequently, an extensive variety of viper structures have been created that permit a planner to tradeoff unpredictability (as far as the quantity of doors) for execution. Littler/Slower Bigger/Faster Ripple Carry Skip Carry Select Carry Lookahead At this point we\'ll characterize an abnormal state practical unit for a snake, and indicate the subtle elements of the execution as fundamental. sub

X 7 X 6 X 5 X 4 X 3 X 2 X 1 X 0 R 7 R 6 R 5 R 4 R 3 R 2 R 1 R 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 "0" SHL1 Shifting Logic Shifting is a typical operation that is connected to gatherings of bits. Moving can be utilized for arrangement, and also for math operations. X << 1 is approx the same as 2*X X >> 1 can be the same as X/2 For example: X = 20 10 = 00010100 2 Left Shift: (X << 1) = 0010100 0 2 = 40 10 Right Shift: (X >> 1) = 0 0001010 2 = 10 Signed or "Number juggling" Right Shift: (- X >> 1) = (11101100 2 >> 1) = 1 1110110 2 = - 10

Boolean Operations It will likewise be helpful to perform consistent operations on gatherings of bits. Which ones? ANDing is valuable for "concealing" off gatherings of bits. ex. 10101110 & 00001111 = 00001110 (veil chooses last 4 bits) ANDing is additionally helpful for "clearing" gatherings of bits. ex. 10101110 & 00001111 = 00001110 (0\'s unmistakable initial 4 bits) ORing is helpful for "setting" gatherings of bits. ex. 10101110 | 00001111 = 10101111 (1\'s set last 4 bits) XORing is helpful for "supplementing" gatherings of bits. ex. 10101110 ^ 00001111 = 10100001 (1\'s supplement last 4 bits) NORing is helpful.. Uhm, on the grounds that John Hennessy says it is! ex. 10101110 # 00001111 = 01010000 (0\'s supplement, 1\'s unmistakable)

B i An i This rationale square is rehashed for every piece (i.e. 32 times) 00 01 10 11 Bool Q i Boolean Unit It is easy to develop a Boolean unit utilizing primitive entryways and a mux to choose the capacity. Since there is no interconnection between bits, this unit can be essentially imitated at every position. The cost is around 7 doors for each piece. One for every primitive capacity, and approx 3 for the 4-input mux. This is a clear, yet not very rich of an outline.

A B Sub Boolean Bidirectional Shifter Add/Sub Bool Shft 1 0 Math 1 0 R … An ALU, finally Now we\'re prepared for a major one! An Arithmetic Logic Unit. That is a great deal of stuff Flags V,C N Flag Z Flag