10.3  Syntax and Semantics of VHDL

Chapter  start   Previous page  Next  page

10.3  Syntax and Semantics of VHDL

We might define the syntax of a very small subset of the English language in Backus-Naur form (BNF) using constructs as follows:

sentence ::= subject verb object.
subject  ::= The|A noun 
object   ::= [article] noun {, and article noun}
article  ::= the|a
noun     ::= man|shark|house|food
verb     ::= eats|paints

::= means "can be replaced by" 
|   means "or" 
[]  means "contents optional"
{}  means "contents can be left out, used once, or repeated"

The following two English sentences are correct according to these syntax rules:

A shark eats food.
The house paints the shark, and the house, and a man.

We need semantic rules to tell us that the second sentence does not make much sense. Most of the VHDL LRM is dedicated to the definition of the language semantics. Appendix A of the LRM (which is not officially part of the standard) explains the complete VHDL syntax using BNF.

The rules that determine the characters you can use (the "alphabet" of VHDL), where you can put spaces, and so on are lexical rules [VHDL LRM13]. Any VHDL description may be written using a subset of the VHDL character set:

basic_character ::= upper_case_letter|digit|special_character
	|space_character|format_effector

The two space characters are: space ( SP ) and the nonbreaking space ( NBSP ). The five format effectors are: horizontal tabulation ( HT ), vertical tabulation ( VT ), carriage return ( CR ), line feed ( LF ), and form feed ( FF ). The characters that are legal in VHDL constructs are defined as the following subsets of the complete character set:

graphic_character ::=
	 upper_case_letter|digit|special_character|space_character
	|lower_case_letter|other_special_character
special_character ::= " # & ' () * + , - . / : ; < = > [ ] _ |

The 11 other special characters are: ! $ % @ ? \ ^ ` { } ~ , and (in VHDL-93 only) 34 other characters from the ISO Latin-1 set [ISO, 1987]. If you edit code using a word processor, you either need to turn smart quotes off or override this feature (use Tools... Preferences... General in MS Word; and use CTRL-' and CTRL-" in Frame).

When you learn a language it is difficult to understand how to use a noun without using it in a sentence. Strictly this means that we ought to define a sentence before we define a noun and so on. In this chapter I shall often break the "Define it before you use it" rule and use code examples and BNF definitions that contain VHDL constructs that we have not yet defined. This is often frustrating. You can use the book index and the table of important VHDL constructs at the end of this chapter (Table 10.28) to help find definitions if you need them.

We shall occasionally refer to the VHDL BNF syntax definitions in this chapter using references--BNF [10.1], for example. Only the most important BNF constructs for VHDL are included here in this chapter, but a complete description of the VHDL language syntax is contained in Appendix A.


Chapter  start   Previous  page   Next  page

Trimble
Teledyne Optech
University of Denver GIS Masters Degree Online
CADalog.com - Countless CAD add-ons, plug-ins and more.



Internet Business Systems © 2016 Internet Business Systems, Inc.
595 Millich Dr., Suite 216, Campbell, CA 95008
+1 (408)-337-6870 — Contact Us, or visit our other sites:
AECCafe - Architectural Design and Engineering EDACafe - Electronic Design Automation TechJobsCafe - Technical Jobs and Resumes  MCADCafe - Mechanical Design and Engineering ShareCG - Share Computer Graphic (CG) Animation, 3D Art and 3D Models
  Privacy Policy