|
||||
April 9, 1998Adopting VHDL for PLD design and simulationTroy Scott, OrCAD IncAs your designs become more complex, it becomes more efficient to use tools that allow you to design at a higher level of abstraction. Hardware-description languages, such as VHDL, are a natural next step for tackling large designs.Time-to-market, vendor-flexibility, and design-complexity requirements have caused electrical engineers to adopt VHDL. One benefit of using VHDL for hardware design is design abstraction. Logic design using an HDL such as VHDL improves productivity by allowing you to work with logic operations and behavior rather than with the traditional approach of drawing circuit diagrams of logic gates and wires. Using VHDL also results in improved documentation and quality. VHDL design encourages simulation. In addition to the obvious benefits of logic debugging, VHDL-testbench source code helps document design behavior. VHDL design also describes design inputs and expected outputs, making it easier to maintain the design after completion. Another benefit of using VHDL is design portability. Perhaps the most compelling reason to adopt a standard design language is that it lets you easily migrate a design source from one PLD vendor to another. Engineers typically describe schematic-based designs with PLD-vendor-specific logic symbols. These schematics require major overhauls and component substitution if you redo the design using another vendor's PLDs. Simulation is another benefit of using VHDL. Unlike traditional Boolean languages, VHDL is a naturally simulatable language. You can debug your design intent early in the design and continually verify that the design does what you intend it to do as it evolves from equations to gates. In addition, VHDL is a powerful way to model almost any aspect of a digital system. A state-machine description is one of the most appropriate applications of VHDL for hardware design. The schematic equivalent of a state machine is awkward to implement and difficult to interpret because of the irregular Boolean logic required to decode next-state logic. Finite-state-machine (FSM) logic has both input stimuli and output responses, but it also has several bits of internal memory to keep track of the most recent events. A state machine uses a clock to advance one step at a time. VHDL state machines are coded with a combinatorial block that decodes and controls current states and next states. A VHDL-coded state machine also includes a register block to synchronize the machine with the system clock and to apply other controls, such as preset or reset. Each active-clock transition causes a change from the current state to the next state. Combinatorial logic
Sequential logic
A key consideration of FSM design is how many registered elements you need to portray the machine's current state. The traditional approach to encoding an FSM minimizes the number of flip-flops you need to represent n states. However, given the large number of registered elements in modern FPGAs, dedicating one flip-flop per state is the preferred approach to encoding large state machines. The VHDL style guides that accompany programmable-logic-vendor place-and-route software kits document this technique, "one-hot encoding" (OHE). Designers prefer the OHE method because it requires minimal decoding to arrive at the next state of the machine. OHE increases speed and reduces signal fan-in to each FPGA hardware-logic block.
These VHDL declarations give no explicit encoding. Instead, the system interface to the software (switches, dialogue boxes, and command-line scripts) controls the encoding scheme at compilation time. All logic-synthesis tools document how to control state encoding. The power of a VHDL testbench VHDL is a powerful test-vector-generation and output-verification language. Most published technical articles regarding VHDL focus on synthesis topics and ignore the benefits gained by designers who adopt the language purely as a vehicle to create input stimuli for simulation. Even if you intend to use only schematics to design your programmable-logic parts, VHDL can help debug and confirm component behavior before you program these parts. VHDL describes the behavior of digital hardware. This attribute provides a powerful way to describe input-signal patterns for your programmable part. The synthesis tool never interprets the testbench, which surrounds the design under test. This attribute frees you to use VHDL's expressive power, regardless of synthesis-style guidelines. Generating clocks
If you've drawn a schematic, you're already familiar with "structural modeling" in VHDL. An annotated part in a schematic is equivalent to a VHDL component instance, a local wire on the schematic is a VHDL signal, the pinout of a library port is the VHDL entity interface, and so on. The terminology changes in VHDL, but the concepts are the same. The structural-modeling chapter of a VHDL textbook should be familiar ground for most electrical engineers.
The most common logic levels are logic true/false or forcing 1/0. The std_logic convention is useful when simulating a collection of models. Signals connect the component instances, just as wires and buses connect parts on a schematic page. Similar to schematics, many circuit topologies have signals that form buses that logic circuits read from or write to. In these cases, there are potentially multiple talkers or listeners. When more than one component drives a common signal bus, contention occurs, and you must consider which drive will win in this battle for logic-state supremacy. Luckily, the std_logic_1164 also defines a table of resolution with which an std_logic data type must comply (Table 3). Std_logic accommodates single-bit quantities, and std_logic_vector accommodates buses. As a rule, use std_logic and std_logic_vector data types to define VHDL model ports.
In a paper written by engineers at Hughes Aircraft Co (Westchester, CA), the authors describe the design method used by a team to develop the winning VHDL-based application of the VIUF (VHDL International Users' Forum) '97 design contest (Reference 1). The process used by Hughes has evolved over the past five years and the company has successfully employed it in a variety of programs from a multiASIC space-based surveillance system to an FPGA-based video-processing subsystem.
To maximize VHDL reuse, you must keep reuse in mind throughout the design process. You must thoroughly comment the design unit, give meaningful names to signals and ports, and create a testbench to document design functionality. Other techniques that ease VHDL-design-unit portability include using standard data types, operators, and attribute-free source code. With top-down design, the design should flow naturally from requirements and decompose into hierarchical subunits. This flow ensures that the design meets all design requirements and that you can trace it. A robust testbench makes a design simulation that is as close to the operating environment as possible. The testbench represents the design's interface to other digital system components. A robust interface model serves as a natural functional specification of the design unit because it may document software test vectors: input stimuli and expected outputs. The model also qualifies the data type and ranges allowed for information that flows in and around the design unit. You should also be aware of the delays that the circuit introduces, which are created by synthesis or timing analysis of the placed and routed circuit. A robust testbench anticipates the signal latency caused by potentially hundreds of internal logic levels. The testbench supplies data at a rate such that it holds data stable before clocking and that output checks anticipate output signal skew. In general, when trying to contain design errors, the least expensive fix for design problems occurs early in the design's development. Reference 1 documents a high-level methodology and justification for hardware development at Hughes Aircraft with VHDL. The authors base their advice on experience that other designers can use to improve productivity at their own companies. Another key design-productivity trick is to record errors during the design. This record of experiences allows engineering managers to better forecast the schedule of development efforts and to back up their projections with data.
|
||||
|
||||
| EDN Access | Feedback | Table of Contents | |
||||
| Copyright © 1997 EDN Magazine, EDN Access. EDN is a registered trademark of Reed Properties Inc, used under license. EDN is published by Cahners Publishing Company, a unit of Reed Elsevier Inc. | ||||