Professional Documents
Culture Documents
Figure 1 illustrates the steps of the design process for digital systems using programmable logic devices. IP (Intellectual Property) cores represent complex hardware modules that are tested extensively and which can be used in various designs to reduce significantly the design time. Next, the main design steps are described in more details.
Figure 2. The steps of description of a digital system using schematics: (a) selecting and placing the components; (b) connecting the components; (c) adding the I/O ports.
The main steps of using logic diagrams for designing a digital system are the following: 1. In a schematic editor, the required components are selected from a library of components. Such components can be, for instance, basic gates, multiplexers, decoders, counters, arithmetic units, etc. Depending on the device that will be used, the designer must select a particular library of components, because there are libraries that are specific to various vendors of programmable logic devices and to various device fami-
lies. Devices from a specific family differ in their capacity, speed, and package used. At this step, there is no need to specify the exact device that will be used from a certain family. 2. The components selected and placed in a schematic are interconnected through connection wires. The designer performs the component interconnection in order to obtain the necessary configuration for a specific application. 3. The I/O ports are added and labeled. These ports define the inputs and outputs of the system, allowing to apply signals to the input pins of the digital system and to get the output signals generated by the system at the output pins. The input signals are applied to the inputs of the digital system via input buffers, and the output signals are obtained from the digital system via output buffers. These buffers isolate the digital system from the outside. In some cases, the I/O buffers are automatically added by the CAD system. Besides logic diagrams, another possibility for describing digital systems is using a hardware description language. These languages are widely used today, and they are preferred for the description of systems with high complexity, due to the following advantages: The capability of a functional description of systems, this being a higher-level description, without detailing the structure at the basic gate level. Therefore, the time required for describing complex systems is significantly reduced. The independence of the HDL description among different types of devices. While the logic diagrams are made with library components specific to a certain device family, HDL descriptions are completely independent of a specific device, so that the same description can be used for implementing the system in a certain FPGA device, but also in another type of programmable logic device, for instance, in programmable logic array. The possibility to modify the HDL description of a system in a simpler manner, due to the fact that such a description also represents a documentation of the system.
There are many hardware description languages, but the most widely used languages are VHDL (VHSIC Hardware Description Language) and Verilog. These languages are standardized by the IEEE. Figure 3 presents a possible description in the VHDL language of the circuit illustrated in Figure 2. For describing finite state machines, state diagrams are widely used. CAD systems for designing with programmable logic devices may contain editors for state diagrams, which allow specifying in graphical form the system states, state transitions, and output signals that have to be generated in each state. A state diagram will be compiled by the CAD system to an internal representation or an HDL description, which can be simulated and then used for implementing the state machine in a specific device. Figure 4 presents a state diagram that is equivalent to the circuit illustrated in Figure 2 and the VHDL description of Figure 3.
Figure 4. Equivalent state diagram of the circuit represented by the schematic of Figure 2 and the VHDL description of Figure 3.
Figure 5. The relationship between the logic diagram and the netlist for the circuit of Figure 2.
The designer can specify various optimization criteria that can be taken into account during the synthesis process. Examples of such options are: minimizing the number of required basic gates, achieving the maximum operating speed of the device, or minimizing the power consumption. The designer may experiment with different optimization criteria in order to achieve the most suitable solution for the application.
Figure 6. Input and output signals of the sequence detector displayed at the functional simulation of the circuit.
Figure 7. Illustration of the technology mapping step for the circuit of Figure 2.
process of selecting particular modules or logical blocks of the programmable logic device which will be used for implementing the various functions of the digital system. Routing consists in interconnecting these logical blocks using the available routing resources of the device. Most of the CAD systems perform the placing and routing operations automatically, such that the user does not have to know the details of the device architecture. Some systems allow the expert users to manually place and route of some critical parts of the digital system in order to obtain higher performance. Figure 8 illustrates the placing and routing of the netlist obtained after the technology mapping of the circuit used as example. After selecting the logical blocks to be used for the circuit implementation, these are configured for implementing some parts of the circuit. For interconnecting the signals generated by the various logical blocks, the available routing resources are used. These resources are indicated in the figure by horizontal and vertical lines. The used inputs and outputs of the logical blocks are connected to the routing lines through programmable connection points (represented by circles in the figure), and the routing lines are interconnected with programmable switches.
Figure 8. Illustration of the placing and routing steps for the circuit of Figure 7.
The routing and placing operations may require a long time for execution in case of complex digital systems, because complex operations are required to determine and configure the required logical blocks within the programmable logic device, to interconnect them correctly, and to verify that the performance requirements specified during the design are ensured.
interconnections. The analyzer can display this information in different modes, e.g., by sorting the connections in the descending order of signal delays. The designer may use the information about signal delays to perform a new simulation of the system, where to take into account these delays. This operation through which the simulator is provided with detailed information about the signal delays is called back-annotation.
Table 1 presents the naming and the meaning of JTAG signals used for configuring programmable logic devices.
Table 1. Naming and meaning of the JTAG signals used for configuring programmable logic devices.
Name VCC GND TCK TDO TDI TMS Meaning Supply Voltage supply (5 V, 3.3 V or 2.5 V) Ground Reference for the electrical ground Test Clock Clock signal for programmable logic devices Test Data Out Signal for reading data from programmable logic devices Test Data In Signal for transferring instructions and data to programmable logic devices Test Mode Select Signal decoded by the JTAG controller for controlling the operations
10
source files of the project. The third section of the Design panel area is the Processes pane, which allows running the processes required in the various phases of the design flow. The source file selected determines the processes available in the Processes pane. The workspace area allows viewing and editing the design using various tools, and provides access to reports in the Design Summary section. The Transcript window offers the possibility to view output logs, messages, errors, and warnings as they are generated.
11
All schematic files are ultimately converted to either VHDL or Verilog structural netlists before being passed on to the synthesis tool during the synthesis step.
In addition to NGC files, the XST software also generates the following outputs: a synthesis report, an NGR file with the RTL (Register Transfer Level) schematic, and a technology schematic. The synthesis report contains the results from the synthesis run, including an area and timing estimation. The RTL schematic is a representation of the design before the optimization using generic symbols, such as adders, multiplexers, counters, gates. This schematic is generated after the HDL synthesis phase of the synthesis process. The technology schematic is a representation of an NGC file using logic elements optimized to the target ar-
12
chitecture or technology. This schematic is generated after the optimization phase of the synthesis process. Figure 11 illustrates each of the steps performed by the XST tool during synthesis.
First, a parsing of the HDL code is performed, when XST checks whether the HDL code is correct and reports syntactic errors. If there are no syntax errors, the HDL synthesis is performed. XST analyzes the HDL code and attempts to infer specific design building blocks or macros (such as multiplexers, memories, adders, subtractors) for which it can create efficient technology implementations. To reduce the amount of inferred macros, XST performs a resource sharing check that leads to a reduction of the area and an increase in the clock frequency. At this step, the XST software recognizes the Finite State Machines (FSMs) independent of the modeling style used. To create the most efficient implementation, XST uses the optimization criterion that has been specified (area or speed) to determine the FSM encoding algorithm that will be used. The last step of the synthesis is the low-level optimization. XST transforms inferred macros and general logic into a technology-specific implementation.
13
Placement constraints control the mapping and placement of symbols defined in the netlist to the resources of the device used for implementation. These constraints can be defined for each type of logic element of the FPGA device. Individual logic gates are mapped into CLB (Configurable Logic Block) function generators before the constraints are read, and therefore cannot be constrained. In a constraints file, each placement constraint acts upon one or more symbols. Every symbol in a design carries a unique name, which is defined in the input file. Synthesis constraints instruct the synthesis tool to perform specific operations. Synthesis constraints control how the synthesis tool processes and implements FPGA resources, such as state machines, multiplexers, and multipliers, during the HDL synthesis and low-level optimization steps. Synthesis constraints also allow control of register duplication and fanout control during global timing optimization.
3. Design Example
This section presents a design example that is based on the VHDL language and uses the Xilinx ISE Design Suite environment for implementation. The example illustrates the steps of the FPGA design flow and demonstrates the main capabilities of the Xilinx ISE software package.
14
signals.
control: Module that implements a state machine for generating the control signals
setting mode. This module has six 4-bit outputs, representing the digits of the clock.
lcd_ctrl: Module that performs the initialization and controls the operation of the
LCD display.
2. In the Name field, enter the name of the project (for instance, clock). 3. In the Location field, click the button to browse to the folder where the project has to be created (this should be a subfolder of the D:\Student\ folder), and then select the OK button. 4. Verify that HDL is selected in the Top-level source type field, and select the Next button. The Project Settings page of the New Project Wizard dialog window is displayed. 5. For the Evaluation Development Board property, select the Spartan-3E Starter Board option. The following options should automatically be selected, based on the FPGA device of the selected board:
15
Family: Spartan3E Device: XC3S500E Package: FG320 Speed: -4 6. In the same Project Settings page, select the following options: Synthesis Tool: XST (VHDL/Verilog) Simulator: ISim (VHDL/Verilog) Preferred Language: VHDL 7. Leave the other options unchanged and click the Next button. In the Project Summary page, click the Finish button to complete the project creation.
16
17
construct will be used in the design example. Perform the following operations to select the required template and to add this template to the source file of the debounce module. 1. Select Edit Language Templates or click the Language Templates button.
2. Expand the VHDL language templates, expand Synthesis Constructs, expand Coding Examples, expand Misc, and then select the template called Debounce circuit. The template content is displayed in the right pane of the screen. 3. In the Hierarchy pane, double-click on the debounce.vhd file and position the cursor under the begin statement in this source file. 4. Return to the Language Templates window, right-click on the Debounce circuit template, and select Use in File. The template will be inserted at the cursor position. 5. Close the Language Templates window. 6. In the debounce.vhd file, move the line with the signal definitions so that it is placed between the architecture and begin keywords. 7. Remove the reset logic, which is not used in this design, by deleting the five lines beginning with if (<reset> = '1') and ending with else, and delete the first end if line. 8. Replace <clock> with clk in the process sensitivity list and in the if statement. 9. Save the file by selecting File Save or by clicking the Save button.
10. In the Hierarchy pane, select the debounce module if it is not already selected. 11. In the Processes pane, double-click the Check Syntax process. Verify that the syntax check is completed successfully. Correct any errors if necessary.
5. In the instantiation statement of the control component, change the mode, up, and down signals to mode_d, up_d, and down_d, respectively. By these changes, the
18
mode, up, and down input signals will be debounced before connecting them to the control component.
6. Save the clock.vhd file by selecting File Save or by clicking the Save button. In the Hierarchy pane, notice that the instances of the debounce component are added to the design hierarchy (Figure 14). 7. While the clock module is selected in the Hierarchy pane, double-click the Check Syntax process in the Processes pane. Correct any possible syntax errors.
19
7. In the synthesis report, read the Device utilization summary section to find out the resources of the FPGA device required for the design. 8. In the synthesis report, find the Timing Summary section. Make a note of the estimated maximum frequency of the design. 9. With the cursor in the synthesis report, select Edit Find or press Ctrl-F. In the Find field type fanout and press the Enter key. Press repeatedly the Find the next phrase button and determine what is the maximum fanout and what is the resource with this fanout. 10. Close the synthesis report. Large fanouts can cause difficulties during the routing phase. Therefore, the XST synthesis tool tries to limit the fanout by duplicating gates with large fanout or by inserting buffers. These buffers will be protected against logic optimization during the implementation phase by defining a KEEP attribute in the netlist. To reduce the maximum fanout and to observe the effect of this reduction on the synthesis process, perform the operations described below. 1. In the Processes pane, right-click on the Synthesize XST process and select Process Properties. 2. In the Process Properties dialog window, select the Xilinx Specific Options category. In the Value field of the Max Fanout property, change the default value of 500 to 50. 3. Click the OK button to close the Process Properties dialog window. 4. While the clock module is selected in the Hierarchy pane, in the Processes pane double-click the Synthesize XST process to re-synthesize the design. 5. When the synthesis is finished, in the Processes pane double-click the Design Summary/Reports process. 6. Open the synthesis report and determine what is the fanout of the resource that had the maximum fanout in the previous report. 7. Close the Design Summary window.
5. Double-click inside one of the components to view its internal structure. Click the Previous Schematic button to return to the schematic of the top-level module. 6. Close the schematic window.
20
Figure 15. The I/O Ports panel of the PlanAhead software screen.
6. In the I/O Ports panel, select the SF_D[0] port. Click on the Site column of this port and select R15. Click on the I/O Std column of the same port and select LVCMOS33. Similarly, in the Drive Strength column select 4. Keep the default values for the other options of the SF_D[0] port. 7. Repeat the previous step to assign constraints to the remaining I/O ports, according to Table 2.
Table 2. I/O port constraints. Port SF_D[0] SF_D[1] SF_D[2] SF_D[3] LCD_E LCD_RS LCD_RW SF_CE0 Site R15 R16 P17 M15 M18 L18 L17 D16 I/O Standard LVCMOS33 LVCMOS33 LVCMOS33 LVCMOS33 LVCMOS33 LVCMOS33 LVCMOS33 LVCMOS33 Drive Strength 4 4 4 4 4 4 4 4 Pull Type
21
Drive Strength 12 12 12 12 12
Save Design to save the I/O port constraints to the UCF file. Exit to close the PlanAhead software. Confirm to exit in the dialog box.
10. In the Hierarchy pane, notice that a .ucf file has been added to the design hierarchy. Select this file. In the Processes pane, expand the User Constraints line and doubleclick the Edit Constraints (Text) process to open the .ucf file created. In the ISE Project Navigator dialog box, click on the Yes button to confirm opening the file. Review the file to verify whether the constraints have been set correctly. 11. Close the .ucf file.
4. Applications
4.1. Answer the following questions: a. What are the advantages of using hardware description languages for designing digital systems? b. What is the main operation performed in the design synthesis step? c. What is technology mapping? d. What are the operations performed at design placement and routing? e. What are the operations performed by the XST tool during design synthesis? f. What are the main types of design constraints? 4.2. Perform the steps described in Section 3 for the design example of the real-time clock.