|
Design AutomationTransitioning from ABEL-HDL to VHDLFor users of programmable logic, the increasing capacities of devices require a change to a new hardware description language.by Dennis McCrohan, Mike Holley, and Ryan Linderman
This article provides the designer who is already familiar with ABEL-HDL with an introduction to the VHDL language and how it is used for the design of programmable logic. In this article, we will use a series of three design examples that compare the features of the ABEL language with VHDL. We cannot promise to turn you into a VHDL expert in a few pages, but we do hope that by the end of this article you will find VHDL considerably less complex than you might have thought. Example 1--differences We begin our exploration of the differences between ABEL-HDL and VHDL with a simple design, shown schematically in Figure 1 and as an ABEL listing in Listing 1A. It is important to remember that a logic schematic is just another HDL--one that has become standardized in an ad hoc way during the past 35 years. While simple, this design encompasses the three major categories of digital-logic behavior: combinatorial, latched, and registered logic. Listing 1B shows the VHDL implementation of this design.
Figure 1. The schematic diagram illustrates the various parts of the design being discussed.![]()
The VHDL model consists of two principle pieces: an entity declaration and an architecture. LIBRARY and USE statements precede these pieces in the source file. These statements guide a VHDL compiler as to where to
look for objects not declared in this source file. In this case, we reference a standard package called
![]()
The key word ENTITY begins the entity declaration, followed by the name of the entity and then the list of ports. Ports are analogous to
pins on a schematic symbol: they are how information enters or leaves an entity. Ports may be either scalar (1-bit wide) or a vector (multiple-bits wide). In this example, we have declared four 1-bit inputs,
An architecture for ex1, the design for a gate and latch, follows the entity declaration. VHDL allows an entity to have as many implementations as desired, with each implementation containing a different architecture. In this example, we have what is called a behavioral architecture. That is, the code is written at a level of abstraction that specifies the desired behavior of
This particular architecture starts with the declaration of an internal signal called
The key word BEGIN marks the end of the architecture's declaration section and is followed by the body of the architecture. The body describes the design's behavior. Here, you can see two of the most commonly used constructs in VHDL: the concurrent-signal assignment and the
process. The first two lines are concurrent-signal assignments that assign values to the least significant bit (LSB) of dout and to our internal signal,
Two
processes follow the concurrent-signal assignment statements. We have given these processes optional labels of
VHDL supports several decision-making constructs within the sequential logic of a process. Here, we use the "if-then" construct to conditionally execute signal assignments. In
![]() Like any modern language, VHDL allows you to insert comments in the source code, with the beginning of a comment indicated by the string "--" and the end, by an end-of-line.
At this point, back up and take a look at the entire architecture for
Example 2--address decoder
The module statement gives the ABEL-HDL module the name
A set called
Because each output is considered registered, the equations used must feed the D input to each register. In ABEL-HDL, a register will implicitly go to zero, assuming no other asynchronous controls are used on the register on the next clock unless its D equation is satisfied. Thus, latches are not created by default. Further, no order is implied in evaluating these equations, and therefore no priority-decode is created by this equation set. The decode equations are written in a high-level ABEL-HDL equation syntax, making manipulation of large data widths straightforward and easy to modify.
Now consider the VHDL implementation. For the entity
![]()
In the architecture for
In the declaration section of this process (the area between the key word PROCESS and the key word BEGIN), we declare a variable called
The implications of items 1 and 2 are fairly obvious. The implication of item 3 is that during simulation, variables do not carry as much overhead baggage as signals. This reduces the amount of memory required by the simulator and may even make the simulation run faster. We will defer discussion of item 4 for a moment. In the body of the process, we implement the one-hot decode of address using a series of "if-then" statements, each checking address against the appropriate range. Because all the outputs must be low when csn is not active, we added the assignment:
t_selects :=
(others => '0');
to the process right after detecting
t_selects := "000000000"
Including this assignment in the design of the VHDL code is extremely important; if we had not, the synthesis tool would have been forced to infer that feedback from the Q output of each
flip-flop, through an OR gate, back into the D input. Consequently, each select output would stay at 1 once the proper address was decoded, and it would never return to 0. Alternately, we could have fully specified all the bits of
Back to Item 4, at the end of the process, we assign the variable
selects <= t_selects after 10 ns;
![]()
This statement introduces another VHDL feature: the ability to specify that a signal assignment takes place with some specified delay, in this case 10 ns. Because this process is executed only on
Example 3--state machine Our third example is a simple state machine. The ABEL-HDL code for this design is shown in Listing 4A. In Listing 4B, we see the VHDL code.
The ABEL-HDL description declares inputs, outputs, and two sets:
The VHDL entity declaration contains four port declarations--three inputs and one output. Note that the two vector ports are declared with a range that runs from LSB to MSB and that we use the key word to instead of
In this architecture, we introduce another new VHDL concept: the enumerated type. A type declaration begins with the key word TYPE, which is
followed by the type name and a list containing the possible values for the type. Using enumerated types is common in VHDL (remember that the type
subtype small_integer is integer range -128 to 127;
A subtype is defined in terms of another predefined type. An advantage of using a subtype is that it inherits the operators defined for the parent type. For this example, we are using the enumerated type states simply to represent the state of a finite-state machine (FSM). There are two common ways to represent an FSM in VHDL: the single-process form or the two-process form. This example uses the two-process form, mainly because it is simpler for novices to understand. The single-process form is more efficient from a simulation standpoint and probably more commonly used.
In the
two-process form, one process is used to infer the behavior of the state registers and, the second, to implement the combinatorial logic. For this example, the process
The process
This process also introduces a new VHDL control construct: the case statement, which can be used similarly to "if-then" for decision making. VHDL requires that a case statement handle all possible cases. For example, if we omitted the block of code for case
Because the choices for a case statement are mutually exclusive and exhaustive, this code should synthesize into less logic than code using an "if-elsif" construct.
In this architecture for our FSM, the output
After completing our design, we must verify functionality with a simulator. Historically, simulators have had various methods of providing stimuli to the design being simulated. Designs performed using ABEL typically have test vectors written in ABEL Test Vector language. Some VHDL simulators may still provide a proprietary method of generating stimuli, such as test vector files or waveform-entry tools, but the primary (and portable) method of generating stimuli for a design in a VHDL environment is with a testbench. A VHDL testbench is simply another VHDL entity, with two distinguishing characteristics: (1) the entity declaration contains no ports; and (2) the architecture body instantiates the user's design. Testbenches provide an excellent opportunity for VHDL designers to create elaborate testbenches tailored to the needs of the design in question. Testbenches can not only provide stimuli, but can also check for expected outputs, reducing the need for manual verification. At one extreme, a testbench may consist of just one process reading data from an input file and applying them to the inputs of the design being simulated. A situation in which this style of testbench might be used is a microprocessor design, where a cross-assembler could be used to generate a data file that the testbench reads. The testbench, in turn, behaves as a ROM, responding to instruction fetches by placing the data read from the file onto the processor's data bus. Conclusion We probably have not turned you into a VHDL expert, but we hope you have gained enough insight to ask the right questions and begin your own experiments with VHDL. While VHDL is a large, complex language, the extent of the language that designers writing synthesizable logic use is usually quite small. You can start with the small subset shown in this article and branch out as you become familiar with the language. You have also seen that it is not necessary to abandon your existing design methodologies. If you are using ABEL, look at using a tool that supports ABEL and VHDL as design-entry methods. If you prefer schematics, then you should probably consider tools that support a mix of schematic and VHDL entry. Dennis McCrohan is a product marketing engineer, Mike Holley is a senior engineer, and Ryan Linderman is an applications engineer at Data I/O's Synario Design Automation (Redmond, WA).
To voice an opinion on this or any Integrated System Design article, please e-mail your message to michael@isdmag.com. integrated system design January 1997[ Articles from Integrated System Design Magazine ] [ ICs and uPs ] [ Custom ICs and Programmable Logic ] [ Vendor Guide ] [ Design and Development Tools ] [ Home ] For more information about isdmag.com e-mail cam@isdmag.com For advertising information e-mail amstjohn@mfi.com Comments on our editorial are welcome Copyright © 1997 Integrated System Design Magazine
|
||||||||||||||
Home | About | Editorial Calendar | Feedback | Subscriptions | Newsletter | Media Kit | Contact | Reprints| RSS|
Digital| Mobile |
| Network Websites |
|
International |
|
Network Features |
|
|
|
All materials on this site Copyright © 2009 TechInsights, a Division of United Business Media LLC All rights reserved. Privacy Statement | Terms of Service | About |