📄 ch10.03.htm
字号:
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac">
<TITLE> 10.3 Syntax and Semantics of VHDL</TITLE>
</HEAD><!--#include file="top.html"--><!--#include file="header.html"--><br><!--#include file="AmazonAsic.html"-->
<P><A NAME="pgfId=325261"></A><A HREF="CH10.htm">Chapter start</A> <A HREF="CH10.02.htm">Previous
page</A> <A HREF="CH10.04.htm">Next page</A></P>
<H2>10.3 Syntax and Semantics of VHDL</H2>
<P><P CLASS="BodyAfterHead"><A NAME="pgfId=10796"></A>We might define the
syntax of a very small subset of the English language in Backus-Naur form
(BNF) using constructs as follows:</P>
<PRE>
sentence ::= subject verb object.
subject ::= <B>The</B>|<B>A</B> noun
object ::= [article] noun {, <B>and</B> article noun}
article ::= <B>the</B>|<B>a</B>
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"</PRE>
<P><P CLASS="Body"><A NAME="pgfId=10811"></A>The following two English sentences
are correct according to these syntax rules:</P>
<PRE><B>A </B>shark eats food.
<B>The</B> house paints <B>the</B> shark, <B>and</B> <B>the</B> house, <B>and</B> <B>a </B>man.</PRE>
<P><P CLASS="Body"><A NAME="pgfId=14295"></A>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.</P>
<P><P CLASS="Body"><A NAME="pgfId=222693"></A>The rules that determine the
characters you can use (the "alphabet" of VHDL), where you can
put spaces, and so on are lexical rules [<A HREF="../../VHDL/LRM/HTML/1076_13.HTM#13">VHDL
LRM13</A>]. Any VHDL description may be written using a subset of the VHDL
character set:</P>
<PRE>basic_character ::= upper_case_letter|digit|special_character
|space_character|format_effector</PRE>
<P><P CLASS="BodyAfterHead"><A NAME="pgfId=222705"></A>The two space characters
are: space (<CODE> SP</CODE> ) and the nonbreaking space (<CODE> NBSP</CODE>
). The five format effectors are: horizontal tabulation (<CODE> HT</CODE>
), vertical tabulation (<CODE> VT</CODE> ), carriage return (<CODE> CR</CODE>
), line feed (<CODE> LF</CODE> ), and form feed (<CODE> FF</CODE> ). The
characters that are legal in VHDL constructs are defined as the following
subsets of the complete character set:</P>
<PRE>graphic_character ::=
upper_case_letter|digit|special_character|space_character
|lower_case_letter|other_special_character
special_character ::= " # & ' () * + , - . / : ; < = > [ ] _ |</PRE>
<P><P CLASS="BodyAfterHead"><A NAME="pgfId=230030"></A>The 11 other special
characters are: <CODE>! $ % @ ? \ ^ ` { } ~</CODE> ,<CODE> </CODE>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 <CODE>CTRL-'</CODE> and <CODE>CTRL-"</CODE>
in Frame).</P>
<P><P CLASS="Body"><A NAME="pgfId=278620"></A>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.</P>
<P><P CLASS="Body"><A NAME="pgfId=340457"></A>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.</P>
<P><HR ALIGN="LEFT"></P>
<P><A HREF="CH10.htm">Chapter start</A> <A HREF="CH10.02.htm">Previous page</A> <A HREF="CH10.04.htm">Next page</A>
</BODY>
<!--#include file="Copyright.html"--><!--#include file="footer.html"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -