VHDL 1 ©Paul Godin Modified February 2011 Quartus II Version February 2011.

Slides:



Advertisements
Similar presentations
3-13 Alternate Logic-Gate Representations
Advertisements

Digital Design with VHDL Presented by: Amir Masoud Gharehbaghi
1 Lecture 13 VHDL 3/16/09. 2 VHDL VHDL is a hardware description language. The behavior of a digital system can be described (specified) by writing a.
History TTL-logic PAL (Programmable Array Logic)
Introduction to VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T1: Combinational Logic Circuits.
02/02/20091 Logic devices can be classified into two broad categories Fixed Programmable Programmable Logic Device Introduction Lecture Notes – Lab 2.
Introduction to VHDL Multiplexers. Introduction to VHDL VHDL is an acronym for VHSIC (Very High Speed Integrated Circuit) Hardware Description Language.
Introduction to VHDL CSCE 496/896: Embedded Systems Witawas Srisa-an.
Verilog Lab This presentation includes some material that is selected from BUCKNELL VERILOG HANDBOOK. Instructor: Dr. Charles Liu Prepared by John Ren.
1/31/20081 Logic devices can be classified into two broad categories Fixed Programmable Programmable Logic Device Introduction Lecture Notes – Lab 2.
VLSI Design Lab Introduction
Chapter 5 Boolean Algebra and Reduction Techniques William Kleitz Digital Electronics with VHDL, Quartus® II Version Copyright ©2006 by Pearson Education,
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Chapter 4 Programmable Logic Devices: CPLDs with VHDL Design Copyright ©2006 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights.
Advanced Digital Circuits ECET 146 Week 3 Professor Iskandar Hack ET 221B,
A First Program Using C#
StateCAD FPGA Design Workshop. For Academic Use Only Presentation Name 2 Objectives After completing this module, you will be able to:  Describe how.
 Seattle Pacific University EE Logic System DesignCADNumbers-1 Arithmetic and CAD Tools CAD tools work great with arithmetic functions Adding,subtracting,multiplying,
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.
CPLD 1.1 ©Paul R. Godin Last Mod: Dec 2013 gmail.com.
1 Part I: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
Introduction to Chapter 6  Digital circuits are frequently used for arithmetic operations  Fundamental arithmetic operations on binary numbers and digital.
Shannon decomposition William Sandqvist Claude Shannon mathematician / electrical engineer (1916 –2001) William Sandqvist
Chapter 4 Programmable Logic Devices: CPLDs with VHDL Design Copyright ©2006 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights.
Copyright © 1997 Altera Corporation & 提供 What is VHDL Very high speed integrated Hardware Description Language (VHDL) –is.
Introduction to Chapter 3  Now that we understand the concept of binary numbers, we will study ways of describing how systems using binary logic levels.
Basic Overview of VHDL Matthew Murach Slides Available at:
CPLD Design Basics Note: We use the Altera CPLD design software in this course. Please see the Altera web site ( for more details on their.
Fall 08, Oct 31ELEC Lecture 8 (Updated) 1 Lecture 8: Design, Simulation Synthesis and Test Tools ELEC 2200: Digital Logic Circuits Nitin Yogi
Copyright © 1997 Altera Corporation 6/5/2016 P.1 AHDL Training Class Danny Mok Altera HK FAE
Introduction to VHDL Spring EENG 2920 Digital Systems Design Introduction VHDL – VHSIC (Very high speed integrated circuit) Hardware Description.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
Copyright © 1997 Altera Corporation 11/20/2015 P.1 Beginner VHDL Training Class Danny Mok Altera HK FAE
Electrical and Computer Engineering University of Cyprus LAB 1: VHDL.
HARDWARE DESCRIPTION LANGUAGE (HDL). What is HDL? A type of programming language for sampling and modeling of electronic & logic circuit designs It can.
Copyright © 1997 Altera Corporation & 提供 Beginner VHDL Training Class Danny Mok Altera HK FAE
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
EE3A1 Computer Hardware and Digital Design Lecture 2 Introduction to VHDL.
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
Chapter 5 Introduction to VHDL. 2 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
L19 – Resolved Signals. Resolved Signals  What are resolved signals In systems In VHDL Resolution – Isn’t that for resolving conflicts?  Ref: text Unit.
ELEE 4303 Digital II Introduction to Verilog. ELEE 4303 Digital II Learning Objectives Get familiar with background of HDLs Basic concepts of Verilog.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
ECOM 4311—Digital System Design with VHDL
11 EENG 1920 Introduction to VHDL. 22 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
Digital Design Using VHDL and PLDs ECOM 4311 Digital System Design Chapter 1.
VHDL ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
1 Multiplexers (Data Selectors) A multiplexer (MUX) is a device that allows several low-speed signals to be sent over one high-speed output line. “Select.
May 9, 2001Systems Architecture I1 Systems Architecture I (CS ) Lab 5: Introduction to VHDL Jeremy R. Johnson May 9, 2001.
Chapter – 8 Software Tools.
© 2000 Altera Corporation 1 Quartus Simulator. © 2000 Altera Corporation Dow load from: 2 In This Section Simulator –Features –Supported.
Copyright © 2007 by Pearson Education 1 UNIT 6A COMBINATIONAL CIRCUIT DESIGN WITH VHDL by Gregory L. Moss Click hyperlink below to select: Tutorial for.
ECE 332 Digital Electronics and Logic Design Lab Lab 3 Introduction to Starter Kit ECE 332 George Mason University.
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
EMT 351/4 DIGITAL IC DESIGN Week # 1 EDA & HDL.
EET 1131 Unit 4 Programmable Logic Devices
Basic Language Concepts
Systems Architecture Lab: Introduction to VHDL
Subject Name: FUNDAMENTALS OF HDL Subject Code: 10EC45
Design Entry: Schematic Capture and VHDL
Introduction to Programmable Logic
Advanced Digital design
Programmable Logic Devices: CPLDs and FPGAs with VHDL Design
VHDL 1. ver.7a VHDL1 INTRODUCTION TO VHDL (VERY-HIGH-SPEED-INTEGRATED-CIRCUITS HARDWARE DESCRIPTION LANGUAGE) KH WONG (w2 begins) (Some pictures are.
Instructions to get MAX PLUS running
Topics Introduction Hardware and Software How Computers Store Data
VHDL Introduction.
Founded in Silicon Valley in 1984
Digital Fundamentals Floyd Chapter 4 Tenth Edition
Presentation transcript:

VHDL 1 ©Paul Godin Modified February 2011 Quartus II Version February 2011

VHDL VHDL (VHSIC Hardware Description Language) is a standardized programming language used for designing circuits used with CPLDs. VHSIC (Very High Speed Integrated Component). VHDL is a standard described in the IEEE (available here: or ). Being a standard allows VHDL designs to be transportable. vhdl 1.2

Quartus II and AHDL Altera is a leading manufacturer of programmable logic devices.Altera Altera also produces design software including Quartus II. Quartus II belongs to a category of software tools called EDA (Electronic Design Automation). EDA software incorporates device software, analysis tools and physical circuit design. VHDL is an integral part of EDA. Altera utilizes the VHDL standard but also has a modified version, simplified it for its own use: AHDL (Altera Hardware Design Language).Altera AHDL utilizes basic elements and structure of the VHDL standard. vhdl 1.3

Text / VHDL design ◊Text/VHDL design is used when graphically designing the circuit is time-consuming or difficult in a graphical format. ◊VHDL is as simple or as complex as the user wants to get. ◊Many aspects of VHDL design resemble other programming languages such as C++. vhdl 1.4

Text Editing Advantages of text editing: –Much more flexibility in design, as there are no restrictions to the graphic elements available. –Faster to design a circuit based on input and output criteria. For instance, if a truth table is known, it can be entered directly without conversion to a circuit diagram. Circuit models and templates can be used as guidelines and to speed up code entry. vhdl 1.5

VHDL Application Examples ◊Some examples where a problem may be more easily adapted to VHDL: Boolean Expression: YCBA Truth Table Flowchart: — I08i — kjj9ojio3Ojoo9fc9ioj49\Ojkoj99oou9u9ujj0-\O0-0i04]ii0oi opi230u [u50u =9= ’ Program: Decoder vhdl 1.6

Utilizes EDIF (Electronic Design Interchange Format) and other design and language standards that are actively maintained by the industry. These designs are portable. Virtual hardware designs can be sent, copied and shared between users and manufacturer platforms. Advantages of Text Editing vhdl 1.7

Advantages of VHDL Design ◊Standards-based, transportable to other platforms. ◊Easier for design modifications. ◊Easiest for direct entry of truth table results or Boolean entry. ◊Structure is very similar to other programming languages. ◊Easier for users with an intermediate to advanced digital electronics background. ◊With experience is less time consuming for more complex circuits. ◊Easy to translate flowcharts into a functional circuit design. ◊Greater control of practical issues such as time delays, latency, design changes, etc. ◊With a template or example, can be quite easy to use. vhdl 1.8

Disadvantages of VHDL Design ◊Requires an intermediate to advanced background in digital electronics. ◊Requires specific knowledge of the structure and syntax of the language. ◊Recommend some experience with programming languages. ◊May be more difficult to visualize and troubleshoot a design. ◊Some digital processes may be difficult to incorporate into a VHDL design (may be easier to use graphical templates such as shift registers, etc…). vhdl 1.9

vhdl 1.10

Mastering VHDL is not an easy process, and requires extensive study. As with any new programming language, there are different levels of programming mastery. We will look at an introductory approach toward using VHDL/AHDL. Mastering Text Editing Note: Please ensure you have loaded the Quartus II software from Altera and have licensed the software vhdl 1.11

1-Open Quartus II 2-Create a VHDL file: New VHDL File Method for creating a logic design using the Text Editor in Quartus II: vhdl 1.12

Device Select 3-Save the file. The software will ask to save the file as a project (may be accepted). On page 3 of 5 enter the device family (MAX7000S) and the Device. Select: EPM7064SLC44-10 Click through the next screens vhdl 1.13

Using the Quartus II Software 4- Design the circuit VHDL designs can be relatively simple, and learning VHDL is very similar to learning other programming languages: ◊Greater proficiency comes with study and experience ◊Sample designs can be used as guides to new designs ◊Every detail is important ◊Structuring and proper formatting helps with the design and troubleshooting processes ◊Comments can be added to aid future designers or troubleshooters vhdl 1.14

VHDL STRUCTURE vhdl 1.15

Text File Basic Structure of VHDL Entity Architecture Defines the inputs and outputs Contains the logic processes Library Defines the source used to translate and resolve the language used in the design process. vhdl 1.16

Basic Rules ◊Comment Lines ◊A double-dash precedes comment lines: -- this is a comment line ◊Not case sensitive. Recommend: ◊All caps for VHDL keywords ◊Small letters for variables vhdl 1.17

ENTITY: Library Clause ◊Defines the VHDL Library utilized ◊Used with VHDL/AHDL design library IEEE; use IEEE.std_logic_1164.all; The library file contains the source used to convert between the design interface and the device hardware. vhdl 1.18

ENTITY: Port ◊A PORT is the input or output of a logic function. ◊Port MODES define whether a value is an input or an output. ◊Port TYPES defines the electrical value the input or output may have. vhdl 1.19

Entity: Port MODES IN OUT INOUT BUFFER Input Only Output Only Input or Output (based on a control input) Output with a feedback to internal logic Control vhdl 1.20

Entity: Port TYPES U…Un-initialized X…Forcing Unknown 0…Forcing Low 1…Forcing High Z…High Impedance W…Weak Unknown L…Weak Low H…Weak High -…Don’t Care Forcing: Gate output voltage Weak: Used with Pull-up Z: Tri-stated output vhdl 1.21

Entity: TYPES TypeValuesQuotesExamples BIT0 or 1Single‘0’, ‘1’ STD_LOGICU,X,0,1,Z,W,L,H,-Single‘0’, ‘1’, ‘Z’,… INTEGERNumbersNone654, -235, 3,… BIT_VECTORBinary number (bit string) Double“10110” STD_LOGIC_VECTORMultiple values for all types Double“0Z1011” “10110” “ZZZZ” vhdl 1.22

ENTITY Example: Separate Variables Library IEEE; USE IEEE.std_logic_1164.all; ENTITY sample IS PORT ( a0, a1:INSTD_LOGIC; y0, y1, y2:OUTSTD_LOGIC ); END sample; vhdl 1.23

ENTITY Example: Vectors LIBRARY IEEE; USE IEEE.std_logic_1164.all; ENTITY sample IS PORT ( a:INSTD_LOGIC_VECTOR (1 downto 0); y:OUTSTD_LOGIC_VECTOR (2 downto 0) ); END sample; vhdl 1.24

ENTITY: Template (from Quartus II software) Note: Fill in what your design requires and delete what isn’t needed. vhdl 1.25 LIBRARY __library_name; ENTITY __entity_name IS GENERIC(__parameter_name : string := __default_value; __parameter_name : integer:= __default_value); PORT( __input_name, __input_name: INSTD_LOGIC; __input_vector_name: IN STD_LOGIC_VECTOR(__high downto __low); __bidir_name, __bidir_name: INOUT STD_LOGIC; __output_name, __output_name: OUTSTD_LOGIC); END __entity_name;

Architecture ◊Contains the logic operation of your design. ◊Can be written as: ◊Boolean equations ◊CASE statements (similar to Function/Truth Tables) ◊IF/ELSE statements ◊Other statements (See Templates in the Software) vhdl 1.26

Architecture Name ◊The architecture section requires: ◊A name ◊A reference to the entity file ◊BEGIN and END vhdl 1.27

Boolean Functions ◊Boolean functions can be entered directly into the Architecture section. ◊Rules of precedence must be forced through the use of brackets. vhdl 1.28

Architecture Examples: Boolean ARCHITECTURE sample OF sample1 IS BEGIN y0 <= (a1) and (a0); y1 <= (not a1) and (not a0); y2 <= (not a1) and (a0); END sample Note: A common source of error is unpaired brackets. vhdl 1.29

Architecture Examples: Separate Vectors ARCHITECTURE sample OF sample1 IS BEGIN y(0) <= (a(1)) and (a(0)); y(1) <= (not a(1)) and (not a(0)); y(2) <= (not a(1)) and (a(0)); END sample Note: This is assuming the use of vector entity declarations Note: A common source of error is unpaired brackets. vhdl 1.30

Architecture Example: CASE Statement ARCHITECTURE sample OF sample1 IS BEGIN y <= “001” WHEN “11”; “010” WHEN “00”; “100” WHEN “01”; “000” WHEN others; END sample Note: This is assuming the use of vector entity declarations. vhdl 1.31

vhdl 1.32

Quartus II ◊Altera’s Quartus II software is complex. It contains advanced features that are well beyond the scope of this course. ◊Its capabilities include the architectural aspects of design, timing and other analysis, special signal handling, and many other logic analysis tools. ◊In this DIGI-2 course we will strictly address how to create and program our device with basic VHDL. vhdl 1.33

Pin Planner The Pin Planner window shows the physical layout of the compiled design. The allocation of pins may be done in the Pin Planner window 1.Compile the project 2.Go to the Pin Planner window 3.Check the lines indicated in the Layout menu vhdl 1.34

Pin Planner Window vhdl 1.35 Select pins here

Pin Planner ◊Once the design has been entered, and the device and pins selected, compile the project. ◊If there are no critical errors, the chip may be physically programmed. vhdl 1.36

Report Files ◊The Quartus II compiler produces a report file that describes the results of the compilation processes. ◊Several files ending in.rpt are created. ◊These report files contain information such as the percent utilization of the device, the results of the simplification process and a view of the pin assignments (see the “fit.rpt” file). ◊The files can be reviewed and interpreted using a text editor or by using the Compilation Report button. vhdl 1.37

Report Files - Contents Compilation Status: States if the compilation process was successful. Device Summary: States # of pins, Logical Cells, and % of device used. Pin Assignments: States the design to physical pin assignments. Resource Usage, Inputs and Outputs: As implied. Logic Cells: Indicates the internal interconnects between LABs via the PIA. There are many more report options in the Quartus II Application program. Most of these are beyond the scope of this course. vhdl 1.38

Equations ◊Quartus II: ◊Open the Tools Menu ◊Select Options ◊General tab, Processing, Automatically generation equation files during compilation vhdl 1.39

Report - Equations ◊Open the file xx.fit.eqn using Notepad ◊The Quartus II software determines the Boolean equations for each output. ◊The equations are multi-layered, and additional variables are introduced including the LAB number. ◊The operators are: ◊& = AND ◊# = OR ◊! = Complement ◊$ = Ex-OR vhdl 1.40

vhdl 1.41

VHDL Examples ◊The Quartus II software and Digital Electronics textbooks contain sample code. ◊The following pages contain sample VHDL designs. vhdl 1.42

Decoder Example 1 Create a device that will perform the following functions using the Quartus II software. Use: 1.the Graphic Editor 2.the Text Editor vhdl 1.43

Decoder Example 2 Create a device that will perform the following functions using the Quartus II software. Use: 1.the Graphic Editor 2.the Text Editor vhdl 1.44

Decoder Example 3 Using the Graphic Editor and then the text editor in the Quartus II software, create a device that will perform the following functions: InputOutput ABCXY vhdl 1.45

Decoder Example 4 Using the Graphic Editor and then the text editor in the Quartus II software, create a a BCD to 7-Segment Decoder.Hint: Create a truth table, with BCD as input and 7-Segments (a,b,c,d,e,f,g) as output. See the display diagram below for information. Decoder BCD 7 Segment a b c d e f g vhdl 1.46

vhdl 1.47

Decoder Example 1 Answer LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY decoder IS PORT( a1, a0: INSTD_LOGIC; y0, y1, y2: OUTSTD_LOGIC ); END decoder; ARCHITECTURE decode OF decoder IS BEGIN y0<=(a1) and (not a0); y1<=(not a1) and (not a0); y2<=(not a1) and (a0); END decode; vhdl 1.48

Decoder Example 2 Answer (VHDL) LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY decoder IS PORT( a2, a1, a0: INSTD_LOGIC; y: OUTSTD_LOGIC ); END decoder; ARCHITECTURE decode OF decoder IS BEGIN y <=((a1) and (not a0))+((a2) and (not a1))+((a2) and (not a0)); END decode; vhdl 1.49

Decoder Example 3 Solution Solution: Input the SOP as it appears in the table. InputOutput ABCXY You may choose to simplify the SOP before entering the Boolean equation in the software, but the compiler will also simplify it. vhdl 1.50

Decoder Example 3 Answer (VHDL) LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY alarm IS PORT( c, b, a: INSTD_LOGIC; x, y: OUTSTD_LOGIC ); END alarm; ARCHITECTURE table1 OF alarm IS BEGIN x <=((not a) AND (not b) AND (c)) OR ((not a) AND (b) AND (not c) OR ((a) AND (not b) AND (c)) OR ((a) AND (b) and (not c)); y <=((a) AND (not b) AND (not c)) OR ((a) AND (not b) AND (c)); END table1; vhdl 1.51

Decoder Example 3 Answer (VHDL) ◊Once the Boolean statements are entered and the design is compiled, the software will simplify the design. ◊This simplified design can be viewed by opening the *.rpt file ◊It may also be seen using the floorplan view and clicking on the outputs. vhdl 1.52

Decoder Example 4 Solution Process for the decoder: 1.Create a Truth Table (inputs and outputs) 2.Create a VHDL file Note: using Vector Entities saves time and coding lines. vhdl 1.53

Decoder Example 4 Answer (VHDL) Without using vectors in the Entity LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY bcd_display IS PORT(d3, d2, d1, d0: INSTD_LOGIC; a, b, c, d, e, f, g: OUTSTD_LOGIC); END bcd_display; ARCHITECTURE decoder OF bcd_display IS SIGNAL input: STD_LOGIC_VECTOR (3 downto 0); SIGNAL output: STD_LOGIC_VECTOR (6 downto 0); BEGIN input <= d3 & d2 & d1 & d0; WITH input SELECT output<= “ ” WHEN “0000”, “ ” WHEN “0001”, “ ” WHEN “0010”, “ ” WHEN “0011”, “ ” WHEN “0100”, “ ” WHEN “0101”, “ ” WHEN “0110”, “ ” WHEN “0111”, “ ” WHEN “1000”, “ ” WHEN “1001”, “ ” WHEN OTHERS; a <= output (6); b <= output (5); c <= output (4); d <= output (3); e <= output (2); f <= output (1); g <= output (0); END decoder; vhdl 1.54 Note: There are some small (deliberate) errors in this file

Decoder Example 4 Answer (VHDL) Using vectors in the Entity LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY bcd_display IS PORT(d: INSTD_LOGIC_VECTOR (3 downto 0); y: OUTSTD_LOGIC_VECTOR (6 downto 0) ); END bcd_display; ARCHITECTURE decoder OF bcd_display IS BEGIN WITH a SELECT y<= “ ” WHEN “0000”,--segments a to g “ ” WHEN “0001”, --draws a 1 assuming active low display “ ” WHEN “0010”, “ ” WHEN “0011”, “ ” WHEN “0100”, “ ” WHEN “0101”, “ ” WHEN “0110”, “ ” WHEN “0111”, “ ” WHEN “1000”, “ ” WHEN “1001”, “ ” WHEN OTHERS; END decoder; vhdl 1.55 Note: There are some small (deliberate) errors in this file

End ©Paul R. Godin gmail.com vhdl 1.56