Chapter start Previous page Next page 10.3 Syntax and Semantics of VHDLWe 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 ( graphic_character ::= upper_case_letter|digit|special_character|space_character |lower_case_letter|other_special_character special_character ::= " # & ' () * + , - . / : ; < = > [ ] _ | The 11 other special
characters are: 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. |
|||||
|
|||||
|