Digital Logic Design Module 8

¡Supera tus tareas y exámenes ahora con Quizwiz!

A one-bit comparator can be implemented using combinational logic for each output. A designer could start by filling in a truth table with 5 inputs gti, lti, eqi, a, and b, and 3 outputs gto, lto, eqo. The truth table will have 25 = 32 rows. Alternatively, the designer can start directly with equations.

* eqo should be 1 if eqi is 1 AND a, b are the same. Thus: eqo = eqi(ab + a'b'). * gto should be 1 if gti is 1, OR eqi is 1 AND ab are 10. Thus: gto = gti + eqi(ab'). * lto should be 1 if lti is 1, OR eqi is 1 AND ab are 01. Thus: lto = lti + eqi(a'b).

3-bit 2x1 mux.

- A 3-bit 2x1 mux uses three 2x1 muxes to pass data through. - s = 0 allows a2a1a0 to pass through. - s = 1 allows b2b1b0 to pass through.

adding in binary

- Add rightmost digit: 1 + 0 = 1. - Add next digit: 1 + 1 = 10, so carry 1. - Continue for next digit: 1 + 1 + 1 = 11. Carry 1. - Continue for the last digit: 1 + 0 + 0 = 1.

An RGB to CMYK converter can be implemented as a datapath using subtractors and minimum components.

- Cyan, Magenta, and Yellow are derived from Red, Blue, and Green using subtractors. C = 255 - R; M = 255 - G; Y = 255 - B. - Two instances of the Min component are used to factor out the black. K = Minimum(C, M, Y) is implemented as Minimum(Minimum(C, M), Y). - Three subtractors remove the K value from the C, M, and Y values.

a carry ripple adder

- Each digit's pair of bits and carry-in bit is added. A sum and carry-out bit is generated. - The carry-out (cout) from each addition propagates to the left. - Each digit pair and carry-in are added at the same time. Notice that the initial result is not correct. - Once carry bits propagate left, the correct result is obtained: 1101 + 1001 = 10110. - An adder is commonly represented as a block symbol.

Full adder

- Fill in truth table. - Continue filling in truth table. - Derive circuit equations. - Draw full adder circuit.

Two's complement signed number representation

- Intuition in base 10. - In base two, a complement is obtained by inverting each bit and adding 1. - Subtraction is performed by adding the complement

Assume four-bit two's-complement representation. 1) 6 + 2 is 0110 + ? 2) 6 + -2 is 0110 + ? 3) 3 + -4 is 0011 + 1100 = ? 4) 2 - 3 is 0010 + ? 5) -3 + 2 is ? + 0010

1) 0010 ; 2 is 0010 in binary. The leftmost 0 means positive. 2) 1110 ; 2 is 0010. The negative is the complement, so 1101 + 1 or 1110. 3) 1111 ; Once represented as two-complement, numbers can be added, even if one is negative. 4) 1101 ; 2 - 3 is 2 + -3.-3 is 0011 complemented, so 1100 + 1 or 1101. (The result is 1101 + 0010 = 1111, which is -1). 5) 1101 ; Either or both numbers can be negative. The first number is -3, represented as the complement of 3 (0011), so 1100 + 1 = 1101. (The result is 1101 + 0010 = 1111, or -1).

1) A 12-bit carry-ripple adder adds two ?-bit numbers. 2) Each digit's pair of bits and carry-in bit are added simultaneously. (T or F) 3) A = 1111, B = 0001

1) 12 ; An N-bit carry-ripple adder adds two N-bit numbers. N refers to the size of each input. 2) True ; As carry bits propagate from right to left, each digit's pair and carry-in are re-evaluated. 3) cout = 1s3s2s1s0 = 0000 ; Adding two 4-bit numbers may yield a 5-bit result. The cout bit combined with the sum bits can be used to yield a 5-bit number: 1111 + 0001 = 10000.

1) What is the greatest possible value of S? Give answer in decimal. 2) What is the greatest possible value of S? Give answer in binary. 3) Suppose the fan had an electronic on-off switch. When off, S should output what value? Give answer in decimal.

1) 24 ; D's greatest value is 15, so S's is 9 + 15 = 24. 2) 11000 ; The adder computes 01001 (9) + 01111 (15) = 11000 (24) 3) 0 ; 0 means no rotation.

1) In base ten, for two digits, what is the complement of 33? 2) In base two, for four bits, what is the complement of 0010? 3) What is -2 in four-bit two's-complement representation? 4) What is -7 in four-bit two's-complement representation? 5) Assuming four-bit two's-complement representation, is 1011 positive or negative? 6) Assuming two's-complement representation, what base ten number does 1001 represent? 7) Assuming two's-complement representation, what base ten number does 1111 represent? 8) In base two, for four bits, what is the complement of 0000? 9) What is -3 in eight-bit two's-complement representation?

1) 67 ; 33 + 67 = 100Note: Base ten is introduced here only for intuition. Digital circuits use base two. 2) 1110 ; Invert the bits: 1101 - Then add 1: 1110 - Check result: 0010 + 1110 = 10000 3) 1110 ; +2 is 0010. Complement to obtain the negative representation:Invert the bits: 1101Then add 1: 1110So 1110 represents -2. 4) 1001 ; 7 is 0111. Complement to obtain the negative representation: Invert the bits: 1000Then add 1: 1001 5) Negative ; Left bit is 1, so negative. 6) -7 ; Left bit is 1, so negative.Complement to find positive.0110 + 1 = 0111Magnitude is 7. Negate to yield -7. 7) -1 ; Left bit is 1, so negative. - Complement to find positive. - 0000 + 1 = 0001 - Magnitude is 1. Negate to yield -1. 8) 0000 ; Invert the bits: 1111Then add 1: 10000, which in four bits is 0000.0000 is somewhat of an exception. 9) 11111101 ; +3 is 00000011 in 8 bits. - Complement to find negative: (00000011)' + 1 = 11111100 + 1 = 11111101

1) A half adder adds two bits. 2) A half adder generates a carry-out if any input is 1. 3) A half adder circuit requires fewer gates than a full adder circuit. 4) An incrementer adds 1 to input A. 5) Full adders can be used to construct an incrementer. 6) A 4-bit carry-ripple adder can be constructed using 4 half adders.

1) True ; A half adder adds two bits, a and b, and generates a sum and carry. 2) False ; co = ab. A half adder generates a carry if BOTH inputs are 1. 3) True ; A half adder is constructed from 3 AND gates, 1 OR gate, and 2 NOT gates. A full adder requires 7 AND gates, 2 OR gates, and 3 NOT gates. 4) True ; The 4-bit incrementer adds 1 to a3a2a1a0. The rightmost half adder adds a0 and 1. The remaining half adders add an to the carry generated in the previous operation. 5) False ; Full adders can be used to construct an incrementer by inputting 00...0 to the adder's B input, and 1 to the carry-in. However, the resulting circuit is larger than necessary. 6) False ; Adding each digit's pair requires 3 inputs: a, b, and carry-in. A half-adder contains only two inputs.

1) A circuit that adds three bits and generates a sum and carry-out is know as a _______. 2) How many full adders are needed to create a 7-bit carry-ripple adder?

1) full adder ; A full adder is a circuit that adds three bits and generates a sum and carry-out. A half adder is a circuit that adds two bits and generates a sum and carry-out. 2) 7 ; An N-bit carry-ripple adder is constructed with N full adders.

Load register design

A designer may want to load a register only on certain clock cycles rather than on every clock cycle. Registers commonly come with a control input named "load" or "ld". Implementing such a load register can be done using 2x1 muxes.

An incrementer adds 1 to a number, which is a common operation. An incrementer can be built by inputting 00..00 to an adder's B input, and 1 to the carry-in. Such a circuit is unnecessarily large, because each digit's full adder can add 3 bits (a, b, ci), but b is always 0.

A half adder adds two bits (a, b), and is sufficient for an incrementer.

A full adder is a circuit that adds three bits and generates a sum and carry-out. Four full adders were used above. The strange name "full adder" is historical, intended to contrast with a half adder.

A half adder is a circuit that adds two bits and generates a sum and carry-out bit. A full adder can be designed starting from a truth table.

Unsigned numbers involve only non-negative numbers, like 0 and 3. Signed numbers involve both positive and negative numbers, like 3 and -3. In binary, a signed-magnitude representation uses the left bit for the sign: 0 means positive, 1 means negative. Ex: For 4-bit numbers, 0011 is 3, and 1011 is -3. Signed-magnitude representation is rarely used, because calculations involving negative numbers, such as 5 - 3, would require special circuits beyond an adder.

A more clever negative number representation exists that can use an adder for both positive and negative numbers. A complement of an N-digit number is another number that yields a sum of 100..00 (with N 0's), and can be used to represent the negative of that number.

Many digital circuits, like in a calculator or computer, must add binary numbers. For decimal numbers, adding by hand starts at the right and adds each digit, possibly carrying a 1 to the next digit.

Adding in binary is identical.

The largest positive four-bit two's-complement number is 0111, or 7. The smallest negative is 1000, or -8 (0111 + 1 = 1000, so magnitude is 8). Note that two's complement represents one more negative than positive. Positive 8, 9, ... cannot be represented in four-bit two's complement. Likewise, -9, -10, ... cannot either.

Adding two positives, or adding two negatives, may yield a value that can't be represented in the given number of bits, a situation known as overflow. Ex: 0101 (5) + 0011 (3) incorrectly yields 1000, which is -8 in two's complement.

Load register behavior An N-bit load register (such as an 8-bit load register or just 8-bit register) stores N bit values, loading new bit values when a clock input rises if a load input is 1. A load input (ld) indicates when the register should be loaded. A reset input (rst) may exist that indicates that the register's bits should be reset to 0 (having priority over ld).

All a circuit's registers may share one clock signal, whose rising edge (the instant a 0 changes to 1) synchronizes loading of all registers (like a drum beat synchronizes a marching band).

Two's-complement representation has the benefit of allowing an adder to be used even when dealing with negative numbers.

Ex: 5 + -3 is just 0101(5) + 1101(-3) = 10010, or 0010(2) after ignoring the carry. No extensive special circuitry for negative numbers is needed.

RGB and CMYK color spaces Many electronic devices deal with color images. Pixels (picture elements) are tiny indivisible dots of color that are part of images displayed on any screen. The number of pixels in an image depends on the resolution of the display. The RGB color space is often used for displays to represent color, as any color can be created by using specific intensities of red, green, and blue light.

However, the RGB colorspace is not ideal for other media. Printers use the CMY (Cyan/Magenta/Yellow) color space, as ink absorbs some light while reflecting others to create colors. Cyan ink absorbs red, reflecting green and blue. Magenta ink absorbs green, reflecting red and blue. Yellow absorbs blue, reflecting red and green. Thus, a printer converts a received RGB image to CMY to print.

A subtractor computes A - B, where A and B are N-bit numbers, such as 8-bit numbers. If numbers are represented using two's-complement representation, a subtractor can be built using an adder.

Inverting B's bits and setting the adder's carry-in to 1 adds B's complement to A.

A comparator compares two numbers, indicating whether the numbers are equal, or which number is greater.

Same-length unsigned binary numbers can be compared by hand just like base ten numbers: Starting from the left, digits are compared until a difference is found.

A carry-ripple comparator compares two N-bit numbers from left to right, with the result of each digit's comparison "rippling" to the next digit. For each digit, a one-bit comparator compares two bits a and b only if the eq input was 1 from the higher digit, else just passing along a gt 1 or an lt 1. The rightmost digit's output becomes the N-bit comparator's output. The name "carry-ripple" refers to the similarity of the comparator's implementation to a carry-ripple adder's implementation.

The correct output of leftmost digit ripples to next digit, and so on. Eventually the external outputs become correct.

The above is called the two's-complement representation, which inverts every bit and adds 1. One's complement also exists, but is rarely used, so not discussed further. This material uses "complement" to mean two's complement.

The left bit indicates the sign. 0011 is +3. 1101 is a negative; complementing yields the positive version: 0010 + 1 = 0011, which is 3. So 1101 is -3. This section uses 4-bit numbers for ease of example; wider numbers like 8 or 32 bits are more typical.

A datapath component is commonly represented as a block symbol.

This material generally uses uppercase letters to represent multi-bit data and lowercase letters to represent single-bit data. A multi-bit wire is drawn as a single wire with a slash (/), as shown below.

The two minimum (Min) components are used to _____.

compute the minimum of the three values R, G, and B ; The first Min component calculates the minimum of C and M, or Minimum(C, M). The second Min component calculates the minimum of Minimum(C, M) and Y. The resulting output K is the minimum of the three values C, M, and Y.

adder

computes A + B, where A and B are N-bit numbers, such as 8-bit numbers.

carry-ripple adder

mimics adding by hand, adding a digit's pair of bits and carry-in bit, and generating a sum and carry-out bit.


Conjuntos de estudio relacionados

Converting Fractions to Decimals, Converting Decimals to Fractions

View Set

CHAPTER 11: ASSESSMENT AND CARE OF PATIENTS WITH FLUID AND ELECTROLYTE IMBALANCES

View Set

Principles of Business, Marketing and Finance ALL UNITS

View Set

ACCT 201 Chapter 6 Cost Volume Profit Relationships

View Set

1.17.1 Programming with Karel Quiz

View Set

SOCI 102 - Social Construction (Chapter 5)

View Set

Urban Climate Chapter 2 - Concepts

View Set