4 Combinational Components

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "4 Combinational Components"

Transcription

1 Chapter 4 Combinational Components Page of 8 4 Combinational Components In constructing large digital circuits, instead of starting with the basic gates as building blocks, we often start with larger building blocks. As with man construction problems, it is much easier to build in a hierarchical fashion. In this chapter, we describe some combinational logic components that are often used as building blocks for large digital circuits. These components are usuall available in standard libraries. 4. Adder / Subtractor 4.. Full Adder To construct an adder for adding two binar numbers, X = x n- x 0 and Y = n- 0, we need to first consider the addition of a single bit slice x i with i, together with the carr-in bit c i from the previous bit position. The result from this addition is a sum bit s i and a carr-out bit c i+ for the next bit position. Hence, s i = x i + i + c i, and c i+ = if there is a carr from the addition to the next bit. The circuit for the addition of this single bit slice is known as a full adder (FA) and its truth table is shown in Figure. The equations for s i and c i+ are derived as follows: s i = x i '''c i + x i ' i c i ' + x i i 'c i ' + x i i c i = (x i ' i + x i i ')c i ' + (x i ' i ' + x i i )c i = (x i i )c i ' + (x i i )'c i = x i i c i c i+ = x i ' i c i + x i i 'c i + x i i c i ' + x i i c i = x i i (c i ' + c i ) + c i (x i ' i + x i i ') = x i i + c i (x i i ) From these two equations, we get the circuit for the full adder as shown in Figure. Figure shows the logic smbol for the full adder. The dataflow VHDL code for the full adder is shown in Figure Ripple Carr Adder The full adder is for adding two operands that are onl one bit wide. To add two operands that are, sa eight bits wide we connect eight full adders together in series. The resulting circuit, shown in Figure 3, is called a ripple carr adder for adding two eight-bit operands. Since the FA adds the three bits x i, i and c i together, we need to set c 0 to be 0 in order to perform the addition correctl. Moreover, c out is asserted when there is an overflow for an unsigned addition. x i i c i c i+ s i c i+ x i i c i x i i c i+ FA s i c i s i Figure. Full adder: truth table; circuit; logic smbol.

2 Chapter 4 Combinational Components Page 2 of 8 ENTITY FullAdder IS PORT(x: IN std_logic; : IN std_logic; cin: IN std_logic; sum: OUT std_logic; cout: OUT std_logic); END FullAdder; ARCHITECTURE Dataflow OF FullAdder IS signal m,m2,m4,m7 : std_logic ; m <= (not x AND not AND c); m2 <= (not x AND AND not c); m4 <= (x AND not AND not c); m7 <= (x AND AND c); sum <= m OR m2 OR m4 OR m7; cout <= (x AND ) OR (cin AND (x OR )); END Dataflow; Figure 2. Dataflow VHDL code for a -bit full adder. x 7 7 x 6 6 x 5 5 x 4 4 x 3 3 x 2 2 x x 0 0 c out FA c 7 FA c 6 FA c 5 FA c 4 FA c 3 FA c 2 FA c FA c 0 s 7 s 6 s 5 s 4 s 3 s 2 s s 0 Figure 3. Ripple carr adder Carr-Lookahead Adder The ripple carr adder is slow because the carr-in for each bit slice is dependent on the carr-out signal from the previous bit slice. So before bit slice i can output valid data, it must wait for bit slice i - to have valid data. In the carr-lookahead adder each bit slice eliminates this dependenc on the previous carr-out signal, and instead uses the values of the two operands X and Y directl to deduce the needed signals. This is possible from the following observations regarding the carr-out signal. For each bit slice i, the carr-out signal c i+ is asserted if either one of the following two conditions is true: x i = and i = or (x i = or i = ) and c i = In other words, c i+ = (x i i ) + [(x i + i ) c i ]. (4.) If we let and g i = x i i p i = x i + i,

3 Chapter 4 Combinational Components Page 3 of 8 then equation 4. can be rewritten as c i+ = g i + p i c i. (4.2) Using this general equation for c i+, we can recursivel expand it to get the equation for an bit slice i that is dependent onl on the two input operands X and Y, and c 0. Using this technique, we get the following carr equations for the first four bit slices: c = g 0 + p 0 c 0 (4.3) c 2 = g + p c = g + p (g 0 + p 0 c 0 ) = g + p g 0 + p p 0 c 0 (4.4) c 3 = g 2 + p 2 c 2 = g 2 + p 2 (g + p g 0 + p p 0 c 0 ) = g 2 + p 2 g + p 2 p g 0 + p 2 p p 0 c 0 (4.5) c 4 = g 3 + p 3 c 3 = g 3 + p 3 (g 2 + p 2 g + p 2 p g 0 + p 2 p p 0 c 0 ) = g 3 + p 3 g 2 + p 3 p 2 g + p 3 p 2 p g 0 + p 3 p 2 p p 0 c 0 (4.6) Note that each equation is translated to a three level combinational logic one level for generating the g i and p i, and two levels (sum-of-products) for generating the c i expression. The circuit for generating the carr-lookahead signals up to c 4 is shown in Figure 4. The full adder (FA) for the carr-lookahead adder can also be made simpler since it no longer required to generate the c out signal for the next bit slice. In other words, the c in signal for the FA now comes from the new carrlookahead circuit rather than from the c out signal of the previous bit slice. Thus, this full adder onl requires to generate the sum i signal. Figure 4 shows one bit slice of the carr-lookahead adder. For an n-bit carr-lookahead adder, we use n bit slices. These n bit slices are not connected in series as with the ripple-carr adder. x 3 3 x 2 2 x x 0 0 g 3 p 3 g 2 p 2 g p g 0 p 0 x i i x 0 -x i- 0 - i- c 0 carrlookahead circuit c i FA c 4 c 3 c 2 c sum i Figure 4. Circuit for generating the carr-lookahead signals c to c 4. One bit slice of the carr-lookahead adder.

4 Chapter 4 Combinational Components Page 4 of Full Subtractor We can construct a one-bit subtractor circuit similar to the method used for constructing the full adder. However, instead of the sum bit s i from the addition, we have a difference bit d i from the subtraction, and instead of having a carr-in and carr-out signals, we have a borrow-in (b i ) and borrow-out (b i+ ) signals. Hence, d i = x i - i - b i, and b i+ = if we need to borrow for the subtraction. The truth table for the full subtractor (FS) is shown in Figure 5, from which the equations (4.7) for d i and (4.8) for b i+ are derived. x i i x i i b i b i+ d i b i+ b i x i i b i+ FS d i b i Figure 5. Full subtractor: truth table; circuit; logic smbol. d i d i = x i '''b i + x i ' i b i ' + x i i 'b i ' + x i i b i = (x i ' i + x i i ')b i ' + (x i ' i ' + x i i )b i = (x i i )b i ' + (x i i )'b i = x i i b i (4.7) b i+ = x i ' i 'b i + x i ' i b i ' + x i ' i b i + x i i b i = x i 'b i ( i ' + i ) + x i ' i (b i ' + b i ) + i b i (x i ' + x i ) = x i 'b i + x i ' i + i b i (4.8) From these two equations, we get the circuit for the full subtractor as shown in Figure 5. Figure 5 shows the logic smbol for the full subtractor Adder / Subtractor Combination It turns out that instead of having to build a separate adder and subtractor units, we can modif the ripple-carr adder (or the carr-lookahead adder) slightl to perform both operations. The modified circuit performs subtraction b adding the negated value of the second operand. Recall that to negate a value in two s complement representation, we simpl invert all the bits from 0 to and vice versa, and then add a. In addition to the two input operands A and B, a select signal S is used to select which operation to perform according to the truth table in Figure 6. When the subtraction operation is selected, i.e. S =, the B operand needs to be inverted. Recalling that x = x', we can thus simpl flip the bits in B b performing the operation B S since S =. Finall, the addition of a is accomplished b setting the primar carr-in signal c 0 to. On the other hand, when the addition operation is selected, i.e. S = 0, the B operand will not be inverted b the XOR operation. In this case, we also want c 0 = S = 0. An 8-bit adder / subtractor combination circuit is shown in Figure 6 and the logic smbol in. The behavioral VHDL code is shown in Figure 7.

5 Chapter 4 Combinational Components Page 5 of 8 S Function Operation 0 Add F = A + B Subtract F = A + B' + S c out A B Adder/Subtractor F a 7 b 7 a 6 b 6 a 5 b 5 a 4 b 4 a 3 b 3 a 2 b 2 a b a 0 b 0 S c out FA c 7 FA c 6 FA c 5 FA c 4 FA c 3 FA c 2 FA c FA c 0 f 7 f 6 f 5 f 4 f 3 f 2 f f 0 Figure 6. Two s complement adder/subtractor combination: truth table; circuit; logic smbol. librar ieee; use ieee.std_logic_64.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; ENTITY AddSub IS GENERIC(n: NATURAL :=8); -- default number of bits = 8 PORT(A: IN std_logic_vector(n- downto 0); B: IN std_logic_vector(n- downto 0); subtract: IN std_logic; carr: OUT std_logic; sum: OUT std_logic_vector(n- downto 0)); END AddSub; ARCHITECTURE Behavioral OF AddSub IS -- temporar result with one extra bit for carr SIGNAL result: std_logic_vector(n downto 0); PROCESS(subtract, A, B) IF (subtract = '0') THEN -- addition --add the two operands with one extra bit for carr result <= ('0' & A)+('0' & B); sum <= result(n- downto 0); -- extract the n-bit result carr <= result(n); -- extract the carr bit from result ELSE -- subtraction result <= ('0' & A)-('0' & B); sum <= result(n- downto 0); -- extract the n-bit result carr <= result(n); END IF; END Behavioral; -- extract the borrow bit from result Figure 7. Behavioral VHDL code for an 8-bit adder / subtractor combination component.

6 Chapter 4 Combinational Components Page 6 of Arithmetic Logic Unit The arithmetic logic unit (ALU) is one of the main component inside a microprocessor that is responsible for performing arithmetic and logic operations such as addition, subtraction, logical AND, and logical OR. It turns out that in constructing the circuit for the ALU, we can use the same idea as for constructing the adder/subtractor combination circuit discussed in the previous section. Again, we will use the ripple-carr adder as the building block and then insert some combinational logic circuitr in front of the two input operands to each full adder. This wa, the primar inputs will be modified accordingl depending on the operations being performed before being passed to the full adder. The general overall circuit for a 4-bit ALU is shown in Figure 8. As we can see in the figure, the two combinational circuits in front of the full adder (FA) are labeled LE and AE. The LE (for logic extender) is for manipulating all logical operations, whereas, the AE (for arithmetic extender) is for manipulating all arithmetic operations. The LE performs the actual logical operations on the two primar operands a i and b i before passing the result to the first operand x i of the FA. On the other hand, the AE onl modifies the second operand b i and passes it to the second operand i of the FA where the actual arithmetic operation is performed. a 3 b 3 a 2 b 2 a b a 0 b 0 S 2 S S 0 LE AE LE AE LE AE LE AE x 3 3 x 2 2 x x 0 0 Unsigned Overflow c 4 FA c 3 FA c 2 FA c FA c 0 CE Signed Overflow f 3 f 2 f f 0 Figure 8. 4-bit ALU circuit. We saw from the adder/subtractor circuit that to perform additions and subtractions, we onl need to modif i, the second operand to the FA, so that all operations can be done with additions. Thus, the AE onl takes the second operand of the primar input b i as its input and modifies the value depending on the operation being performed. Its output is i and is connected to the second operand input of the FA. As in the adder/subtractor circuit, the addition is performed in the FA. When arithmetic operations are being performed, the LE must pass the first operand unchanged from the primar input a i to x i for the FA. Unlike the AE where it onl modifies the operand, the LE performs the actual logical operations. Thus, for example, if we want to perform the operation A OR B, the LE for each bit slice will take the corresponding bits a i and b i, and OR them together. Hence, one bit from both operands, a i and b i, are inputs to the LE. The output of the LE is passed to the first operand x i of the FA. Since this value is alread the result of the logical operation, we do not want the FA to modif it, but to simpl pass it on to the primar output f i. This is accomplished b setting both the second operand i of the FA, and c 0 to zero since adding a zero will not change the resulting value. The combinational circuit labeled CE is for modifing the primar carr-in signal c 0 so that arithmetic operations are performed correctl. Logical operations do not use the carr signal, so c 0 is set to zero for all logical operations. In the figure, three select lines, S 2, S, and S 0 are used to select the operations of the ALU. The S 2 line selects between the arithmetic operations and the logical operations. When S 2 =, arithmetic operations are selected, and

7 Chapter 4 Combinational Components Page 7 of 8 when S 2 = 0, logical operations are selected. The two select lines S and S 0 allow the selection of one among four possible arithmetic operations or four logical operations. Thus, our ALU circuit can implement eight different operations. Suppose that the operations that we want to implement in our ALU are as defined in Figure 9. The X column shows the values that the LE must generate for the different operations. The Y column shows the values that the AE must generate. The c 0 column shows the carr signals that the CE must generate. For example, for the pass through operation, the value of A is passed through without an modifications to X. For the AND operation, X gets the result of A AND B. As mentioned before, both Y and c 0 are set to zero for all the logical operations because we do not want the FA to change the results. The FA is onl used to pass the results from the LE straight through to the output F. For the subtraction operation, instead of subtracting B, we want to add B. Changing B to B in two s complement format requires flipping the bits of B and then adding a one. Thus, Y gets the inverse of B and the one is added through the carr-in c 0. To increment A, we set Y to all zeros and add the one through the carr-in c 0. To decrement A, we add a negative one instead. Negative one in two s complement format is a bit string with all one s. Hence, we set Y to all one s and the carr-in c 0 to zero. For all the arithmetic operations, we need the first operand A unchanged for the FA. Thus, X gets the value of A for all arithmetic operations. Figure 9, and (d) show the truth tables for the LE, AE and CE respectivel. The LE circuit is derived from the x i column of Figure 9; the AE circuit is derived from the i column of Figure 9; and the CE circuit is derived from the c 0 column of Figure 9(d). The K- maps, equations, and schematics for these three circuits are shown in Figure 0. Notice that x i is dependent on five variables, S 2, S, S 0, a i, and b i, whereas, i is dependent on onl four variables, S 2, S, S 0, and b i, and c 0 is dependent on onl the three select lines S 2, S, and S 0. The behavioral VHDL code for the ALU is shown in Figure and the simulation waveform for all operations using the two inputs 5 and 3 is shown in Figure 2. S 2 S S 0 Operation Name Operation X (LE) Y (AE) c 0 (CE) Pass through A Pass A to output A AND A AND B A AND B OR A OR B A OR B NOT A A' A' Addition A + B A B 0 0 Subtraction A B A B 0 Increment A A + A all 0 s Decrement A A A all s 0 S 2 S S 0 x i S 2 S S 0 b i i S 2 S S 0 c a i a i b i a i + b i a i ' a i (d) Figure 9. ALU operations: function table; LE truth table; AE truth table; (d) CE truth table.

8 Chapter 4 Combinational Components Page 8 of 8 a i b i x i S 2 = 0 a i b i S S S 2 = S 2 S S LE x i x i = S 2 a i + S 0 'a i + S 'a i b i + S 2 'S S 0 a i ' + S 2 'S a i ' b i = S 2 a i + S 0 'a i + S 'a i b i + S 2 'S a i ' (S 0 + b i ) b i i S S 0 b i S 0 S 2 S 2 S AE i i = S 2 S S 0 + S 2 S 0 b i ' + S 2 S 'S 0 'b i = S 2 S 0 (S + b i ') + S 2 S 'S 0 'b i c 0 S S S 2 S 0 S c 0 CE S 2 c 0 = S 2 S 'S 0 + S 2 S S 0 ' = S 2 (S S 0 ) Figure 0. K-maps, equations, and schematics for: LE; AE; and CE.

9 Chapter 4 Combinational Components Page 9 of 8 LIBRARY ieee; USE ieee.std_logic_64.all; -- The following package is needed so that the STD_LOGIC_VECTOR signals -- A and B can be used in unsigned arithmetic operations. USE ieee.std_logic_unsigned.all; ENTITY alu IS PORT (S: IN std_logic_vector(2 downto 0); -- select for operations A, B: IN std_logic_vector(3 downto 0); -- input operands F: OUT std_logic_vector(3 downto 0)); -- output END alu; ARCHITECTURE Behavior OF alu IS PROCESS(S, A, B) CASE S IS WHEN "000" => -- pass A through F <= A; WHEN "00" => -- AND F <= A AND B; WHEN "00" => -- OR F <= A OR B; WHEN "0" => -- NOT A F <= NOT A; WHEN "00" => -- add F <= A + B; WHEN "0" => -- subtract F <= A - B; WHEN "0" => -- increment F <= A + ; WHEN OTHERS => -- decrement F <= A - ; END CASE; END PROCESS; END Behavior; Figure. Behavioral VHDL code for an ALU. Pass A AND OR NOT A Add Subtract Increment Decrement Figure 2. Waveform generated for the two input operands 5 and 3 for all of the eight operations.

10 Chapter 4 Combinational Components Page 0 of Multiplexer The multiplexer, or mux for short, allows the selection of one input signal among n signals, where n > and is usuall a power of two. Select lines connected to the multiplexer determine which input signal is selected and passed to the output of the multiplexer. In general, an n-to- multiplexer has n input lines, s = log 2 n select lines, and one output line. For a 2-to- multiplexer, there is one select line s to select between the two inputs, d 0 and d. When s = 0, the input line d 0 is selected, and the data present on d 0 is passed to the output. When s =, the input line d is selected and the data on d is passed to. The truth table, circuit and the logic smbol for a 2-to- mux are shown in Figure 3. Constructing a larger size mux such as the 8-to- mux can be done similarl. Besides having eight input lines, the 8-to- mux of course has three select lines. Depending on the value of the three select lines, one of the eight input lines will be selected and the data on that input line will be passed to the output. For example, if the value of the select lines is 0, then the input line d 5 is selected and so the data that is present on d 5 will be passed to the output. The truth table, circuit, and logic smbol for the 8-to- mux is shown in Figure 4. Larger multiplexers can also be constructed from smaller multiplexers. For example, an 8-to- mux can be constructed using seven 2-to- muxes as shown in Figure 5. Another wa to implement an 8-to- mux is to use a 3-to-8 decoder to enable one of the eight AND gates as shown in Figure 5. The behavioral and dataflow VHDL code for an 8-bit wide 4-to- multiplexer is shown in Figure 6. Two different implementations of the same multiplexer is shown, the first implementation uses a process statement and the second uses a concurrent assignment statement. s d d Figure 3. A 2-to- multiplexer: truth table; circuit; logic smbol. d 0 s d s d d 0 0 d 7 d 6 d 5 d 4 d 3 d 2 d d 0 s 2 s 2 s s d d 0 0 d 2 0 d d 4 0 d 5 0 d 6 d 7 s s 0 s 2 s s 0 d d 0 d 2 d 3 d 4 d 5 d 6 d Figure 4. An 8-to- multiplexer: truth table; circuit; logic smbol.

11 Chapter 4 Combinational Components Page of 8 d 6 d 7 d 4 d 5 d 2 d 3 d 0 d s s s s s 0 s s 2 Decoder d 7 d 6 d 5 d 4 d 3 d 2 d d 0 s 0 0 s 0 s s s 2 0 s Figure 5. An 8-to- multiplexer implemented using: seven 2-to- multiplexers; a decoder. -- A 4-to- 8-bit multiplexer LIBRARY ieee; USE IEEE.std_logic_64.all; ENTITY Multiplexer IS PORT(S: IN std_logic_vector( downto 0); -- select lines D0, D, D2, D3: IN std_logic_vector(7 downto 0); -- data bus input Y: OUT std_logic_vector(7 downto 0)); -- data bus output END Multiplexer; -- using a process statement ARCHITECTURE Behavioral OF Multiplexer IS PROCESS (S,D0,D,D2,D3) CASE S IS WHEN "00" => Y <= D0; WHEN "0" => Y <= D; WHEN "0" => Y <= D2; WHEN "" => Y <= D3; WHEN OTHERS => Y <= (OTHERS => 'U'); END CASE; END PROCESS; END Behavioral; -- using a concurrent assignment statement ARCHITECTURE Dataflow OF Multiplexer IS WITH S SELECT Y <= D0 WHEN "00", D WHEN "0", D2 WHEN "0", D3 WHEN "", (OTHERS => 'U') WHEN OTHERS; END Dataflow; -- 8-bit vector of U -- 8-bit vector of U Figure 6. VHDL code for an 8-bit wide 4-to- multiplexer.

12 Chapter 4 Combinational Components Page 2 of Tri-state Buffer A tri-state buffer, as the name suggests, has three states: 0, and a third state denoted b Z. The value Z represents a high-impedance state, which for all practical purposes acts like a switch that is opened or a wire that is disconnected. A tri-state buffer is used to connect devices to the same bus. A bus, of course, is one or more wire for transferring signals. If two or more devices are connected directl to a bus without using tri-state buffers, signals will get corrupted on the bus because the devices are alwas outputting either a 0 or a. However, with a tri-state buffer in between, devices that do not need to use the bus can disable the tri-state buffer so that it acts as if those devices are phsicall disconnected from the bus. At an one time, onl one active device will have its tri-state buffers enabled and thus use the bus. The truth table and smbol for the tri-state buffer is shown in Figure 7 and. The enable pin E turns the buffer on or off. When E is de-asserted with a 0, the tri-state buffer is disabled and the output is in its highimpedance Z state. When E is asserted with a, the buffer is enabled and the output follows the input d. The internal circuit for the tri-state buffer uses two discrete transistors in conjunction with basic gates to produce the high-impedance state. The circuit is shown in Figure 7. In order to understand how this circuit works, we need to understand how the two CMOS transistors operate and this is discussed in detail in section??. E Vcc E 0 Z d E d d Figure 7. Tri-state buffer: truth table; logic smbol; circuit. In Figure 7, the top p-mos transistor is turned on with a 0. When it is on, a signal from Vcc passes down through the transistor and output has a value. Conversel, the bottom n-mos transistor is turned on with a. When it is on, a 0 signal from ground passes up through the transistor to output. For both transistors, when the are turned off, their outputs are in the Z state. When E = 0, the output of the NAND gate is a regardless of what the other input is, and so the top p-mos transistor is turned off. Similarl, the output of the NOR gate is a 0, and so the bottom n-mos transistor is also turned off. Thus, when E = 0, both transistors are off and so the output is in the Z state. When E =, the outputs of both the NAND and NOR gates are equal to d'. So if d = 0, the output of the two gates are and so the bottom transistor is turned on while the top transistor is turned off. Thus will have the value 0, which is equal to d. On the other hand, if d =, the top transistor is turned on while the bottom transistor is turned off, and will have the value. The behavioral VHDL code for an 8-bit wide tri-state buffer is shown in Figure Decoder A decoder, also known as a demultiplexer, asserts one out of n lines depending on the value of an m bit binar number. In general, an m-to-n decoder has n output lines Y n-,, Y 0, and m = log 2 n input lines A m-,, A 0. In addition, it has an enable line E for enabling the decoder. When the decoder is disabled, all the output lines are deasserted. When the decoder is enabled, then the output line whose index is equal to the value of the input binar address is asserted. For example, for a 3-to-8 decoder, if the input address is 0, then the output line Y 5 is asserted (equals if active high) while the rest of the output lines are de-asserted. A decoder is used in a sstem having multiple components and onl one component is selected or enabled at an one time. For example, in a large memor sstem with multiple memor chips, onl one memor chip is enabled at a time. One output line from the decoder is connected to the enable input on each memor chip. An address presented to the decoder will thus enable that corresponding memor chip.

13 Chapter 4 Combinational Components Page 3 of 8 LIBRARY ieee; USE IEEE.std_logic_64.all; ENTITY TriState_Buffer IS PORT(E: IN std_logic; d: IN std_logic_vector(7 downto 0); : OUT std_logic_vector(7 downto 0)); END TriState_Buffer; ARCHITECTURE Behavioral OF TriState_Buffer IS PROCESS (E, d) -- get error message if no d IF (E = '') THEN <= d; ELSE <= (OTHERS => 'Z'); END IF; END PROCESS; END Behavioral; Figure 8. VHDL code for an 8-bit wide tri-state buffer. -- to get 8 Z values The truth table, circuit and logic smbol for a 3-to-8 decoder are shown in Figure 9. Similar to a multiplexer where a larger mux can be implemented using several smaller muxes, a larger decoder can also be implemented using several smaller decoders. For example, Figure 20 uses seven -to-2 decoders to implement a 3-to-8 decoder. The behavioral VHDL code for a 3-to-8 decoder is shown in Figure 2. E A 2 E A 2 A A 0 Y 7 Y 6 Y 5 Y 4 Y 3 Y 2 Y Y A A 0 Y 7 Y 6 Y 5 Y 4 Y 3 Y 2 Y Y 0 A 2 A A 0 E Y 2 Y Y 0 Y 3 Y 4 Y 5 Y 6 Y 7 Figure 9. A 3-to-8 decoder: truth table; circuit; logic smbol.

14 Chapter 4 Combinational Components Page 4 of 8 E A 2 A A 0 E 0 E 0 E 0 E 0 E 0 E 0 E 0 Y 7 Y 6 Y 5 Y 4 Y 3 Y 2 Y Y 0 Figure 20. A 3-to-8 decoder implemented with seven -to-2 decoders -- A 3-to-8 decoder LIBRARY ieee; USE IEEE.std_logic_64.all; ENTITY Decoder IS PORT(E: IN std_logic; -- enable A: IN std_logic_vector(2 downto 0); -- 3 bit address Y: OUT std_logic_vector(7 downto 0)); -- data bus output END Decoder; ARCHITECTURE Behavioral OF Decoder IS PROCESS (E, A) IF (E = '0') THEN -- disabled Y <= (OTHERS => '0'); -- 8-bit vector of 0 ELSE CASE A IS -- enabled WHEN "000" => Y <= " "; WHEN "00" => Y <= " "; WHEN "00" => Y <= " "; WHEN "0" => Y <= " "; WHEN "00" => Y <= " "; WHEN "0" => Y <= " "; WHEN "0" => Y <= " "; WHEN "" => Y <= " "; END CASE; END IF; END PROCESS; END Behavioral; Figure 2. Behavioral VHDL code for a 3-to-8 decoder. 4.6 Encoder

15 Chapter 4 Combinational Components Page 5 of Comparator Quite often we need to compare two values for their arithmetic relationship (equal, greater, less than, etc.). A comparator is a circuit that compares two binar words and indicates whether the relationship is true or not. To compare whether a value is equal or not equal to a constant value, a simple AND gate can be used. For example, to compare a 4-bit variable x with the constant 3, the circuit in Figure 22 can be used. The AND gate outputs a when the input is equal to the value 3. The XOR and XNOR gates can be used for comparing for inequalit and equalit respectivel between two values. The XOR gate outputs a when the two input values are different. A 4-bit inequalit comparator is shown in Figure 22. The circuit outputs a if x To compare for the greater or less than relationships, we can construct a truth table and build the circuit from it. For example, to compare whether a 3-bit value x is less than five, we get the following truth table. The circuit is shown in Figure 22. x 2 x x 0 F ( < 5 ) x 3 x 2 x x 0 x 3 3 x 2 x 2 x x 0 2 x F F x 0 0 Figure 22. Simple comparators for x = 3; x ; x < 5. F Instead of constructing a comparator for a fixed number of bits for the input values, we can construct an iterative circuit b constructing a -bit slice comparator and then dais chaining them together for as man bits as is needed. The -bit slice comparator will have, in addition to the two operand bits x i and i, a p i bit that keeps track of whether all the previous bit pairs compared so far are true or not for that particular relationship. The circuit outputs a if p i = and the relationship is true for the current bit pair x i and i. Figure 23 shows a -bit slice comparator for equalit. If the current bit pair x i and i are equal, the XNOR gate will output a. Hence, p i+ = if the current bit pair is equal and the previous bit pair p i =. To obtain a 4-bit iterative equalit comparator, we connect four -bit equalit comparators in series as shown in Figure 23. The initial p 0 bit is set to a. Thus, if all four bit-pairs are equal, then the last bit, p 4 will be a, otherwise, p 4 will be a 0. x i i EQ x 3 3 x 2 2 x x 0 0 p pi i+ Figure 23. Iterative comparators: -bit slice for x i = i ; 4-bit x =. p 4 EQ p 3 EQ p 2 EQ p EQ p 0 ''

16 Chapter 4 Combinational Components Page 6 of Shifter / Rotator The shifter and the rotator are used for shifting bits in a binar word one position either to the left or to the right. The difference between the shifter and the rotator is in how the end bits are shifted in or out. The six different operations for the shifter / rotator are summarized in Figure 24. For each bit position, a multiplexer is used to move a bit from either the left or right to the current bit position. The size of the multiplexer will determine the number of operations that can be implemented. For example, we can use a 4-to- mux to implement the four operations as specified b the table in Figure 25. Two select lines, S and S 0, are needed to select between the four different operations. For a 4-bit operand, we will need to use four 4-to- muxes as shown in Figure 25. How the inputs to the muxes are connected will depend on the given operations. In the example, when S = S 0 = 0, we want to pass the bit straight through without shifting, i.e. we want the value for in i to pass to out i. Given S = S 0 = 0, d 0 of the mux is selected, hence, in i is connected to d 0 of mux i which outputs to out i. For S = 0 and S 0 =, we want to shift left, i.e. we want the value for in i to pass to out i+. With S = 0 and S 0 =, d of the mux is selected, hence, in i is connected to d of mux i+ which outputs to out i+. For this selection, we also want to shift in a bit, so d of mux 0 is connected directl to a. The behavioral VHDL code for an 8-bit shifter / rotator having the functions as defined in Figure 25 is shown in Figure 26. Operation Comment Example Shift left with 0 Shift bits to the left one position. The leftmost bit is discarded and the rightmost bit is filled with a Shift left with Shift right with 0 Shift right with Rotate left Rotate right Same as above except that the rightmost bit is filled with a. Shift bits to the right one position. The rightmost bit is discarded and the leftmost bit is filled with a 0. Same as above except that the leftmost bit is filled with a. Shift bits to the left one position. The leftmost bit is moved to the rightmost bit position. Shift bits to the right one position. The rightmost bit is moved to the leftmost bit position Figure 24. Shifter and rotator operations.

17 Chapter 4 Combinational Components Page 7 of 8 S S 0 Operation 0 0 Pass through 0 Shift left with 0 Shift right with 0 Rotate right '0' 3 s s0 in 3 in 2 in in mux 3 3 s s0 2 0 mux 2 3 s s0 2 0 mux 3 s s0 2 0 mux 0 '' S S 0 out 3 out 2 out out 0 S S 0 in 3 in 2 in in 0 4-bit shifter/rotator out 3 out 2 out out 0 Figure 25. A 4-bit shifter / rotator: operation table; circuit; logic smbol. LIBRARY ieee; USE ieee.std_logic_64.all; USE ieee.std_logic_unsigned.all; ENTITY shifter IS PORT (SHSel: IN std_logic_vector( downto 0); -- select for operations input: IN std_logic_vector(7 downto 0); -- input output: OUT std_logic_vector(7 downto 0)); -- output END shifter; ARCHITECTURE Behavior OF shifter IS process(shsel, input) begin CASE SHSel IS WHEN "00" => -- pass through output <= input; WHEN "0" => -- shift left with output <= input(6 downto 0) & ''; WHEN "0" => -- shift right with 0 output <= '0' & input(7 downto ); WHEN "" => -- rotate right output <= input(0) & input(7 downto ); END CASE; END PROCESS; END Behavior; Figure 26. Behavioral VHDL code for an 8-bit shifter / rotator having the operations as defined in Figure 25.

18 Chapter 4 Combinational Components Page 8 of Multiplier 4.0 Using ROMs to Implement Boolean Functions 4. Using PLAs to Implement Boolean Functions

5 Combinatorial Components. 5.0 Full adder. Full subtractor

5 Combinatorial Components. 5.0 Full adder. Full subtractor 5 Combatorial Components Use for data transformation, manipulation, terconnection, and for control: arithmetic operations - addition, subtraction, multiplication and division. logic operations - AND, OR,

More information

Sistemas Digitais I LESI - 2º ano

Sistemas Digitais I LESI - 2º ano Sistemas Digitais I LESI - 2º ano Lesson 6 - Combinational Design Practices Prof. João Miguel Fernandes (miguel@di.uminho.pt) Dept. Informática UNIVERSIDADE DO MINHO ESCOLA DE ENGENHARIA - PLDs (1) - The

More information

Digital Systems Design

Digital Systems Design Digital Systems Design Review of Combinatorial Circuit Building Blocks: VHDL for Combinational Circuits Dr. D. J. Jackson Lecture 3-1 Introduction to VHDL Designer writes a logic circuit description in

More information

ECE 3401 Lecture 9. VHDL for Arithmetic Functions and Circuits

ECE 3401 Lecture 9. VHDL for Arithmetic Functions and Circuits ECE 3401 Lecture 9 VHDL for Arithmetic Functions and Circuits Outline Arithmetic Functions and Circuits: operate on binary vectors, use the same sub-function in each bit position Adders Multipliers Others

More information

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language Chapter 4 Register Transfer and Microoperations Section 4.1 Register Transfer Language Digital systems are composed of modules that are constructed from digital components, such as registers, decoders,

More information

Exclusive OR/Exclusive NOR (XOR/XNOR)

Exclusive OR/Exclusive NOR (XOR/XNOR) Exclusive OR/Exclusive NOR (XOR/XNOR) XOR and XNOR are useful logic functions. Both have two or more inputs. The truth table for two inputs is shown at right. a XOR b = 1 if and only if (iff) a b. a XNOR

More information

Chapter 4 Combinational Logic

Chapter 4 Combinational Logic Chapter 4 Combinational Logic Chih-Tsun Huang ( 黃稚存 ) Department of Computer Science National Tsing Hua University Outline Introduction Combinational Circuits Analysis Procedure Design Procedure Binary

More information

Experiment 5. Arithmetic Logic Unit (ALU)

Experiment 5. Arithmetic Logic Unit (ALU) Experiment 5 Arithmetic Logic Unit (ALU) Objectives: To implement and test the circuits which constitute the arithmetic logic circuit (ALU). Background Information: The basic blocks of a computer are central

More information

Binary Adder. sum of 2 binary numbers can be larger than either number need a carry-out to store the overflow

Binary Adder. sum of 2 binary numbers can be larger than either number need a carry-out to store the overflow Binary Addition single bit addition Binary Adder sum of 2 binary numbers can be larger than either number need a carry-out to store the overflow Half-Adder 2 inputs (x and y) and 2 outputs (sum and carry)

More information

Chapter 4. Combinational Logic. Outline. ! Combinational Circuits. ! Analysis and Design Procedures. ! Binary Adders. ! Other Arithmetic Circuits

Chapter 4. Combinational Logic. Outline. ! Combinational Circuits. ! Analysis and Design Procedures. ! Binary Adders. ! Other Arithmetic Circuits Chapter 4 Combinational Logic 4- Outline! Combinational Circuits! Analysis and Design Procedures! Binary Adders! Other Arithmetic Circuits! Decoders and Encoders! Multiplexers 4-2 Combinational v.s Sequential

More information

Fundamentals of Computer Systems

Fundamentals of Computer Systems Fundamentals of Computer Systems Combinational Logic Martha A. Kim Columbia University Fall 23 / Combinational Circuits Combinational circuits are stateless. Their output is a function only of the current

More information

FORDHAM UNIVERSITY CISC 3593. Dept. of Computer and Info. Science Spring, 2011. The Binary Adder

FORDHAM UNIVERSITY CISC 3593. Dept. of Computer and Info. Science Spring, 2011. The Binary Adder FORDHAM UNIVERITY CIC 3593 Fordham College Lincoln Center Computer Organization Dept. of Computer and Info. cience pring, 2011 1 Introduction The Binar Adder The binar adder circuit is an important building

More information

Basics of Digital Logic Design

Basics of Digital Logic Design CSE 675.2: Introduction to Computer Architecture Basics of Digital Logic Design Presentation D Study: B., B2, B.3 Slides by Gojko Babi From transistors to chips Chips from the bottom up: Basic building

More information

Binary Adders: Half Adders and Full Adders

Binary Adders: Half Adders and Full Adders Binary Adders: Half Adders and Full Adders In this set of slides, we present the two basic types of adders: 1. Half adders, and 2. Full adders. Each type of adder functions to add two binary bits. In order

More information

Chapter 4 Combinational Logic

Chapter 4 Combinational Logic EEA051 - Digital Logic 數位邏輯 Chapter 4 Combinational Logic 吳俊興國立高雄大學資訊工程學系 November 2005 Chapter 4 Combinational Logic 4-1 Combinational Circuits 4-2 Analysis Procedure 4-3 Design Procedure 4-4 Binary Adder-Subtractor

More information

Timing Considerations with VHDL-Based Designs

Timing Considerations with VHDL-Based Designs Timing Considerations with VHDL-Based Designs This tutorial describes how Altera s Quartus R II software deals with the timing issues in designs based on the VHDL hardware description language. It discusses

More information

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Systems I: Computer Organization and Architecture Lecture 9 - Register Transfer and Microoperations Microoperations Digital systems are modular in nature, with modules containing registers, decoders, arithmetic

More information

Representing Values in VHDL

Representing Values in VHDL EE313 - VHDL Part II Representing Values in VHDL Developing code requires entering data of many types. Whether you are initializing signals or typing in operands for comparison statements, it is important

More information

Combinational Circuits #1

Combinational Circuits #1 ECE 322 Digital Design with VHDL Combinational Circuits # Lecture 8 Combinational Circuit Building Blocks n Commonly used combinational building blocks in design o larger circuits: Ø Multiplexers Ø Demultiplexers

More information

Tutorial 5 Special Combinational Logic Circuit

Tutorial 5 Special Combinational Logic Circuit Tutorial 5 Special Combinational Logic Circuit Question 1 a) What is the function of an adder circuit? b) A half-adder adds two binary bits, true or false? c) A half-adder has a sum output only, true or

More information

SAMPLE OF THE STUDY MATERIAL PART OF CHAPTER 5. Combinational & Sequential Circuits

SAMPLE OF THE STUDY MATERIAL PART OF CHAPTER 5. Combinational & Sequential Circuits SAMPLE OF THE STUD MATERIAL PART OF CHAPTER 5 5. Introduction Digital circuits can be classified into two types: Combinational digital circuits and Sequential digital circuits. 5.2 Combinational Digital

More information

Laboratory Exercise 1

Laboratory Exercise 1 Laboratory Exercise 1 Switches, Lights, and Multiplexers The purpose of this exercise is to learn how to connect simple input and output devices to an FPGA chip and implement a circuit that uses these

More information

M U LT I P L E X E R S. The selection of a particular input line is controlled by a set of selection lines.

M U LT I P L E X E R S. The selection of a particular input line is controlled by a set of selection lines. M U LT I P L E X E R S A multiplexer is a combinational circuit that selects binary information from one of many input lines and directs it to a single output line. The selection of a particular input

More information

Combinational Logic Building Blocks and Bus Structure

Combinational Logic Building Blocks and Bus Structure Combinational Logic Building Blocks and Bus Structure ECE 5A Winter 0 Reading Assignment Brown and Vranesic Implementation Technology.8 Practical Aspects.8.7 Passing s and 0s Through Transistor Switches.8.8

More information

6. SEQUENTIAL AND CONCURRENT STATEMENTS IN THE VHDL LANGUAGE

6. SEQUENTIAL AND CONCURRENT STATEMENTS IN THE VHDL LANGUAGE Structure of Computer Systems Laboratory No. 6 1 6. SEQUENTIAL AND CONCURRENT STATEMENTS IN THE VHDL LANGUAGE A VHDL description has two domains: a sequential domain and a concurrent domain. The sequential

More information

Figure 2.4(f): A T flip flop

Figure 2.4(f): A T flip flop If the T input is in 0 state (i.e., J = K = 0) prior to a clock pulse, the Q output will not change with the clock pulse. On the other hand, if the T input is in 1 state (i.e., J = K = 1) prior to a clock

More information

NEW adder cells are useful for designing larger circuits despite increase in transistor count by four per cell.

NEW adder cells are useful for designing larger circuits despite increase in transistor count by four per cell. CHAPTER 4 THE ADDER The adder is one of the most critical components of a processor, as it is used in the Arithmetic Logic Unit (ALU), in the floating-point unit and for address generation in case of cache

More information

Let s put together a Manual Processor

Let s put together a Manual Processor Lecture 14 Let s put together a Manual Processor Hardware Lecture 14 Slide 1 The processor Inside every computer there is at least one processor which can take an instruction, some operands and produce

More information

Design with Multiplexers

Design with Multiplexers Design with Multiplexers Consider the following design, taken from the 5 th edition of my textbook. This is a correct implementation of the Carry Out of a Full Adder. In terms of Boolean expressions, this

More information

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng Digital Logic Design Basics Combinational Circuits Sequential Circuits Pu-Jen Cheng Adapted from the slides prepared by S. Dandamudi for the book, Fundamentals of Computer Organization and Design. Introduction

More information

4 Operations On Data

4 Operations On Data 4 Operations On Data 4.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, students should be able to: List the three categories of operations performed on

More information

Arithmetic-logic units

Arithmetic-logic units Arithmetic-logic units An arithmetic-logic unit, or ALU, performs many different arithmetic and logic operations. The ALU is the heart of a processor you could say that everything else in the CPU is there

More information

Boolean Algebra and Digital Circuits Part 3: Logic Gates and Combinatorial Circuits

Boolean Algebra and Digital Circuits Part 3: Logic Gates and Combinatorial Circuits Boolean Algebra and Digital Circuits Part 3: Logic Gates and Combinatorial Circuits Logic Gates a gate implements a simple boolean function such as AND, OR or NOT constructed using a few transistors basic

More information

Review of Gates in Digital Electronics

Review of Gates in Digital Electronics pp. 22-26 Krishi Sanskriti Publications http://www.krishisanskriti.org/areee.html Review of Gates in Digital Electronics Divya Aggarwal Student, Department of Physics, University of Delhi Abstract: Digital

More information

l What have discussed up until now & why: l C Programming language l More low-level then Java. l Better idea about what s really going on.

l What have discussed up until now & why: l C Programming language l More low-level then Java. l Better idea about what s really going on. CS211 Computer Architecture l Topics Digital Logic l Transistors (Design & Types) l Logic Gates l Combinational Circuits l K-Maps Class Checkpoint l What have discussed up until now & why: l C Programming

More information

NUMBERING SYSTEMS C HAPTER 1.0 INTRODUCTION 1.1 A REVIEW OF THE DECIMAL SYSTEM 1.2 BINARY NUMBERING SYSTEM

NUMBERING SYSTEMS C HAPTER 1.0 INTRODUCTION 1.1 A REVIEW OF THE DECIMAL SYSTEM 1.2 BINARY NUMBERING SYSTEM 12 Digital Principles Switching Theory C HAPTER 1 NUMBERING SYSTEMS 1.0 INTRODUCTION Inside today s computers, data is represented as 1 s and 0 s. These 1 s and 0 s might be stored magnetically on a disk,

More information

COMBINATIONAL CIRCUITS

COMBINATIONAL CIRCUITS COMBINATIONAL CIRCUITS http://www.tutorialspoint.com/computer_logical_organization/combinational_circuits.htm Copyright tutorialspoint.com Combinational circuit is a circuit in which we combine the different

More information

Chapter 4. Arithmetic for Computers

Chapter 4. Arithmetic for Computers Chapter 4 Arithmetic for Computers Arithmetic Where we've been: Performance (seconds, cycles, instructions) What's up ahead: Implementing the Architecture operation a b 32 32 ALU 32 result 2 Constructing

More information

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-378: Digital Logic and Microprocessor Design Winter 2015.

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-378: Digital Logic and Microprocessor Design Winter 2015. ECE-378: Digital Logic and Microprocessor Design Winter 5 UNSIGNED INTEGER NUMBERS Notes - Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digit-by-digit representation of a positive

More information

2 Boolean Arithmetic. Counting is the religion of this generation, its hope and salvation. Gertrude Stein ( )

2 Boolean Arithmetic. Counting is the religion of this generation, its hope and salvation. Gertrude Stein ( ) 2 Boolean Arithmetic Counting is the religion of this generation, its hope and salvation. Gertrude Stein (1874 1946) In this chapter we build gate logic designs that represent numbers and perform arithmetic

More information

Lab 5 Fully Functional Stop Watch

Lab 5 Fully Functional Stop Watch 1 Objective Lab 5 Fully Functional Stop Watch Build a fully functional stopwatch. 2 Introduction The overall goal of this lab is to build a fully functional stopwatch. This system will involve many smaller

More information

CS/EE 260 Homework 5 Solutions Spring 2000

CS/EE 260 Homework 5 Solutions Spring 2000 CS/EE 6 Homework 5 Solutions Spring (MK -) Construct a -to- line multiplexer with three 4-to- line multiplexers The multiplexers should be interconnected and inputs labeled so that the selection codes

More information

1.10 (a) Effects of logic gates AND, OR, NOT on binary signals in a processor

1.10 (a) Effects of logic gates AND, OR, NOT on binary signals in a processor Chapter 1.10 Logic Gates 1.10 (a) Effects of logic gates AND, OR, NOT on binary signals in a processor Microprocessors are the central hardware that runs computers. There are several components that make

More information

RTL Design. Design Strategies. Structural Design. Behavioral Design. manufacturing processes and different devices with a minimum of redesign.

RTL Design. Design Strategies. Structural Design. Behavioral Design. manufacturing processes and different devices with a minimum of redesign. ELEC 379 : DESIGN OF DIGITAL AND MICROCOMPUTER SYSTEMS 1998/99 WINTER SESSION, TERM 2 RTL Design This lecture describes an approach to logic design called Register Transfer Level (RTL) or dataflow design.

More information

Combinational Logic Design

Combinational Logic Design Chapter 4 Combinational Logic Design The foundations for the design of digital logic circuits were established in the preceding chapters. The elements of Boolean algebra (two-element switching algebra

More information

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING Lab Manual Digital Electronics Laboratory (EC-39) BACHELOR OF TECHNOLOGY Subject Code: EC 39 Subject Name: Digital Electronics Laboratory Teaching

More information

Arithmetic Packages- Introduction

Arithmetic Packages- Introduction Arithmetic Packages- Introduction It would be very painful if when building a counter we had to think about all the internals We need an adder etc.» How do we build the adder? Would be much better if we

More information

6. Combinational Circuits. Building Blocks. Digital Circuits. Wires. Q. What is a digital system? A. Digital: signals are 0 or 1.

6. Combinational Circuits. Building Blocks. Digital Circuits. Wires. Q. What is a digital system? A. Digital: signals are 0 or 1. Digital Circuits 6 Combinational Circuits Q What is a digital system? A Digital: signals are or analog: signals vary continuously Q Why digital systems? A Accurate, reliable, fast, cheap Basic abstractions

More information

Digital Electronics Lab

Digital Electronics Lab LAB MANUAL Digital Electronics Lab (EE-224-F) Vikas Sharma (Lab In-charge) Dayal C. Sati (Faculty In-charge) DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING Page STUDENTS GUIDELINES There is Hr 4

More information

Here 4 is the least significant digit (LSD) and 2 is the most significant digit (MSD).

Here 4 is the least significant digit (LSD) and 2 is the most significant digit (MSD). Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26

More information

Combinational-Circuit Building Blocks

Combinational-Circuit Building Blocks May 9, 24 :4 vra6857_ch6 Sheet number Page number 35 black chapter 6 Combinational-Circuit Building Blocks Chapter Objectives In this chapter you will learn about: Commonly used combinational subcircuits

More information

earlier in the semester: The Full adder above adds two bits and the output is at the end. So if we do this eight times, we would have an 8-bit adder.

earlier in the semester: The Full adder above adds two bits and the output is at the end. So if we do this eight times, we would have an 8-bit adder. The circuit created is an 8-bit adder. The 8-bit adder adds two 8-bit binary inputs and the result is produced in the output. In order to create a Full 8-bit adder, I could use eight Full -bit adders and

More information

Basics of Digital Logic Design

Basics of Digital Logic Design Basics of Digital Logic Design Dr. Arjan Durresi Louisiana State University Baton Rouge, LA 70810 Durresi@Csc.LSU.Edu LSUEd These slides are available at: http://www.csc.lsu.edu/~durresi/csc3501_07/ Louisiana

More information

Chapter 2 Logic Gates and Introduction to Computer Architecture

Chapter 2 Logic Gates and Introduction to Computer Architecture Chapter 2 Logic Gates and Introduction to Computer Architecture 2.1 Introduction The basic components of an Integrated Circuit (IC) is logic gates which made of transistors, in digital system there are

More information

CHAPTER 3 Boolean Algebra and Digital Logic

CHAPTER 3 Boolean Algebra and Digital Logic CHAPTER 3 Boolean Algebra and Digital Logic 3.1 Introduction 121 3.2 Boolean Algebra 122 3.2.1 Boolean Expressions 123 3.2.2 Boolean Identities 124 3.2.3 Simplification of Boolean Expressions 126 3.2.4

More information

Digital Electronics. 4.0 Introduction to Combinational Logic Binary Arithmetic. Module 4

Digital Electronics. 4.0 Introduction to Combinational Logic Binary Arithmetic.  Module 4 Module 4 www.learnabout-electronics.org Digital Electronics 4.0 Introduction to Combinational Logic Binary Arithmetic What you ll learn in Module 4 Section 4.0 Introduction. Section 4.1 Binary Arithmetic

More information

EXPERIMENT 4. Parallel Adders, Subtractors, and Complementors

EXPERIMENT 4. Parallel Adders, Subtractors, and Complementors EXPERIMENT 4. Parallel Adders, Subtractors, and Complementors I. Introduction I.a. Objectives In this experiment, parallel adders, subtractors and complementors will be designed and investigated. In the

More information

Combinational logic design case studies

Combinational logic design case studies Combinational logic design case studies General design procedure Case studies CD to 7-segment display controller logical function unit process line controller calendar subsystem rithmetic circuits integer

More information

1. Realization of gates using Universal gates

1. Realization of gates using Universal gates 1. Realization of gates using Universal gates Aim: To realize all logic gates using NAND and NOR gates. Apparatus: S. No Description of Item Quantity 1. IC 7400 01 2. IC 7402 01 3. Digital Trainer Kit

More information

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process) ECE 3401 Lecture 7 Concurrent Statements & Sequential Statements (Process) Concurrent Statements VHDL provides four different types of concurrent statements namely: Signal Assignment Statement Simple Assignment

More information

Arithmetic Operations. Binary Adder. 4 Bit Ripple Carry Adder

Arithmetic Operations. Binary Adder. 4 Bit Ripple Carry Adder rithmetic Operations We will review the arithmetic building blocks we have previously used, and look at some new ones. ddition incrementer ddition/subtraction decrementer mparison F (,,C) = xor xor C inary

More information

1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1.

1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1. File: chap04, Chapter 04 1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1. 2. True or False? A gate is a device that accepts a single input signal and produces one

More information

Digital Design with VHDL

Digital Design with VHDL Digital Design with VHDL CSE 560M Lecture 5 Shakir James Shakir James 1 Plan for Today Announcement Commentary due Wednesday HW1 assigned today. Begin immediately! Questions VHDL help session Assignment

More information

Computer Organization and Architecture

Computer Organization and Architecture Computer Organization and Architecture Chapter 9 Computer Arithmetic Arithmetic & Logic Unit Performs arithmetic and logic operations on data everything that we think of as computing. Everything else in

More information

Numbering Systems. Number Representations Part 1

Numbering Systems. Number Representations Part 1 Lab Workbook Introduction The VHDL modeling language allows numbers being represented in several radix systems. The underlying digital circuit processes the number in binary, however, input into and output

More information

Arithmetic. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See P&H 2.4 (signed), 2.5, 2.6, C.6, and Appendix C.

Arithmetic. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See P&H 2.4 (signed), 2.5, 2.6, C.6, and Appendix C. Arithmetic Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See P&H 2.4 (signed), 2.5, 2.6, C.6, and Appendix C.6 Goals for today Binary (Arithmetic) Operations One-bit and four-bit

More information

ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path

ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path Project Summary This project involves the schematic and layout design of an 8-bit microprocessor data

More information

DEPARTMENT OF INFORMATION TECHNLOGY

DEPARTMENT OF INFORMATION TECHNLOGY DRONACHARYA GROUP OF INSTITUTIONS, GREATER NOIDA Affiliated to Mahamaya Technical University, Noida Approved by AICTE DEPARTMENT OF INFORMATION TECHNLOGY Lab Manual for Computer Organization Lab ECS-453

More information

VHDL Test Bench Tutorial

VHDL Test Bench Tutorial University of Pennsylvania Department of Electrical and Systems Engineering ESE171 - Digital Design Laboratory VHDL Test Bench Tutorial Purpose The goal of this tutorial is to demonstrate how to automate

More information

ORG ; ZERO. Introduction To Computing

ORG ; ZERO. Introduction To Computing Dec 0 Hex 0 Bin 00000000 ORG ; ZERO Introduction To Computing OBJECTIVES this chapter enables the student to: Convert any number from base 2, base 10, or base 16 to any of the other two bases. Add and

More information

Understanding Logic Design

Understanding Logic Design Understanding Logic Design ppendix of your Textbook does not have the needed background information. This document supplements it. When you write add DD R0, R1, R2, you imagine something like this: R1

More information

Simulation & Synthesis Using VHDL

Simulation & Synthesis Using VHDL Floating Point Multipliers: Simulation & Synthesis Using VHDL By: Raj Kumar Singh - B.E. (Hons.) Electrical & Electronics Shivananda Reddy - B.E. (Hons.) Electrical & Electronics BITS, PILANI Outline Introduction

More information

A Little Perspective Combinational Logic Circuits

A Little Perspective Combinational Logic Circuits A Little Perspective Combinational Logic Circuits COMP 251 Computer Organization and Architecture Fall 2009 Motivating Example Recall our machine s architecture: A Simple ALU Consider an ALU that can perform

More information

Chapter 6 Digital Arithmetic: Operations & Circuits

Chapter 6 Digital Arithmetic: Operations & Circuits Chapter 6 Digital Arithmetic: Operations & Circuits Chapter 6 Objectives Selected areas covered in this chapter: Binary addition, subtraction, multiplication, division. Differences between binary addition

More information

In this chapter we are concerned with basic architecture and the. different operations related to explain the proper functioning of the

In this chapter we are concerned with basic architecture and the. different operations related to explain the proper functioning of the CHAPTER I CONTENTS: 1.1 INTRODUCTION 1.2 STORED PROGRAM ORGANIZATION 1.3 INDIRECT ADDRESS 1.4 COMPUTER REGISTERS 1.5 COMMON BUS SYSTEM SUMMARY SELF ASSESSMENT OBJECTIVE: In this chapter we are concerned

More information

Logic Design 2013/9/5. Introduction. Logic circuits operate on digital signals

Logic Design 2013/9/5. Introduction. Logic circuits operate on digital signals Introduction Logic Design Chapter 2: Introduction to Logic Circuits Logic circuits operate on digital signals Unlike continuous analog signals that have an infinite number of possible values, digital signals

More information

Arithmetic Operations

Arithmetic Operations Arithmetic Operations Dongbing Gu School of Computer Science and Electronic Engineering University of Essex UK Spring 2013 D. Gu (Univ. of Essex) Arithmetic Operations Spring 2013 1 / 34 Outline 1 Introduction

More information

1 Number System (Lecture 1 and 2 supplement)

1 Number System (Lecture 1 and 2 supplement) 1 Number System (Lecture 1 and 2 supplement) By Dr. Taek Kwon Many different number systems perhaps from the prehistoric era have been developed and evolved. Among them, binary number system is one of

More information

8-bit 4-to-1 Line Multiplexer

8-bit 4-to-1 Line Multiplexer Project Part I 8-bit 4-to-1 Line Multiplexer Specification: This section of the project outlines the design of a 4-to-1 multiplexor which takes two 8-bit buses as inputs and produces a single 8-bit bus

More information

Flip-Flops, Registers, Counters, and a Simple Processor

Flip-Flops, Registers, Counters, and a Simple Processor June 8, 22 5:56 vra235_ch7 Sheet number Page number 349 black chapter 7 Flip-Flops, Registers, Counters, and a Simple Processor 7. Ng f3, h7 h6 349 June 8, 22 5:56 vra235_ch7 Sheet number 2 Page number

More information

hochschule fu r angewandte wissenschaften hamburg Prof. Dr. B. Schwarz FB Elektrotechnik/Informatik

hochschule fu r angewandte wissenschaften hamburg Prof. Dr. B. Schwarz FB Elektrotechnik/Informatik Counters Counters are used for many functions in digital systems, for example, counting the number of occurrences of an event, storing the address of the current instruction of a microprocessor or calculating

More information

Example: Find the value of 1101 v(b) = = = 13 10

Example: Find the value of 1101 v(b) = = = 13 10 Number Representation and Arithmetic Circuits The base of Decimal numbers = 10 any numberv(d) = n 1 i=0 d i 10 i Example : find the value of 895 v(d) = 5 10 0 + 9 10 1 + 8 10 2 = 5 + 90 + 800 Binary Numbers:

More information

Examples of Solved Problems for Chapter3,5,6,7,and8

Examples of Solved Problems for Chapter3,5,6,7,and8 Chapter 3 Examples of Solved Problems for Chapter3,5,6,7,and8 This document presents some typical problems that the student may encounter, and shows how such problems can be solved. Note that the numbering

More information

The equation for the 3-input XOR gate is derived as follows

The equation for the 3-input XOR gate is derived as follows The equation for the 3-input XOR gate is derived as follows The last four product terms in the above derivation are the four 1-minterms in the 3-input XOR truth table. For 3 or more inputs, the XOR gate

More information

Gates, Circuits, and Boolean Algebra

Gates, Circuits, and Boolean Algebra Gates, Circuits, and Boolean Algebra Computers and Electricity A gate is a device that performs a basic operation on electrical signals Gates are combined into circuits to perform more complicated tasks

More information

DIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

DIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute DIGITAL TECHNIC Dr. Bálint Pődör Óbuda University, Microelectronics and Technology Institute 4. LECTURE: COMBINATIONAL LOGIC DEIGN AND ARITHMETIC (THROUGH EXAMPLE) 1st (Autumn) term 2014/2015 COMBINATIONAL

More information

Two s Complement Arithmetic

Two s Complement Arithmetic Two s Complement Arithmetic We now address the issue of representing integers as binary strings in a computer. There are four formats that have been used in the past; only one is of interest to us. The

More information

Computer Science. 19. Combinational Circuits. Computer Science. Building blocks Boolean algebra Digital circuits Adder circuit. Arithmetic/logic unit

Computer Science. 19. Combinational Circuits. Computer Science. Building blocks Boolean algebra Digital circuits Adder circuit. Arithmetic/logic unit PA R T I I : A L G O R I T H M S, M A C H I N E S, a n d T H E O R Y PA R T I I : A L G O R I T H M S, M A C H I N E S, a n d T H E O R Y Computer Science 9. Combinational Circuits Computer Science 9.

More information

12. A B C A B C A B C 1 A B C A B C A B C JK-FF NETr

12. A B C A B C A B C 1 A B C A B C A B C JK-FF NETr 2..,.,.. Flip-Flops :, Flip-Flops, Flip Flop. ( MOD)... -8 8, 7 ( ).. n Flip-Flops. n Flip-Flops : 2 n. 2 n, Modulo. (-5) -4 ( -), (-) - ( -).. / A A A 2 3 4 5 MOD-5 6 MOD-6 7 MOD-7 8 9 / A A A 2 3 4 5

More information

Numbering Systems. Number Representations Part 1

Numbering Systems. Number Representations Part 1 Introduction The VHDL modeling language allows numbers being represented in several radix systems. The underlying circuit processes the number in binary, however, input into and output from such circuits

More information

LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER

LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER OBJECTIVES 1. Learn the basic elements of VHDL that are implemented in Warp. 2. Build a simple application using VHDL and

More information

Arithmetic Circuits Addition, Subtraction, & Multiplication

Arithmetic Circuits Addition, Subtraction, & Multiplication Arithmetic Circuits Addition, Subtraction, & Multiplication The adder is another classic design example which we are obliged look at. Simple decimal arithmetic is something which we rarely give a second

More information

Chapter 5: Sequential Circuits (LATCHES)

Chapter 5: Sequential Circuits (LATCHES) Chapter 5: Sequential Circuits (LATCHES) Latches We focuses on sequential circuits, where we add memory to the hardware that we ve already seen Our schedule will be very similar to before: We first show

More information

Verilog Combinational Logic. Verilog for Synthesis

Verilog Combinational Logic. Verilog for Synthesis Verilog Combinational Logic Verilog for Synthesis 1 Verilog logic and numbers Four-value logic system 0 logic zero, or false condition 1 logic 1, or true condition x, X unknown logic value z, Z - high-impedance

More information

Combinational Logic. Combinational Circuits in Computers (Examples) Design of Combinational Circuits. CC Design Example

Combinational Logic. Combinational Circuits in Computers (Examples) Design of Combinational Circuits. CC Design Example Combinational Circuits in Computers (Examples) Combinational Logic Translates a set of Boolean n input variables ( or ) by a mapping function (using Boolean operations) to produce a set of Boolean m output

More information

CMOS Binary Full Adder

CMOS Binary Full Adder CMOS Binary Full Adder A Survey of Possible Implementations Group : Eren Turgay Aaron Daniels Michael Bacelieri William Berry - - Table of Contents Key Terminology...- - Introduction...- 3 - Design Architectures...-

More information

150127-Microprocessor & Assembly Language

150127-Microprocessor & Assembly Language Chapter 3 Z80 Microprocessor Architecture The Z 80 is one of the most talented 8 bit microprocessors, and many microprocessor-based systems are designed around the Z80. The Z80 microprocessor needs an

More information

CSE140 Homework #7 - Solution

CSE140 Homework #7 - Solution CSE140 Spring2013 CSE140 Homework #7 - Solution You must SHOW ALL STEPS for obtaining the solution. Reporting the correct answer, without showing the work performed at each step will result in getting

More information

Lab 1: Seven Segment Decoder

Lab 1: Seven Segment Decoder CpE 487 Digital Design Lab Lab 1: Seven Segment Decoder 1. Getting Started The purpose of this lab is to introduce you to the NEXYS2 FPGA development board and a software environment that will allow you

More information