Академический Документы
Профессиональный Документы
Культура Документы
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
15
Device: XC3S500E Package: FG320 Speed: -4 Synthesis Tool: XST (VHDL/Verilog) Simulator: ISim (VHDL/Verilog) Preferred Language: VHDL
6. Click the Next button. In the Project Summary page, click the Finish button to complete the project creation.
16
The time_cnt.vhd file contains syntax errors that must be corrected. To correct the errors in the source file, perform the following operations. 1. In the Console or Errors panel, click the file name in the first error message. The source code is displayed in the text editor window with a yellow arrow next to the line with the error. 2. Browse to the beginning of the sec_cnt process that contains the error. Review this process and notice that one of the end if statements is written as endif. Correct the error and then save the file by selecting File Save or by clicking the Save button. The error messages in the Console panel should disappear. 3. To detect other possible syntax errors, in the Hierarchy pane select the time_cnt module, in the Processes pane expand the Synthesize XST process if it is not already expanded, and double-click the Check Syntax process. This launches the XST (Xilinx Synthesis Technology) tool for syntax checking. The time_cnt module is compiled and several error messages are displayed in the Console panel. These messages indicate that the + and operators are not defined for operands of type std_logic_vector. 4. To correct the errors, browse to the beginning of the file and modify the second use statement by replacing the NUMERIC_STD package with the STD_LOGIC_UNSIGNED package. Save the file and launch the Check Syntax process again. Now the compilation should be completed successfully.
17
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. Select 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 10. In the Hierarchy pane, select the debounce module. 11. In the Processes pane, double-click the Check Syntax process. Verify that the syntax check is completed successfully. Correct any errors if necessary. button.
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 mode, up, and down input signals will be debounced before connecting them to the control component.
18
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
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 tab in the PlanAhead software screen.
6. In the I/O Ports panel, select the SF_D[0] signal. In the I/O Port Properties panel, make sure that the General tab is selected, enter R15 to the Site field, and click the Apply button. Then select the Configure tab. In the I/O Standard field, select LVCMOS33, in the Drive Strength field select 4, and for the other options keep their default values. Click the Apply button to assign these properties. 7. Repeat the previous step to assign constraints to the remaining I/O pins, according to Table 2.
21
Table 2. I/O pin constraints. Signal clk rst mode up down LCD_E LCD_RS LCD_RW SF_CE0 SF_D[0] SF_D[1] SF_D[2] SF_D[3] Site C9 H13 D18 V4 K17 M18 L18 L17 D16 R15 R16 P17 M15 I/O Standard LVCMOS33 LVTTL LVTTL LVTTL LVTTL LVCMOS33 LVCMOS33 LVCMOS33 LVCMOS33 LVCMOS33 LVCMOS33 LVCMOS33 LVCMOS33 Drive Strength 4 4 4 4 4 4 4 4 Pull Type PULLDOWN PULLDOWN PULLDOWN PULLDOWN
8. Select File Save Design to save the I/O pin constraints to the UCF file. 9. Select 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. Review the file to confirm that 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.