Professional Documents
Culture Documents
I . INTRODUCTION
2.1 VHDL Language F e a t u r e s
It is a well established f a c t that the computer-aided
design (CAD) tools a r e essential f o r today's complex VHDL features three levels of abstraction t o describe
VLSI circuits. VHSIC is one of the hardware digital systems. They are, in decreasing order of
description language t h a t is recently developed t o abstraction: algorithmic or procedural style, d a t a flow
precisely describe the functional behavior of the or Register Transfer Level (RTL) style, and structural
complex VLSI circuits with ease 11-31. Among the or network description style. Structural descriptions
essential tools t h a t a r e necessary t o develop VLSI define "components" and then interconnect "instances"
circuits around VHDL a r e the simulator and a silicon of these components t o generate another component a t a
compiler. The simulator is used t o verifies the higher level of design description. Data flow
behavior of the circuits described through VHDL [41. descriptions allow behavioral description of the
The silicon compiler then translates the VHDL hardware, indicating the parallelism involved. The
functional description into a manufacturable mask file algorithm description allows the modeling of a system
[51. This paper presents the description of the without any regard t o i t s structure. Information on
simulator. Section 2 of this papers includes an the present IEEE 1076 VHDL language can be found in
introduction to VHDL; section 3 provides the [ 12-13 I.
description of the simulator; section 4 deals with the
implementation issues of the simulator; section 5 the
t e s t results; and finally the section 6 includes the 3. THE SIMULATOR
conclusions.
The complexity of a VLSI circuit makes it normally
e Proceedings
impossible f o r
- 1989 Southeastcon
40 1
a designer t o guarantee error-free
Authorized licensed use limited to: University of Management & Technology Lahore. Downloaded on May 09,2020 at 00:03:12 UTC from IEEE Xplore. Restrictions apply.
design with known performance under all operating
conditions. Simulation is an effective way of
evaluating a design and is used a t all levels of
I E r r o r Handler I
design, before the expensive and time-consuming step of
I
VHDL i n p u t S t r e a m of t o k e n s I
1, [iexical]L+
[
manufacturing s t a r t s . The function of simulation is t o
assist in the verification of hardware designs by
computing how the VHDL-described hardware will behave
in response t o a given input timing sequence. The
simulator presented in this paper consists of two
primary sections:
I I To SE
o The Analyzer
o The Simulation Executive I Symbol T a b l e 1
The structure of the simulator is shown in Figure 1.
The analyzer checks f o r the static e r r o r s in the input Figure 2. The Structure of t h e Analyzer.
VHDL description. The analyzer flags e r r o r a s and when
there is a syntactical violation of the VHDL grammar. an unrecognizable sequence of characters is
The simulation executive simulates the encountered, an error-handling routine is invoked. The
syntax-error-free VHDL description. actions taken f o r different classes of tokens a r e a s
follows:
The function of the lexical analyzer (also known a s the o Top-down parsing, which includes predictive, LL(1),
scanner) is t o read in a given VHDL t e x t , discard and recursive-descent parsing.
comments and white s p a c e (tabs, carriage return, line o Bottom-up parsing, which includes operator-precedence
feed, blanks), and generate a stream of tokens f o r the and different types of LR parsing.
next step (syntax analysis). A token is a sequence of Of these methods, look ahead left t o right scanning,
characters having a collective meaning. In VHDL, there reverse of rightmost derivation parsing (in short, LALR
a r e several classes of tokens. They a r e [12-131: parsing), which is a class of LR parsing, is used.
o Keywords, like architecture, block. This technique is selected because i t is adequate t o
o Delimiters, like '<=' (signal assignment), '\=' (not handle the VHDL grammar a s specified in [I21 and
equal). automated tools which generate parsers from a
o Identifiers, (includes names of variables, signals) description of the grammar a r e available f o r this
like R, S, COUNT. technique. An LALR parser generator, YACC [I81 is used
o Literals t o develop the syntax analyzer.
:decimal literals, like 12, 0.0, 1.OE+6.
:based literals, like 3#11-11#, 16#FF#, 8#7.71#E+2. 3.1.2.1 Basic concepts o f syntax-directed translation
:character literals, like ' A ' , I*'.
A context-free grammar is a quadruple defined a s G =
:string literals, like "setup time is too short". (N,T,P,S), where N and T a r e disjoint finite sets of
:Bit string literals, like X"FFF", 0"777", B"111". nonterminals and terminals, respectively. P is a
finite s e t of productions; each production is of the
The lexical analyzer has been developed using the Bell
form A -> a , where A is a nonterminal, and a is a
lab's automatic lexical analyzer generator, LEX [16].
string of terminals and/or nonterminals. S is a
LEX generates a function which is repeatedly invoked by
special nonterminal called the s t a r t symbol. For
the syntax analyzer t o obtain the next token from the
details, the reader is referred t o [171.
input program. Different classes of tokens such a s
identifiers, keywords, delimiters, and various types of
literals a r e defined in the required format f o r LEX. A syntax-directed definition/translation is a
The actions t o be taken when different types of tokens generalization of a context-free grammar. With each
a r e recognized, a r e also specified. In addition, when grammar symbol, a s e t of attributes is associated, and
Authorized licensed use limited to: University of Management & Technology Lahore. Downloaded on May 09,2020 at 00:03:12 UTC from IEEE Xplore. Restrictions apply.
with each production rule, a set of semantic rules a r e the generation of intermediate code is bypassed and the
used t o compute the values of the attributes associated simulation is directly implemented through the semantic
with the symbols appearing in t h a t production. The action parts. The semantic actions instead of
grammar and the set of semantic rules form the generating the intermediate code they implement
syntax-directed definition. A syntax-directed simulation executive. During syntax-directed
definition is a high-level specification for translation, a s the sequence of tokens is parsed,
syntax-directed translation. If some implementation routines f o r simulation a r e invoked. In case of e r r o r s
details are visible, the scheme is called in the syntax or semantics of the input program
syntax-directed translation. Usually, syntax-directed statements, appropriate e r r o r messages are issued. The
def inition/translation involves parsing of the input syntax checking and simulation thus accomplished. This
token stream, building the parse tree, and then technique provides f a s t e r simulation compared t o the
traversing the t r e e a s needed t o evaluate the semantic conventional methods.
rules a t the parse t r e e nodes. However, in special
cases, the evaluation of semantic rules is done during
parsing, without explicit construction of a parse tree, 4. IMPLEMENTATION ISSUES
resulting in a single-pass compiler [171.
The various implementation issues have been carefully
In the present simulator the parser is is implemented considered so t h a t compilation speed is reduced. These
using the LALR(1) parser-generator YACC [ B l . YACC implementation issues a r e discussed in the following
generates a function which repeatedly calls the lexical sections.
analyzer t o get the next token until the end-of-file is 4.1 System Selection C r i t e r i a
encountered in the input program. This function
detects syntax e r r o r s in the input program, if any. The simulator has been developed and implemented on the
The input t o YACC consists of: SEQUENT Balance 8000 running DYNIX V.3.0.4.5. This
system was selected because of the following reasons
o A list of tokens listed in order of their importance:
o The precedence and associativity of operators (if
necessary) a. The goal was t o integrate the VHDL simulator and a
o The s t a r t symbol of the grammar VHDL silicon compiler currently under development on
o A list of production rules, possibly embedded with the same system.
semantic action(s1 f o r syntax-directed translation. b. Compiler construction tools like LEX [16land YACC
A list of keywords, delimiters, rules f o r identifiers [181 which reduce the design complexity considerably
and literals, and grammar rules f o r VHDL is provided in a r e available on t h i s system.
[121. c. The C programming language was chosen a s the
implementation language. The main reasons are:
The functions invoked by the parser t o perform semantic o It provides good data structures, control flow
actions fall into the following categories: primitives, and a rich s e t of operators.
a. Routines t o attach semantic information t o the o Since C is a comparatively small language with
symbols such as registers, input, and output lines, easy access t o machine-level information, i t forms
the number of bits declared; f o r memory, the word a good systems programming language.
size and the number of words etc. o LEX and YACC generate routines in this language.
b. Routines f o r pure semantic checks performing
functions like checking f o r illegal access of memory
bits, out-of-range access of register bits, etc. 5. TEST RESULTS AND CONCLUSIONS
c. Routines f o r simulation.
An VHDL test program has been developed t o t e s t a wide
variety of permissible VHDL syntax. The results of
3.1.3 The Semantic Analyzer execution in this t e s t program indicated t h a t the
simulator works correctly. The results of simulation
The semantic analyzer checks the input VHDL description of two short VHDL programs a r e included in APPENDIX A.
for semantic e r r o r s and gathers type information about It is found t o be a good educational tool f o r
identifiers and does static type checking 1171. In the understanding the syntax of the language. While VHDL
present simulator a s such there is no separate semantic can be used t o simulate a t three levels of abstraction
analyzer rather i t is built into the parser itself. the present simulator can simulate data flow and
The semantics of VHDL a s described in [12-131 a r e behavioral level descriptions. I t is implemented on
incorporated. the SEQUENT Balance 8000 running under DYNIX V.3.0.4.5
operating system.
Authorized licensed use limited to: University of Management & Technology Lahore. Downloaded on May 09,2020 at 00:03:12 UTC from IEEE Xplore. Restrictions apply.
320-326, June 1986. Example -1.
3. Waxman, R. Hardware Design Languages f o r Computer -- i n t e r f a c e d e c l a r a t i o n s
Design and Test, Computer, pp. 90-97, April 1986. e n t i t y ADDER ( s i g n a l A, B, CIN: i n BIT;
SUM, COUT: o u t BIT) is
4. Vyas, M. C. A Compiled-Code V H D L Simulator, M.S. end ADDER;
Thesis in preparation, Michigan Technological
University, Houghton, MI 1988. -- a r c h i t e c t u r e d e c l a r a t i o n s
a r c h i t e c t u r e ONEBIT o f ADDER is
5. Rao, V. A V H D L Silicon Compiler, M.S. Thesis in
preparation, Michigan Technological Univarsity, START: b l o c k (TRUE)
Houghton, MI 1988. begin
A <= n o t A a f t e r Ins;
6. VHSIC Hardware Description Language Request f o r B <= n o t B a f t e r 2ns;
Proposal, Inst. f o r Defense Analysis, Alexandria, CIN <= n o t CIN a f t e r 4ns;
VA, March 1983.
process
7. V H D L Language Reference Manual, Intermetrics, Inc., begin
Bethesda, MD, August 1985. c a s e ( A & B & CIN) is
8. V H D L User's Reference Guide, Intermetrics, Inc., when B"000" => SUM <= 0 after Ins;
Bethesda, MD, August 1985. when B"001" => SUM <= 1 after Ins;
when B"010" => SUM <= 1 after Ins;
9. V H D L User's Guide - A Tutorial, Intermetrics, Inc., when B " O l 1 " => SUM <= 0 after Ins;
Bethesda, MD, August 1985. when B"100" => SUM <= 1 after Ins;
10. V H D L Design Analysis and Justification, when B"101" => SUM <= 0 after Ins;
Intermetrics, Inc., Bethesda, MD, August 1985. when B"110" => SUM <= 0 after Ins;
when B"111" => SUM <= 1 after Ins;
11. V H D L Scenarios, Intermetrics, Inc., Bethesda, MD, end c a s e ; end p r o c e s s ;
August 1986.
process
12. CAD Language Systems Inc. I E E E Standard 1076 V H D L begin
Language Reference Manual, IEEE Press, New York, NY i f ( A & B & CIN) = 0 then COUT <= 0 after Ins;
1988. e l s i f ( A & B & CIN) = 1 then COUT <= 0 after Ins;
13. CAD Language Systems Inc. V H D L Tutorial f o r I E E E e l s i f ( A & B & CIN) = 2 then COUT <= 0 after Ins;
Standard 1076 V H D L , CAD Language Systems Inc., e l s i f ( A & B & CIN) = 3 then COUT <= 1 after Ins;
Rockville, MD June 1987. e l s i f ( A & B & CIN) = 4 then COUT <= 0 after Ins;
e l s i f ( A & B & CIN) = 5 then COUT <= 1 after Ins;
14. Nash, J.D. Bibliography of Hardware Description e l s i f ( A & B & CIN) = 6 then COUT <= 1 after Ins;
Languages, ACM SIGMA Newsletter, 14(1), pp. 18-37, elsif ( A & B & CIN) = 7 then COUT <= 1 after Ins;
February 1984. end i f ; end p r o c e s s ;
15. Aylor, J.H., R. Waxman, and C. Scarratt. VHDL - end b l o c k START;
Feature Description and Analysis, I € € € Design and end ONEBIT;
Test, pp. 17-27, April 1986. MONITOR : A, B, CIN, SUM, COUT;
16. Lesk, M.E. Lex - A Lexical Analyzer Generator, FORMAT : 5 x;
Computing Science Tech. Rep. 39, AT&T Bell Labs, CLKLIMIT : 8ns;
Murray Hill, NJ 1975. STEP : Ins;
DUMP : A, B, CIN, SUM, COUT;
17. Aho, A.V., R. Sethi, and J.D. Ullman. Compilers: 0 0 0 0 0 0
Principles, Techniques and Tools, Addison-Wesley, 10 1 0 0 0 0
Reading, MA., 1986. 20 0 1 0 1 0
18. Johnson, S.C. YACC - Yet Another Compiler 30 1 1 0 1 0
Compiler, CS Tech. Report 32, AT&T Bell Labs, 40 0 0 1 0 1
Murray Hill, NJ 1975. 50 1 0 1 1 0
60 0 1 1 0 1
70 1 1 1 0 1
80 0 0 0 1 1
S i m u l a t i o n Dump:
0 0 0 1 1
Authorized licensed use limited to: University of Management & Technology Lahore. Downloaded on May 09,2020 at 00:03:12 UTC from IEEE Xplore. Restrictions apply.
Example 2.
-- i n t e r f a c e d e c l a r a t i o n s
e n t i t y ADDER ( s i g n a l A, B, CIN: i n BIT;
SUM, COUT : o u t BIT) is
end ADDER;
-- a r c h i t e c t u r e d e c l a r a t i o n s
a r c h i t e c t u r e ONEBIT of ADDER is
START : b l o c k (TRUE)
begin
A <= n o t A a f t e r Ins;
B <= n o t B a f t e r 2ns;
CIN <= n o t CIN a f t e r 4ns;
w i t h ( A & B & CIN) select
SUM <= 0 when B"000" I B " O l 1 " I B"101" I B"110",
1 when B"001" I B"010" I B"100" I B"111";
COUT <= 0 a f t e r I n s when ( A & B & CIN) = 0 else
0 a f t e r I n s when ( A & B & CIN) = 1 else
0 a f t e r I n s when ( A & B & CIN) = 2 else
1 a f t e r I n s when ( A & B & CIN) = 3 else
0 a f t e r I n s when ( A & B & CIN) = 4 else
1 a f t e r I n s when ( A & B & CIN) = 5 else
1 a f t e r I n s when ( A & B & CIN) = 6 else
1 a f t e r Ins;
end b l o c k START;
end ONEBIT;
MONITOR : A, B, CIN, SUM, COUT;
FORMAT : 5 x;
CLKLIMIT : 8ns;
STEP : Ins;
DUMP : A, B, CIN, SUM, COUT;
0 0 0 0 0 0
10 1 0 0 0 0
20 0 1 0 1 0
30 1 1 0 1 0
40 0 0 1 0 1
50 1 0 1 1 0
60 0 1 1 0 1
70 1 1 1 0 1
80 0 0 0 1 1
S i m u l a t i o n Dump
0 0 0 1 1
G . N. Reddy
Authorized licensed use limited to: University of Management & Technology Lahore. Downloaded on May 09,2020 at 00:03:12 UTC from IEEE Xplore. Restrictions apply.