# ECEN3100 - Digital Logic

## Lab 6: Mid-semester Project

### 4 lab periods

This lab is to give you a chance to show off the skills you've obtained so far. Over the next two weeks, you will design, build and demonstrate an interesting project. The on-board resources you are allowed to use are as follows:

Required functionality:

• Your design must be combinational, though you may use latches to store your input and output values, strictly to overcome the limitations in resources such as switches and LEDs.
• Because it is combinational, you may not use RAM, memory, counters or flip-flops. No state machines are allowed.
• You may build off of previous labs.
• You may not use any off-board resources.
• Your design must run on the FPGA. Simply displaying simulation results is not sufficient as a demonstration to your TA.
• TAs will not give project suggestions, and you are not allowed to use canned projects from the text or any other readily available source; you must do the design work yourselves.
• You are, however, allowed and recommended to research algorithms online or at the library. In general, smart approaches will receive more credit than brute force.
• All designs must be approved by your TA. Any project that is deemed to easy or too similar to another project in the same lab class will be vetoed.
• LPM and megafunctions are allowed but only with the approval of your TA.
• You may wish to have this project be a part of your final project (due at the end of the semester), but this is not required.
• You may use this pin configuration file.

#### Picking a project

Basically, anything you can do algorithmically, you can do with combinational logic; however, it may take you a LOT of resources, and be very complicated to do a given thing combinationally. Recursive algorithms are especially intensive; you will have to "unfold" them, and then make separate logic for each iteration. Many things are actually easier to do in binary than in decimal, though it may take a while to figure out how to do them, and many a masters thesis has been written about how to do things efficiently (with fewer gates) with combinational logic.

You should be able to figure out how to do most any function you find on a scientific calculator. You have already figured out ripple carry addition and subtraction, and you can probably work out multiplication just from looking at how you would multiply two numbers on a sheet of paper (though it's in the book, as well).

As you will no doubt discover for yourselves, a web search will locate you complete diagrams for these simple functions. Word to the wise - it would be rather obvious from your implementation whether you made a design of your own or copied an "optimal" one from the web, so be sure to only use stuff you find on the web as part of a larger algorithm of your own design, and credit these "pieces" of your design to their original owners.

You can make most functions out of addition, subtraction, multiplication, division, binary and, binary or and binary not, provided you have a working knowledge of Taylor series expansions. For example, you can probably see how you could make the exponent function:

e^(x) = 1 + x + x^2/(2!) + ...... + x^n/n!) + ...

or the sine function:

sin(x) = x - x^3/(3!) + x^5/(5!) - x^7/(7!) + ...

out of these pieces, though of course you will have to truncate the series, and getting real accuracy may take many more recursions than you might like. If possible, you would like to construct your pieces of a function like this so that you could re-use them for each level of the (unfolded) "recursion", for an easily scalable design.

Algorithms for calculating things like square roots, moduli, etc. can be found in textbooks or on the web. You're also always welcome to come up with your own. Once again, you may not be able to get great accuracy without using a lot of resources, but the point is to make a design you can implement and justify in your report how you would scale it up for improved accuracy.

Here's a few A+ projects that have been proposed in the past:

• Using the law of cosines to determine the length of the unknown side of a triangle. (sine, multiplication, signed addition, square root)
• Ballistic range calculator (inputs were angle of barrel and muzzle velocity). (sine/cos, multiplication, square root, division, signed addition, espresso tables, other)
• "Modulo anything" calculator, with scalable bit length, as part of a "fast" division algorithm.

You should type up a (short) proposal for your project and have your TA sign off on it; this is due before you leave the first day. Your proposal should consist of three parts:

• Low: This is what you're sure you'll get. Use it as a fall-back just in case you can't complete your "normal" proposal. Don't make it too complex! If all you complete is your low proposal you will be docked, but not as many as if you don't even manage that. Keep it achievable, just in case.
• Normal: This is your regular proposal. It's what you're aiming for realistically, and think you can get done in the time allotted. Remember, the only difference between a student with high ability and another with low ability is the time it takes for them to complete a given assignment -- carefully evaluate yours and choose a proposal carefully given the 2 week timeframe.
• High: This is in case you finish early and want extra credit. The amount given will be entirely dependent upon how difficult it is to achieve. Aim high, but as always aim realistically.

Other advice: Remember, while you may be able to copy a sub-circuit from a web page, it isn't worth as much grade-wise as designing it yourself. Save your design work to hand in with your report: you'll improve your score if the TAs are sure you designed any given subsection yourself. Also, what is important is that you use an algorithmic approach to solving a problem, and not so much how many bits of accuracy you achieve; try to squeeze out as much as seems reasonable to you, and no more (often an extra bit of accuracy will double the resources required for a project, and there is a limit to how much you can use on the FPGA!). Making your project scalable will help you a lot if you decide you need to remove or add precision later.

#### Project Demonstration

On the last day scheduled for this lab, you must demonstrate your design to your TA during your normal lab period. This demonstration will involve a brief discussion about the design of your circuit and your schematic, a simulation fo your design, and a test of its implementation on the FPGA board. You must supply operating instructions that are sufficient so that the TA could operate your circuit without your presence.

The TA will ask to run various test cases on your design. You should be able to apply these easily and also be able to interpret your results. You will be penalized if you do not know how your own circuit works.

There will be no late demonstations. In case of illness or other unavoidable absence, make sure that your partners write your name on the grade sheet.

#### Project Report

You must submit a typed, professional quality report on your design. Emphasis should be on clarity and conciseness rather than length. Remember, an engineer knows his or her design is perfect not when there's nothing left to add, but when there is nothing left to take away. Be efficient. The report is due one week after the demonstation. The report should consist of the following sections:

1. Title page
2. A description of the function of your circuit and the problem it was designed to solve
3. A description of your design methodology
4. A description of the schematic
5. A description of the simulation your performed and test cases that verify the correctness of the circuit
6. Any issues that came up during the implementation of your design
7. What you would do different and why? Ideas on how your project could be expanded
8. Bibliography, if applicable
9. Appendicies, including your source files formatted such that they don't look terrible when printed (if you have very long lines, try splitting them, printing with a smaller font, or using a landscape print format rather than portrait)