CS/CMPE 3430, sp16 – Assignment 5 (30 points total)
Due: Saturday May 7
th
, 11:59 pm on Blackboard
Instructor: Dr. Lei
READ: Sections 8.1-8.2, 8.4, Tables 8.2-8.3, Figures 8.2, 8.11-8.12, 8.16 of Spring 2016 Doering text
IMPORTANT: Submit all answers onto Blackboard using Logicworks .cct files. Use Excel spreadsheets to generate text,
truth tables and K-maps, and copy and paste into the .cct files.
In this assignment, you are to implement the ALU for the MIPS 3-stage pipeline CPU. The ALU is a combinational circuit
that executes arithmetic, logic, slt, and shift instructions for the CPU. The ALU takes two 32-bit operands as inputs, and
produces a 32-bit output. The ALU also takes in a function code that specifies the operation to be performed on the 32-
bit inputs. Consider the following MIPS instructions in Table 8.2 – add, addu, sub, sub, and, or, xor, nor, slt (set-less-
than), sltu (set-less-than-unsigned). The table shows the machine code of each instruction, and each machine code has
a 6-bit function code in the func 5:0 column. This function code signals to the ALU which operation to perform, and one
function code uniquely corresponds to one instruction. Table 8.3 has C/C++ implementations of each MIPS instruction.
Familiarize yourself with the high-level ALU implementation on Figure 8.12, with some details on Figure 8.11. The A
input bus is the A31..0 input. The B input bus is the B31..0 input. The D output bus is the 32-bit D31..0 output. The func
bus is the 6-bit function code input. The sa bus is the “shift amount” input, which is only used during shift operations.
Those instructions are the sll, srl, sra, sllv, srlv, and srav instructions on Table 8.2. The implementation consists of a set
of 32 slices. All slices are the same except for Slice 0 and slice MSB.
The inputs to all slices except for Slice 0 are the following:
a) A 6-bit function code input, corresponding to values in the func5:0 column of Table 8.2. This is the func bus
input of each slice, which contains the 6 bits.
b) A 1-bit “A” input, which is a single bit of the 32-bit A31..0 input of the overall ALU.
c) A 1-bit “B” input, which is a single bit of the 32-bit B31..0 input of the overall ALU.
d) A 1-bit “C” input (on the right side of each slice), which is equivalent to the “carry-in” input of a full-adder circuit.
The outputs of each slice except for Slice MSB are the following:
a) A 1-bit “R” output, which is the result for any arithmetic (add, subtract), logic (and, or, xor, nor), or slt operation.
b) A 1-bit “g” output, which is equal to 1 if the slice “Generates” a carry output. For instance, during an addition
operation, a slice generates a carry output if both “A” and “B” inputs are 1.
c) A 1-bit “p” output, which is equal to 1 if the slice “Propagates” a carry input to become a carry output. For
instance, during an addition operation, a slice propagates a carry input if either “A” or “B”, or both, inpu.
1. CS/CMPE 3430, sp16 – Assignment 5 (30 points total)
Due: Saturday May 7
th
, 11:59 pm on Blackboard
Instructor: Dr. Lei
READ: Sections 8.1-8.2, 8.4, Tables 8.2-8.3, Figures 8.2, 8.11-
8.12, 8.16 of Spring 2016 Doering text
IMPORTANT: Submit all answers onto Blackboard using
Logicworks .cct files. Use Excel spreadsheets to generate text,
truth tables and K-maps, and copy and paste into the .cct files.
In this assignment, you are to implement the ALU for the MIPS
3-stage pipeline CPU. The ALU is a combinational circuit
that executes arithmetic, logic, slt, and shift instructions for the
CPU. The ALU takes two 32-bit operands as inputs, and
produces a 32-bit output. The ALU also takes in a function code
that specifies the operation to be performed on the 32-
bit inputs. Consider the following MIPS instructions in Table
8.2 – add, addu, sub, sub, and, or, xor, nor, slt (set-less-
than), sltu (set-less-than-unsigned). The table shows the
machine code of each instruction, and each machine code has
2. a 6-bit function code in the func 5:0 column. This function code
signals to the ALU which operation to perform, and one
function code uniquely corresponds to one instruction. Table
8.3 has C/C++ implementations of each MIPS instruction.
Familiarize yourself with the high-level ALU implementation
on Figure 8.12, with some details on Figure 8.11. The A
input bus is the A31..0 input. The B input bus is the B31..0
input. The D output bus is the 32-bit D31..0 output. The func
bus is the 6-bit function code input. The sa bus is the “shift
amount” input, which is only used during shift operations.
Those instructions are the sll, srl, sra, sllv, srlv, and srav
instructions on Table 8.2. The implementation consists of a set
of 32 slices. All slices are the same except for Slice 0 and slice
MSB.
The inputs to all slices except for Slice 0 are the following:
a) A 6-bit function code input, corresponding to values in the
func5:0 column of Table 8.2. This is the func bus
input of each slice, which contains the 6 bits.
b) A 1-bit “A” input, which is a single bit of the 32-bit A31..0
input of the overall ALU.
c) A 1-bit “B” input, which is a single bit of the 32-bit B31..0
input of the overall ALU.
d) A 1-bit “C” input (on the right side of each slice), which is
equivalent to the “carry-in” input of a full-adder circuit.
The outputs of each slice except for Slice MSB are the
3. following:
a) A 1-bit “R” output, which is the result for any arithmetic
(add, subtract), logic (and, or, xor, nor), or slt operation.
b) A 1-bit “g” output, which is equal to 1 if the slice
“Generates” a carry output. For instance, during an addition
operation, a slice generates a carry output if both “A” and “B”
inputs are 1.
c) A 1-bit “p” output, which is equal to 1 if the slice
“Propagates” a carry input to become a carry output. For
instance, during an addition operation, a slice propagates a
carry input if either “A” or “B”, or both, inputs are
“1”.
Slice MSB has an additional slt output, which is used only
during an slt operation. An slt operation compares the 32-bit
numbers A31..0 and B31..0, to see if A31..0 is less than B31..0.
If so, then the slt output is 1. Otherwise, the slt output is
0. The slt output bit can only be performed in Slice MSB,
because it needs the A31, B31, and D31 bits for its
computation. The slt output bit is then sent to Slice 0, which
sends the output to D0. All other output bits D1-D31 are set
to 0.
Hence, during an slt operation, the 32-bit output D31..0 is equal
to either a 1 (i.e. 0000 0000 0000 0000 0000 0000 0000
0001), or a 0 (0000 0000 0000 0000 0000 0000 0000 0000).
Lastly, Slice MSB also has an overflow output, which
4. indicates if arithmetic overflow occurred during addition or
subtraction, and slice 0 does not have a “C” input.
CS/CMPE 3430, sp16 – Assignment 5 (30 points total)
Due: Saturday May 7
th
, 11:59 pm on Blackboard
Instructor: Dr. Lei
When implementing an addition/subtraction operation using Full
Adder circuits, the carry output of the Full Adder for
each bit is normally fed to the carry input of the Full Adder for
the next bit. This is called the “ripple-carry” method. The
ALU slices are like the Full Adder circuits, where each slice
operates on a single bit. However, with 32 slices, there will be
a delay, simply because the ripple-carry method needs to travel
through 32 total slices. In Figure 8.12, a set of Carry
Look Ahead Units (CLUs) in a tree structure is connected to
each slice. The CLUs compute the carry input bits of each
slice is an efficient manner, avoiding the delays introduced by
the ripple-carry method. The CLU circuit and tree-
structure implementations are provided in Figure 8.12.
5. Your task:
Implement the ALU slices and CLUs shown in Figure 8.12, but
using PLAs to implement each slice. For each PLA,
minimize the number of product terms of each output by
incorporating “don’t care” inputs (i.e. “x”). The PLAs should
then be packaged into a device symbol for each slice. To help
you with the PLA implementations, refer to the 6-bit
function codes of each instruction. For this assignment, you
only need to consider the add, addu, sub, subu, and, or,
xor, nor, slt, sltu instructions in Table 8.2. As a further
simplification, you may assume that add/addu have the exact
same implementation, and sub/subu have the exact same
implementation. slt/sltu DO NOT have the same
implementation. A C/C++ style pseudo code of each instruction
can be found on Table 8.3 to assist your understanding
of each instruction.
All PLAs except for the ones in Slice 0 and Slice MSB should
have a total of 9 inputs, and 4 outputs. The inputs are the 6
function code bits, and the A, B, and C inputs; the outputs are
TS, p g, and R. For Slice 0, the C input is replaced with the
slt input. For Slice MSB, the PLA has 6 outputs – TS, p, g, R,
slt, and ov (arithmetic overflow).
The purpose of the TS output is to disable the R output, in case
if the operation is a shift operation, which requires the
6. use of the Barrel Shifter and not the slices. Since the TS output
is driving the gate of a tri-state buffer, when it equals 1,
then the R output is disabled. Hence, the TS output needs to be
Active Low, which you can specify in the PLA
implementation. The following figures show you how to connect
the PLAs to the input and output ports of each slice.
You must create separate device symbols for Slice 0, Slice, and
Slice MSB, packaging the PLAs and input/output ports.
Slice 0 PLA (for bit 0):
func5
func4
func3
func2
func1
func0
A
B
slt
funcfunc
P
G
8. A spreadsheet called “ALU_slice_plas_blank.xlsx” has been
posted on Blackboard under Assignment 5 to assist you with
creating the three PLAs.
For this assignment, you are not required to complete the Barrel
Shifter (Figure 8.16), but it is strongly recommended
that you complete the Barrel Shifter in order to not have to redo
the overall ALU device symbol in the next assignment.
If the instruction involves a shift operation (i.e. sll, srl, sra,
sllv, srlv, and srav), then the Barrel Shifter output is used. If
the instruction involves arithmetic, logic, or slt operations, then
the slices output is used. The TS output of the PLAs in
each slice, along with the 32-bit tri-state buffer in the Barrel
Shifter, work together such that the Barrel Shifter output
and the slices output do not conflict with each other. Once you
finish implementing the Slices, CLUs, and Barrel Shifter (if
you choose to do so in this assignment), package everything
into a top-level ALU device symbol.
See next page for instructions regarding deliverables for the
assignment.
funcfunc
11. CS/CMPE 3430, sp16 – Assignment 5 (30 points total)
Due: Saturday May 7
th
, 11:59 pm on Blackboard
Instructor: Dr. Lei
Deliverables: Submit on a Logicworks file your ALU device
symbol, along with an attached test circuit with Hex
Keyboards and Displays demonstrating the operation of the add,
addu, sub, sub, and, or, xor, nor, slt, sltu instructions.
For each instruction, write the 32-bit Hex outputs (in the same
logicworks file) of each instruction for the following 32-
bit inputs:
32-bit A input: 0x5A5A5A5A
32-bit B input: 0x6B6B6B6B
The figure below shows an example of what your submission
should look like. The function code is set to 0x2A, which
performs the slt instruction of the two inputs. The inputs are set
to 0x5A5A5A5A and 0x6B6B6B6B. As a sanity check,
your inputs and outputs for the slt instruction should at least
match the ones in the figure. Note that the slt output in
12. this example is 1, since the 32-bit A31..0 input is less than the
32-bit B31..0 input.
A
0
A
1
A
2
A
3
A
4
A
5
A
6
A
7
A
8
A
9
A
34. 1
5Title of PaperStudent NameCourse/Number
Due Date
Faculty Name
Title of Paper
Triple click your mouse anywhere in this paragraph to replace
this text with your introduction.
Overview of Organization
Triple click your mouse anywhere in this paragraph to replace
this text with the overview of the organization.
Description of Product/Service
Triple click your mouse anywhere in this paragraph to replace
this text with the description of your product or service.
SWOT Analysis
Strengths (Internal)
Weaknesses (Internal)
Opportunities (External)
Threats (External)
.
Competitive Analysis
Triple click your mouse anywhere in this paragraph to replace
this text with the description of your competitive analysis.
35. Current company’s strengths and weaknesses
Potential Competitor’s strengths and weaknesses
Competitive Rival’s strengths and weaknesses
Target Market
Product
Place
Promotion
Price
Competitive Barriers
Likely responses
Target Market Segments
Triple click your mouse anywhere in this paragraph to replace
this text with the description of your target market.
36. Demographic
Replace this text with demographic information.
Psychographic
Replace this text with psychographic information.
Geographic
Replace this text with geographic information.
Behavioral Factors
Replace this text with behavioral factors information.
Positioning Statement
Triple click your mouse anywhere in this paragraph to replace
this text with your positioning statement.
Conclusion
Triple click your mouse anywhere in this paragraph to replace
this text with your conclusion.
References
This is a hanging indent. To keep the hanging indent format,
triple click your mouse on this line of text and replace the
information with your reference entry. You can use the
Reference and Citation Examples (Center for Writing
Excellence>Tutorials and Guides>Reference and Citation
Examples) to help format your source information into a
reference entry.
The reference page always begins on the top of the next page
after the conclusion.
Sheet1ALU-CLU Slices PLA truth tablesInstructor: Prof.
LeiSlices 1-30PLA inputsPLA