Lab 5
Lab 5
Lab 5
1 VHDL
The use of a Hardware Description Language (HDL) can simplify the design process by allowing the user to program the behavior of a circuit and let the synthesis tools create the logic-circuit structure. The text book Digital Design: Principles and Practices, 3rd Edition by Wakerly has a good overview of HDLs in section 4.7 The program structure of VHDL consists of two basic parts. The entity is simply a declaration of the modules inputs and outputs. The architecture contains a detailed description of the modules behavior. library IEEE; use IEEE.std_logic_1164.all; entity sam port ( A: B: C: D: X: Y: ); end sam; is in STD_LOGIC; in STD_LOGIC; in STD_LOGIC; in STD_LOGIC; out STD_LOGIC; out STD_LOGIC
architecture sam_arch of sam is begin X <= (A and B and C) or (C and D); Y <= (A and C) or (B and D); end sam_arch;
in the schematic based ow you can not add VHDL les to the project, even though you can access the HDL editor. Similarly you can not add schematics to a project declared as HDL based ow. When starting a new project choose the Flow type to be XST VHDL. In the Project Manager, click on Project, select New Source, select VHDL Module, and give it a lename. Click Next twice and then Finish. At this point, the software will generate a VHDL entity/architecture template and open it in the HDL editor. Next, the port declarations must be made in the port( ); statement in the entity body. Now, enter your statements in the architecture body. This is where you implement the VHDL functionality. After you have completed your design entry, save the document. Next, under Processes for Current Source window, run the synthesis by double-clicking Synthesis in order to analyze the hierarchy and perform the syntax checking. After synthesis, you can perform the simulation steps as you did in the previous labs. Once you have completed simulation, the remaining steps for downloading the design onto the board are the same as you performed before.
r1 SW1 SW2 r2
CF CE
CG
CB CC
SW3
SW4
c2 c1
CD
Figure 1: A 2x2 Switch Matrix Vcc through pull-up resistors. If any one switch is pressed, then either r1 or r2 and either c1 or c2 will go low. The r input that goes low gives the row of the pressed switch. The c input that goes low gives the column of the Pressed switch. Rather than implement the switch matrix itself, we will use the Digilab buttons directly as the r and c inputs.
4 Preliminary Questions
1. Calculate the minimal functions needed to implement the 2x2 switch matrix to seven segment code converter circuit for the following specications: Single button presses should cause the display of the corresponding switch number on a seven segment display. Dont forget that the seven segment display is active low. Use the switch numbering shown in Figure 1. That is, when SW1 is pressed, 1 should appear on the display. Remember that when the circuit is implemented on the Digilab board, pressing SW1 will require that the switches corresponding to r1 and c1 will have to be taken low, while the other inputs remain high. Display the switch (button) number on each seperate seven segment display. For example, if you push SW1 (button one), the rst seven segment display should show the number one. If you were to press the second switch SW2 (button two), the number two should show on the second seven segment display, etc. When no switches are pressed, the display should simply remain blank. Do the design assuming that multiple switch presses, and illegal input combinations cannot occur (such as one or more of r1 through r2 low without at least one of c1 through c2 also low). If more than one switch (button) is pressed at the same time, nothing should be displayed. Since both the input and output signals are active low it may be helpful to design the circuit using active low (type 2) logic. Look at what low signals it takes to drive signals low rather than looking at the equations needed to drive signals high. 2. Using simple boolean equations write the VHDL statements needed to implement the 2x2 switch matrix to seven segment code converter circuit. Turn in the equations with your lab report and any other items such as truth tables, etc. that you use during the design. 3. Obtain printouts of the .vhd design le, and the simulation waveforms. These will be useful during debugging, and also should be turned in with the Lab report.
5 The Lab
1. Implement, test, and download your design to the FPGA board. After veriying correct functionality, have the entire design passed off by the TA including the VHDL design le.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: