11 eeng 1920 introduction to vhdl. 22 hardware description language a computer language used to...

56
1 EENG 1920 Introduction to VHDL

Upload: gervais-douglas

Post on 08-Jan-2018

220 views

Category:

Documents


0 download

DESCRIPTION

33 VHDL History Developed by defense contractors as a standard for programming circuits. Currently defined by IEEE Standard Related standard for certain data types is IEEE Standard

TRANSCRIPT

Page 1: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

11

EENG 1920

Introduction to VHDL

Page 2: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

22

Hardware Description Language

• A computer language used to design circuits with text-based descriptions of the circuits.

• VHDL (VHSIC Very High Speed Integrated Circuit Hardware Description Language) is the industry-standard language used for programming PLDs.

Page 3: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

33

VHDL History

• Developed by defense contractors as a standard for programming circuits.

• Currently defined by IEEE Standard 1076-1993.

• Related standard for certain data types is IEEE Standard 1164-1993.

Page 4: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

44

VHDL

• Used to describe the structure or behavior of hardware.

• Describes how the hardware should operate (modeling).

• Describes how how the hardware should be built (synthesis).

Page 5: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

55

VHDL

• In VHDL the designer enters text according to the syntax of the language.

• Syntax: The rules of construction, or “grammar”, of a programming language.

Page 6: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

66

Entity and Architecture

• Two basic constructs required for all VHDL code.

• The entity declaration describes the inputs and outputs.

• The architecture body defines the relationships between the inputs and outputs.

Page 7: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

77

VHDL Entity

• Defines the external aspects of the function.• Each input or output is a port.

– IN refers to a port used only for input.– OUT refers to a port used only for output

Page 8: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

8

VHDL Entity Declaration

8

AC BC AB Y

AB

AC

BC

ENTITY majority_vote IS PORT( a, b, c: IN BIT; y : OUT BIT);END majority_vote;

Page 9: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

99

VHDL Architecture Body

ARCHITECTURE maj_vote OF majority vote ISBEGIN y <= (a and b) or (b and c) or (a and c);END maj_vote;

AC BC AB Y

AB

AC

BC

Page 10: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

1010

Boolean Operators in VHDL

• AND, OR, NOT, NAND, NOR, XOR, and XNOR are represented as written.

• VHDL has no order of precedence for Boolean operators.

• Expressions must be written explicitly with parentheses.

Page 11: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

1111

Boolean Operators Example

• • Y <= (a and(not b)) or ((not a) and b and (not

c));• • Y <= not((a and b) or ((not a) and (not c)) or d);

CBA B AY

DCAAB Y

Page 12: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

Using Xilinx ISE 8.1i

12

Page 13: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

Using Xilinx ISE 8.1i1. Start/All Programs2. Locate Modelsim / license Wizard(Click)

13

Page 14: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

Using Xilinx ISE 8.1i

3. Click Continue

14

Page 15: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

Using Xilinx ISE 8.1i

4. Click OK (Window should be as shown)

15

Page 16: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

Using Xilinx ISE 8.1i

5. Click Yes

16

Page 17: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

Using Xilinx ISE 8.1i6. Click OK

17

Page 18: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

Using Xilinx ISE 8.1i7. Click OK8. Repeat steps 1-7 one more time.

18

Page 19: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

Using Xilinx ISE 11.1

19

Page 20: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

Using Xilinx ISE 11.1

1. Before beginning, license your Xilinx ISE. 2. Double click on Xilinx ISE 11.1.3. Click oK on “NO license” window.4. Click on Help.5. Click on Manage license.6. In the XILINX_LICENSE_FILE type: [email protected]. Click Set8. In the LM_ LICENSE_FILE type: [email protected]. Click Set10. Click Close

20

Page 21: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

21

VHDL EntryIf we choose VHDL as the design entry, we can use any text editor tool to create and edit the VHDL code and then add the VHDL file into an ISE project. For example, you can open Notepad, type (or cut and paste) in the following VHDL code, and save the model as a file such as ccb2.vhd (be sure to remove any .txt extension that Notepad adds at the end of the file name).library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_ARITH.all; use IEEE.std_logic_UNSIGNED.all;

entity CCB2 is Port ( Din0 : in STD_LOGIC; Din1 : in STD_LOGIC; Sel : in STD_LOGIC; Dout : out STD_LOGIC);

end CCB2;

architecture Behavioral of CCB2 is

begin Dout <= (Din0 and not Sel) or (Din1 and Sel);

end Behavioral;

Page 22: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

22

New Project

1. Start Xilinx ISE 8.1i project navigator by double clicking the ISE icon on your desktop.

2. Click on File and select New project

Page 23: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

23

Project window3. Name your project and project location, then click next

Page 24: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

24

New Project Wizard4. The Spartan Starter Kit PCB board uses a Xilinx Spartan3 XCS200

FPGA chip which is packaged in a flat thin 256-pin (FT256) ball Grid Array. Set these values the new project Wizard window,

Page 25: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

25

Create New Source 5. We will add our sources to this project later, so here we skip the

following two steps (create source and add source). Click on Next.

Page 26: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

26

Project Summary6. Check the project summary and click Finish

Page 27: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

27

VHDL7. Now we will create a blank sheet for schematic capture. First,

click the project and new Source menu.

Page 28: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

28

VHDL2. Click VHDL Module and type in the name for your

schematic. Select add to project before clicking Next.

Page 29: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

VHDL

29

We will program this circuit in VHDL

Page 30: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

30

VHDL3. Define the Module

Page 31: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

31

VHDL4. Check over the summary and click on Finish

Page 32: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

32

VHDL5. Now an empty VHDL file has been created which already has the entity and skeleton of the architecture. Type in your VHDL codes in architecture and complete your design. After you finish the design, save the file.

Page 33: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

33

Design Verification

Page 34: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

34

Design Verification

1. Select Behavioral Simulation and double click on CCB2.sch

Page 35: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

35

Design Verification2. Expand ModelSim Simulator and double click on Double click on

Simulate Behavioral Model

Page 36: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

36

Design Verification3. This is the window that appears

Page 37: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

37

Design Verification4. At VSIM2> type in force signal-name state-value time as

shown. Enter after run will run the simulation.

Page 38: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

38

Synthesize the Design

Page 39: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

39

Synthesize the Design1. Click on Xilinx-ISE to get Design Summary and select as shown by

the arrows

Page 40: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

40

Synthesize the Design2. Right click as shown by the arrow and click on run. A design

is produced.

Page 41: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

41

Synthesize the Design3. Select Project/New Source

Page 42: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

42

Synthesize the Design4. Click as shown, type in the File name and click

on Next.

Page 43: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

43

Synthesize the Design5. This window appears, click on Next.

Page 44: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

44

Synthesize the Design6. This window appears, click on Finish

Page 45: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

45

Synthesize the Design7. The design summary appears, click as shown by the arrow. We will assign

pin numbers

Page 46: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

46

Synthesize the Design

8.

Page 47: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

47

Synthesize the Design

9.After saving the pin arrangement, click on OK

Page 48: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

48

Synthesize the Design10. After the constraints file has been completed, right click on

Implement Design and select Run.

Page 49: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

49

Synthesize the Design11. Right click on Generate Programming file and select Run

Page 50: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

50

Synthesize the Design12. Finally, an FPGA configuration data (*.bit) file is generated.

Page 51: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

51

Download and Verify The Design

Page 52: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

52

Download and Verify The DesignThis is the last step in the design verification process. This section provides instructions for downloading the MUX design onto the Spartan 3 PCB.

1) Connect the 5V DC power cable to the power input on the demo board (J4). (note: you may see a sequence of numbers begin to flash on the 7-segment LEDs, this is just a test configuration stored in the flash memory on the PCB and you can manipulate the various switches and button, except for the PROG button, on the PCB to see the operation of the LEDs and 7-segment displays).

2) Connect the download cable between the PC parallel port and the demo board (J7). 3) Select Synthesis/Implementation from the drop-down list in the Sources window and select Mux_Schematic or Mux_vhdl (or whatever you named you design) in the Sources Window. In the Processes window, expand the Generate Programming File process and double-click the Configure Device (iMPACT) process.

Page 53: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

53

Download and Verify The Design1. Processes window, expand the Generate Programming File

process and double-click the Configure Device (iMPACT) process.

Page 54: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

54

Download and Verify The Design2. iMPACT opens and the Configure Devices dialog box is displayed. In the

Welcome dialog box, select Configure devices using Boundary-Scan (JTAG). Verify that Automatically connect to a cable and identify Boundary-Scan chain is selected. Click Finish.

Page 55: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

55

Download and Verify The Design3. When programming is complete, the Program Succeeded

message is displayed.

Page 56: 11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits

56

Download and Verify The Design

4. Close iMPACT without saving. Your design is downloaded into the FPGA and you can begin to verify the design by manipulating swithes/buttons and observing LEDs as specified in your design.