Logic Design tutorial addendum

advertisement
Compsci 104: Quartus II Logic Design and the DE2
Board (Addendum to the Schematic entry tutorial)
The goal of this lesson is to become familiar with Quartus II schematic entry of
logic circuits and programming the DE2 board with your designs. This document
is meant as an addendum to the Quartus II DE2 schematic tutorial.
Initial Setup
As with all hands on sessions using the DE2 board, plug everything in, start
Quartus II (not the NiosII IDE, we are not using that for a while).
The Quartus II Schematic Tutorial
Perform all the steps in the Quartus II schematic tutorial, with the following
exception. In Section 5, please skip the manual pin assignment and go directly to the last
paragraph of Section 5, right above Section 6. This will import the appropriate pin
assignments for the DE2 board. After you’ve done this you can then change the name of
your inputs to SW[0] and SW[1] and your output to LEDG[0]. You do this by double
clicking on the pin names (this will either open a popup window or you enable you to edit
the name in place…I don’t know how it chooses which to do??)
Logic Design Free For All
As with our previous lessons, once you’ve completed the tutorial (including
simulating the circuit), you are now free to be creative with the boards and logic design.
Some useful information on pin assignments/names: to use these you have to insert the
appropriate type of pin (input or output) and then change the name to correspond to
Input Pins
KEY[3..0]
The blue buttons, these are value 1 by default 0 when pressed, KEY[0] is
KEY 0 on the board
Output Pins
LEDG[8..0] Green LEDs can be named individually (e.g., LEDG[0]) or as a bus
LEDR[17..0] Red LEDs, individual name LEDR[0]
HEX0[6..0] The 7 segment displays, see below for segment identifier
HEX1[6..0]
…
HEX7[6..0]
The diagram above shows how each segment of an individual 7 segment display is
numbered. For the DE2 board, a logic value of 0 on the input will turn on the segment, a
logic value of 1 will turn it off. An individual segment is accessed using HEX0[i] where
i is the segment you want to control. To utilize this you would label an output pin as
HEX0[0] to control segement 0 of HEX display 0, and HEX0[6] to control segment 6 of
HEX display 0.
You can be creative or you can try one/some of the following…
Sample problems:
Easier
Inputs: Switches and Keys
Outputs: LEDs
Use the Switches as inputs to a circuit, and a key to control when the output is displayed.
Inputs: 3 Switches
Outputs: 1 LED
Create a circuit that lights an LED if the 3-bit input has more than two inputs set.
Moderate:
Inputs: 4 switches
Outputs: 1 LED
The parity code of a binary word counts the number of ones in a word. If there are an
even number of ones the parity code is 0, if there are an odd number of ones the parity
code is 1. For example, the parity of 0101 is 0, and the parity of 1101 is 1.
Construct the truth table for a function that computes the parity of a four-bit word.
Implement this function using AND, OR and NOT gates. (Note there are no constraints
on the number of gate inputs.)
Longer
Inputs: Switches
Outpus: HEX0 display
Create a circuit that takes 4 inputs from the switches and displays the corresponding HEX
value on the HEX0 display
Download