CSE 140L Lab 1 Questions

advertisement
CSE 140L Lab 1 - Combinational Circuit
Design Assignment
Fall 2010, Professor Cheng
By Gopi Tummala
DUE TIME: DEMONSTRATE BY WEDNESDAY 10/20, REPORT DUE WEDNESDAY 10/20 11:59PM
Important! Please regularly check http://webct.ucsd.edu for the latest updates and news
regarding this lab. FAQs and announcements will be on the webct, so check it often! Also,
please get started sooner rather than later. This lab should take a bit more than 4 hours to do
(assuming you understand the material), but since you must demonstrate this for us, you
should be done before Wednesday.
Objective
1. Learn and become familiar with the Altera Quartus II FPGA EDA tool.
2. Learn how to design basic combinational digital components such as adders and
multiplexers.
3. Learn how to download designs onto the FPGA platform.
4. Learn how to do functional and timing simulations and to examine the resulting
waveforms.
Note, the first parts of this lab are almost entirely given to you in step by step instructions. The
objective is for you to learn how to use Quartus II and the basic steps in designing a
combinational circuit from specification to testing. That being the case, please make sure that
you understand everything that you do in this lab!
Important Note: on the screen shots you will see that we have Cyclone-II EP2C35F as our target
FPGA. That is because we have the DE2 board. You will likely be using a DE1 board, which has a
different Cyclone-II FPGA, the Cyclone-II EP2C20F484C7. When you guys pick your target FPGA,
make sure you pick the correct one! When in doubt, look at your board and manual to see the
actual number. The DE1 manual is on your CD-ROM, and it's also on the web at: Altera DE1
Manual.
Another good resource is this Altera DE2 tutorial .
Please make sure you have Quartus II 10.0 or any near early version (e.g. v9.0) from the Altera
website. The version on the cdrom could be old. We recommend you to not use that.
PART 1. INTRODUCTORY TUTORIAL
Follow along with the following tutorials, making sure that you understand each step. You will
learn the basics of your hardware platform and the Quartus II EDA program. You will also learn
how to design a very basic combinational circuit and simulate it on the actual FPGA board. If
you do not understand a step, please ask a TA for help. Relevant chapters in the book are
Chapters 2 and 3.
Software and Hardware Introduction
Basic Combinational Circuit Tutorial
Report:
- Write a short summary (max 100 words) of the overall process of using Quartus II to design a
simple combinational circuit, and getting it to work correctly with your FPGA board.
PART 2. SPELL U C S D ON THE SEGMENT DISPLAY
In this part, you will design and run a circuit that will display U C S D on the board's segment
display, depending on what button combination you have pressed. Follow along with the
following tutorial to build and run your circuit. Note the processes that you do in order to
design a circuit. Even though this part is mostly given to you, please make sure you understand
each step.
U C S D Segment Display Tutorial
Report:
- Include schematic diagrams of your circuit
- Include your full truth table for UCSD. One row is given to you in the tutorial, provide the full
truth table.
- Include the boolean expressions you derived from the truth table. Two were already given to
you.
Part 3. Output 1-Bit Numbers with the Segment Display and Switch Input
In this part, you will learn to use the 10 switch input. You will design a combinational circuit that
will display the number corresponding to the 1-bit value associated with switch 0. Thus, if
switch 0 is pressed down, then your digit 0 should show 0, and if switch 0 is in the up position,
your digit 0 will show 1.
After you have made your circuit, you will create a module for it in part 4, as you will use the 1bit number displayer for your adder. Note, this means you will ignore switch inputs 1 through 9,
and only focus on input 1 on your switch. Again you can ignore digits 1, 2, and 3. This circuit is
extremely easy to do and should take you no more than 30 minutes maximum.
Report:
- Include schematic diagrams of your circuit
- Include the truth table that you used to derive the appropriate outputs.
- In this part, you only worried about 1 input, so you only displayed 0 or 1 on the segment
display. What if we had 3 inputs (and thus 3-bits)? With only 1 bit, we only have two values - 0
and 1. But with 3-bits, we have 8 possible values, 0-7. So Instead of using just switch input 0, we
used input 0, 1, and 2. Then you would display 0 to 7 on the segment display, instead of just 0
or 1. Write out the truth table for this. (Hint, it is similar to what you did in part 2 to figure out
the segment display for CSEL, except now you have 3 inputs instead of 2). You don't have to do
this on Quartus, you just have to write this out.
Part 4. 4-bit Ripple Carry Adder Tutorial
In this part, you will design a 4-bit ripple carry adder. You will learn how to create a module
with a combinational circuit, and how to use that module in higher level circuits. By breaking up
a combinational circuit into modules, you can begin to design more complicated circuits. You
will use your 4-bit number displayer from part 3 to display the results on the segment display.
A 4-bit adder will add two 4 bit numbers to get a 4 bit result as well as a 1-bit carry out. Because
your DE1 board only has 4 digits, we will have to ignore that 1-bit carry out.
You will run your adder circuit on the FPGA board. The three inputs of the full adder, A0A3 and B0-B3, will be the switches 0-3 for A, and 6-9 for B, on the board; the output S0-S4 will
be displayed on the 4 digit displays. An included tutorial will help guide you, but by now you
should know how to design a circuit and thus less detail will be given.
Adder Tutorial
Report:
- Include schematic diagrams of your circuit
- Include functional and timing diagrams of your simulation for your full adder. You do not have
to provide simulations for your 4-bit adder.
- What is the worst case delay through the 4-bit adder? (That is, what path from an input to its
destination output causes the longest delay in your circuit?) Figure out what inputs make this
happen. You can write this out and explain it.
Part 5. Multiplexer and 4-bit Ripple Carry Adder/Subtractor
Part 5a: A 2-to-1 multiplexer (MUX) selects one of the two input signals according to the control
signal:
Input: data signal A and B; control signal ctrl.
Output: signal C;
Function: C=A if ctrl=0; C=B if ctrl=1.
In this assignment, you are required to do build a 2-to-1 multiplexer using logic gates.
Part 5b: A 4-bit Ripple Carry Adder/Subtractor
In this part, you will design a 4-bit ripple carry adder/subtractor by reusing part4’s 4-bit adder
circuit and part5a’s 2:1 multiplexer circuit.
About Subtraction: Assume 2’s complement since it is most common. You may use the
following to understand why you should reuse part4’s adder circuit to build a subtractor (or
adder + subtractor)
A - B = A + (-B)
(-B) = B’ + 1
So: A - B = A + (-B) = A + B’ + 1
You will run your adder/subtractor circuit on the FPGA board quite similar to part 4 and indeed
extending the circuit from part 4 as given below:
The inputs of the adder/subtractor, A0-A3 and B0-B3, will be the switches 0-3 for A, and 6-9 for
B, on the board – similar to part 4; Additional to these 8 inputs, add_sub_sel input will be
switch 4. The output S0-S4 will be displayed on the 4 digit displays. An included adder tutorial in
part 4 will help guide you to implement 4-bit adder/subtractor circuit.
Report:
- Specification of the 4-bit Adder/Subtractor;
- Schematic diagrams of the 2-to-1 MUX and 4-bit Adder/Subtractor;
- Functional and timing diagrams of your simulations for the 2:1 Mux.
- What is the worst case delay through the 4-bit Adder/Subtractor? (Similar to part 4)
Demonstration
For your demonstration, you will need to demonstrate part 4 and 5 to one of the TAs. Please
look at the office hours for when we are available. Note, you can contact us if those times do
not work, as we are happy to meet you outside those times too during the evening. There are
several ways you can demonstrate your board to us. First, bring your board and a laptop with
your project files and Quartus to any of the TAs during their office hours. Demonstrate part 4 to
us, and then reprogram your board with part 5. The TA will check both parts are working and
mark your name down. Check out the demonstration page to see more details on how to
demonstrate to us your circuit.
Alternatively, if you come see me (Gopi Tummala) during my lab hours, you can use my laptop
to reprogram the board, or one of the lab computers. In this case, bring your project files on a
USB drive or email it to yourself so you can retrieve it on the computer. If all looks good, we will
give you thumbs up. If something doesn't work correctly, there is always a second chance till
the deadline 
Report Instructions
You lab report should include:
- Title page, which contains Names and PID of students, due date, title of lab, and brief
description of each person's contribution.
- Part 1 - answers
- Part 2 - schematic diagrams, answers
- Part 3 - schematic diagrams, answers
- Part 4 - schematic diagrams, functional diagrams, timing diagrams, and answers
- Part 5 - schematic diagrams, functional diagrams, timing diagrams, and answers
Grading
20% of your grade will be from the demonstration, so this is an easy 20%. Another 40% will be
in your logic schematics and timing diagrams. Easy points assuming you were able to
demonstrate this for us. 30% will be in your answers to the questions.
Final Notes
Good luck with your lab! Also please run through the interactive tutorial if you haven't before.
Now that you have a good familiarity with the software and system, you can go through some
of the guides with a better grasp than before. There are some other good software tutorials
online as well, on the Altera Quartus II webpage. Being able to use EDA tools like Quartus II is
important for this class, and will be even more important for next stint CSE141L. By now you
should be able to:
1) Run Quartus II and open and create new projects.
2) Draw some logic design using the buttons and switches as inputs, and the segment display as
outputs.
3) Create a module, and use that module in other schematic designs.
4) Download and test your design on your FPGA board.
5) Run simulations with your circuit and understand the functional and timing diagra ms.
Download