1ECET 331 – Digital Integrated CircuitsChapter 5Introduction to VHDLECET 331 - Digital Integrated CircuitsVHDLz Hardware Description Language (HDL)• A computer language used to design circuits with text-based descriptions of the circuits. z VHDL• VHSIC Hardware Description Languagez VHSIC• Very High Speed Integrated Circuitz ASIC• Application-Specific Integrated Circuitz Digital designs which are constructed for a specific purposeECET 331 - Digital Integrated CircuitsVHDL Historyz Developed by defense contractors as a standard for programming circuits.z Currently defined by IEEE Standard 1076-1993.z Related standard for certain data types is IEEE Standard 1164-1993.ECET 331 - Digital Integrated CircuitsVHDL (1)z Used to describe the structure or behavior of hardware.z Describes how the hardware should operate (modeling).z Describes how the hardware should be built (synthesis).ECET 331 - Digital Integrated CircuitsVHDL (2)z In VHDL the designer enters text according to the syntax of the language.z Syntax: The rules of construction, or “grammar”, of a programming language.ECET 331 - Digital Integrated CircuitsEntity and Architecturez Two basic constructs required for all VHDL code.z The ENTITY declaration describes the inputs and outputs.z The ARCHITECTURE body defines the relationships between the inputs and outputs.2ECET 331 - Digital Integrated CircuitsVHDL Entityz Defines the external aspects of the function.z Each input or output is a port.z The type of port is defined by mode.ECET 331 - Digital Integrated CircuitsVHDL Entity AC BC AB Y ++=ECET 331 - Digital Integrated CircuitsVHDL Entity DeclarationENTITY majority_vote ISPORT(a, b, c : IN BIT;y : OUT BIT);END majority_vote;Industry practiceAlthough VHDL is not case-sensitive,VHDL keywords are usually writtenin all-capsECET 331 - Digital Integrated CircuitsPort Typesz IN refers to a port used only for input.z OUT refers to a port used only for output. z BIT refers to the port type.z A port designated as type BIT can have a value of either ‘0’ or ‘1’ .ECET 331 - Digital Integrated CircuitsVHDL Architecture BodyARCHITECTURE my_logic OF majority vote ISBEGINy <= (a and b) or (b and c) or (a and c);END my_logic;ECET 331 - Digital Integrated CircuitsBoolean Operators in VHDL z AND, OR, NOT, NAND, NOR, XOR, and XNOR are represented as written.z VHDL has no order of precedence for Boolean operators.z Expressions must be written explicitly with parentheses.3ECET 331 - Digital Integrated CircuitsBoolean Operators ExampleY <= (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 ++=ECET 331 - Digital Integrated CircuitsSignal Concurrencyz Concurrent means simultaneous.z The statements in an architecture body are evaluated at the same time, they are not dependent on the order in which they are written.z A change in one input common to several circuits affects all the circuits at the same time.ECET 331 - Digital Integrated CircuitsSignal ConcurrencyECET 331 - Digital Integrated CircuitsSignal Concurrency Examplez The order in which the statements are written is not important.z Both are executed at the same time.z This is how the hardware behaves.b; and a carry_outb; xora sum<=<=ECET 331 - Digital Integrated CircuitsMaking a VHDL File in Quartus II (1)z Created using the Quartus II Text Editorz Start a New File.z Select VHDL File from the Device Design Files tab.z The text editor automatically opens.ECET 331 - Digital Integrated CircuitsMaking a VHDL File in Quartus II (2)4ECET 331 - Digital Integrated CircuitsMaking a VHDL Filein Quartus II (3)z VHDL code is entered in the Text Editor window.z For reference, the text editor will number each line of code.z Save and compile your completed VHDL code.ECET 331 - Digital Integrated CircuitsMaking a VHDL Filein Quartus II (4)ECET 331 - Digital Integrated CircuitsSimulation Follow the process used for simulating a graphic design.ECET 331 - Digital Integrated CircuitsAssigning Pin Numbers Assigning pin numbers follows the same process for assigning pin numbers for a graphic design. ECET 331 - Digital Integrated CircuitsValid Names in VHDL – 2 z A valid name in Quartus is called a name identifier.z All ports, signals, variables, entity names, architecture bodies, or similar objects must use names that are recognized by Quartus.ECET 331 - Digital Integrated CircuitsValid Names in VHDL – 3 z VHDL is not case sensitive.z Name identifiers consists of a letter followed by any number of letters or numbers.z A space in a name is considered invalid.5ECET 331 - Digital Integrated CircuitsValid Names in VHDL z VHDL keywords should be capitalized.z User names should be written in lowercase.z An underscore can be written within a name but cannot start or end the name.z Two consecutive underscores are not permitted.ECET 331 - Digital Integrated CircuitsReserved Keywords z Reserved keywords are words that have a specific function in VHDL.z They cannot be used as object names.z A complete listing of the VHDL reserved keyword can be found in the Quartus II Help File and in your textbookECET 331 - Digital Integrated CircuitsCommentsz A comment is explanatory text that is ignored by the compiler.z Comments are preceded by two consecutive hyphens.z Example: -- this is a comment.ECET 331 - Digital Integrated CircuitsPort Modes (1)z Defines the ports direction of data flow.z IN - data flows from an INPUT pin to the CPLD's logic.z OUT – data flows from the CPLD's logic to an OUTPUT.z INOUT - refers to a bidirectional port that allows data to flow in both directions.ECET 331 - Digital Integrated CircuitsPort Modes (2)z BUFFER refers to a special case of OUT that has a feedback connection back into the CPLD logic that allows the port value to be changed by the CPLD.ECET 331 - Digital Integrated CircuitsPort Modes (3)6ECET 331 - Digital Integrated CircuitsPort Modes (4)ECET 331 - Digital Integrated CircuitsTypez A type in VHDL is a property applied to a port, signal or variable that defines what values the object can have.z Common types: BIT, STD_LOGIC and INTEGER.ECET 331 - Digital Integrated CircuitsBIT z BIT can have only two values ‘0’ and ‘1’.z Values are placed in single quotes. ECET 331 - Digital Integrated CircuitsBIT_VECTOR z BIT_VECTOR: a one-dimensional array of elements, each of type BIT.z The range of the array is indicated by listing its upper and lower bounds.d: IN BIT_VECTOR (3 downto 0);ECET
View Full Document