Docsity

VHDL Programming for Combinational Circuits: Logic Circuit Lab #5, Lab Reports of Electrical and Electronics Engineering

Toggle sidebar
bg1
COE/EE 244
Logic Circuit Lab Lab #5; Page 1/3
Spring 2003
Combinational Circuits Using VHDL
Due: By 6:00pm on Wednesday April 16.
In this lab we introduce the use of a design language that can simplify the design process.
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
HDL’s in section 4.7
The program structure of VHDL consists of two basic parts. The entity is simply a declaration of the
module’s inputs and outputs. The architecture containsa detailed description of the module’s behavior.
library IEEE;
use IEEE.std_logic_1164.all;
entity sam is
port (
A: in STD_LOGIC;
B: in STD_LOGIC;
C: in STD_LOGIC;
D: in STD_LOGIC;
X: out STD_LOGIC;
Y: out STD_LOGIC
);
end sam;
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;
2 Programming VHDL with Xilinx Tools
Xilinx ISE Design Manager allows you to work in either schematic based, or HDL based design entry
environments, but you must declare the type of design entry when you start a new project. When working
pf3

Partial preview of the text

Download VHDL Programming for Combinational Circuits: Logic Circuit Lab #5 and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity!

Logic Circuit Lab Spring 2003

Combinational Circuits Using VHDL

Due: By 6:00pm on Wednesday April 16.

In this lab we introduce the use of a design language that can simplify the design process.

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 HDL’s in section 4. The program structure of VHDL consists of two basic parts. The entity is simply a declaration of the module’s inputs and outputs. The architecture contains a detailed description of the module’s behavior.

library IEEE; use IEEE.std_logic_1164.all;

entity sam is port ( A: in STD_LOGIC; B: in STD_LOGIC; C: in STD_LOGIC; D: in STD_LOGIC; X: out STD_LOGIC; Y: out STD_LOGIC ); end sam;

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;

2 Programming VHDL with Xilinx Tools

Xilinx ISE Design Manager allows you to work in either schematic based, or HDL based design entry environments, but you must declare the type of design entry when you start a new project. When working

Logic Circuit Lab Spring 2003

in the schematic based “flow” you can not add VHDL files to the project, even though you can access the HDL editor. Similarly you can not add schematics to a project declared as HDL based flow. 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 filename. 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.

3 Switch Matrix to Seven Segment Converter

In this lab we will be designing logic circuits that convert a pressed switch in a 2 by 2 switch matrix to a seven segment code. This in turn can drive a seven segment display in order to produce a visual indication of which switch was pressed. Figure 1 shows the organization of the system. We will first focus on the operation of the switch matrix. If no switch is pressed, all the inputs, r 1 , r 2 , c 1 , and c 2 will be high since they are connected to

CE

Logic Functions in the FPGA

CA

CB

CC

CD

CF CG

CA CB CC CD CE CF CG

r

r

c c

SW3 SW

SW1 SW

Vcc

Figure 1: A 2x2 Switch Matrix

Vcc through pull-up resistors. If any one switch is pressed, then either r 1 or r 2 and either c 1 or c 2 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.