Docsity

Microprocessor Systems - Lab Assignment 2 | ECE 371, Lab Reports of Microprocessors

Partial preview of the text

Download Microprocessor Systems - Lab Assignment 2 | ECE 371 and more Lab Reports Microprocessors in PDF only on Docsity!

LABORATORY ASSIGNMENT # 2

pMIPS Combinational Logic Blocks I

Multiplexers, Decoders, and the Look-ahead Carry Unit (LCU)

Spring 2009

Due Date: February 9th, 2009

ECE 371: Microprocessor Systems Laboratory

Department of Electrical and Computer Engineering

School of Engineering, Mathematics, & Sciences

Purdue University – Calumet

OBJECTIVE

The objectives of this laboratory assignment are to

  • Emphasize structural architectural modeling of digital circuits and systems.
  • Understand the design and operation of hierarchical binary decoders and multiplexers
  • Understand the carry-logic of a carry look-ahead adder and its recursive nature.
  • Review the FOR-GENERATE VHDL construct to design “repetitive” logic circuits.
  • Review the IF-GENERATE VHDL construct to design logic circuits containing “conditional” hardware
  • Review the GENERIC VHDL construct to design parameterized logic components.

REFERENCES

  • Computer Organization and Design: The Hardware Software Interface, 4/e by David A. Patterson and John L. Hennessy, Morgan Kaufmann, 2009.
  • Fundamentals of Digital Logic with VHDL Design, 3/e by Stephen Brown and Zvonko Vranesic, McGraw Hill,

BACKGROUND

The Look-ahead Carry Unit (LCU)

The carry look-ahead (CLA) approach is an alternative to the ripple-carry approach when considering the design of adder circuits. The carry look-ahead technique determines all intermediate carries at once as opposed to having the carries “ripple” through the circuit in a ripple-carry adder. CLA adders use the concept of hardware parallelism to produce the carries, and thus, the sums more quickly. The CLA technique uses the concept of generating and propagating carries.

The addition of two 1-bit inputs x and y is said to generate a carry if the addition will always produce a carry, regardless of whether there is an input carry (equivalently, regardless of whether any less significant bits in the sum produce a carry). In the case of binary addition, x + y generates if and only if both x and y are logic high. If g ( x , y )is

designated to represent this generating condition, then g ( x , y )is defined as g ( x , y )= x ⋅ y.

The addition of two 1-bit inputs x and y is said to propagate if the addition will carry whenever there is an input carry (equivalently, when the next less significant digit in the sum carries). In the case of binary addition, x + y propagates if and only if at least one (or both) of x or y is logic high. If p ( x , y )is designated to represent this generating condition,

then p ( x , y )is defined as p ( x , y )= x + y = x ⊕ y.

Given these definitions of g ( x , y )and p ( x , y ), binary addition will produce a carry when either the addition generates

a carry or the next less significant bit produces a carry and the addition propagates a carry. Written using Boolean algebra, with ci defined as the carry bit of bit-position i, and pi and gi defined as the generate and propagate bits of bit- position i respectively, the equation that defines the carry-bit of the next stage of an n-bit adder is given as:

ci (^) + 1 = gi + cipi = ( xi ⋅ yi ) + ci ( xi + yi )

Notice the above equation is a function of only the x, y, and c 0 ,, signals all of which are available instantly. Therefore, there is no propagation delay due to carries rippling through each stage of a full adder. There is, however, one cost in this implementation. The space complexity of the carry look-ahead design is much greater than the ripple-carry

Figure 2: A 4-to-1 Multiplexer Implemented Using Only 2-to-1 Multiplexers A description of the procedure used to construct the 4-bit multiplexer from three, 2-to-1 multiplexers follows. First, locate 2-to-1 multiplexer truth tables “within” the 4-to-1 multiplexer truth table. On first inspection, two 2-to- multiplexer truth tables are revealed and boxed as shown in Figure 2. Each of those “mini” truth tables represents a 2-to-1 multiplexer sub-circuit with inputs as indicated by their respective “mini” truth tables (labeled as MUX 1 and MUX 2 in Figure 2). Close re-inspection of the overall 4-to-1 multiplexer truth table shows another “outer” 2-to- multiplexer truth table of the 4-to-1 multiplexer truth table (indicated as MUX 3). Like MUX 1 and MUX 2, this represents another 2-to-1 multiplexer, this time with inputs coming from the outputs of MUX 1 and MUX 2, a select signal s 1 , and an output of f.

Hierarchical Binary Decoders

Similar to multiplexers, large binary decoders can be designed using smaller binary decoders. As an example, a 3-to 8 binary decoder can be designed using 2-to-4 binary decoders and additional logic. To hierarchically design a 3-to- binary decoder, first consider its truth table as shown in Table 1.

En w 2 w 1 w 0 y 0 y 1 y 2 y 3 y 4 y 5 y 6 y 7 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 1 0 x x x 0 0 0 0 0 0 0 0

Table 1: A 3-to-8 Binary Decoder Truth Table

The truth table reveals that as long as w 2 is logic zero, outputs y 4 through y 7 are inactive while outputs y 0 through y 3 are active. This resembles a 2-to-4 binary decoder with input values w 1 and w 0. When w 2 is logic one, the opposite is true, i.e. outputs y 4 through y 7 are active and outputs y 0 through y 3 are inactive. This resembles another 2-to-4 binary decoder, again with inputs w 1 and w 0 , but this time, driving outputs y 4 through y 7. Consequently, a 3-to-8 decoder can

be decomposed into two, 2-to-4 decoder. The first decoder is enabled only if w 2 is low and the enable input is active.

En

  • The second decoder is enabled only if w 2 is high and the enable input is active. With these observations, a 3-to-
    • w binary decoder can be designed with the logic diagram shown in Figure 3.
    • w 0 y - y - y - y
      • w
        • y En
      • w 1 y
        • y
        • y
      • w
        • y En
      • w 1 y
        • y
        • y
          • y
          • y
          • y
          • y
    • w

Utilize the VHDL GENERIC -port structure and specify the parameter named INPUT_WIDTH of type POSITIVE with a default value of four as indicated in Table 4. Additionally, utilize the VHDL FOR-GENERATE construct to implement the structural architecture models. Name the top-level design files using the convention mux k to1_nbit.vhd.

i. An n-bit multiplexer using 1-bit multiplexers with k=2. ii. An n-bit multiplexer using 1-bit multiplexers with k=4. iii. An n-bit multiplexer using 1-bit multiplexers with k=8.

Task 3

Design, implement, functionally simulate, and validate the following k-to-2k^ binary decoders using a combination of dataflow and structural modeling. The interface specification of the k-to-2k binary decoders is shown in Table 5.

Port Mode Type Default Size Description wk-1...w 0 Inputs STD_LOGIC_VECTOR (^) N/A k bits Decoder binary input data Enable (^) Input STD_LOGIC (^) N/A 1-bit Decoder enable signal. Outputs are active only if Enable = 1 y 2 k–1...y 0 Outputs STD_LOGIC_VECTOR (^) N/A 2 k^ bits Decoder output lines

Table 5: Interface Specification of the k-to-2k^ Binary Decoders

Use dataflow modeling to implement all additional logic when required. Name the top-level design files using the convention decoder k to2 k .vhd.

(a) A decoder with k=3 using a k=2 decoder as a sub-component (illustrated in Figure 3).

(b) A decoder with k=4 using only decoders with k=3 as sub-components.

DELIVERABLES

Turn in all circuit schematics and/or block diagrams, logic equations, commented VHDL source code, Quartus II simulation waveform files, and answers to all questions required by this laboratory assignment using the ECE 371 laboratory report format.