Testing an implemented digital circuit is one of the primary challenges faced by FPGA designers. This challenge mainly arises due to the fundamental differences between processors and FPGA chips.
More...
As explained in the article "Understanding the Differences Between FPGAs and Processors," when working with processors, we deal with fixed hardware that executes specific commands sequentially. As a result, only one command is executed at any given moment, making it relatively easy to debug the program. This is because it can be run and traced line by line, allowing examination of various variables to identify potential errors.
However, with FPGAs, we describe digital hardware capable of performing tens or hundreds of operations in parallel. This parallelism makes debugging an FPGA design more complicated and time-consuming compared to debugging a computer program.
Methods of Digital Circuit Testing
The first tool for debugging FPGAs is simulation software, which enables timing and functional simulations. These simulators allow monitoring of any signal within the design, making them invaluable for identifying issues.
Another critical tool in debugging FPGAs is the designer's own logic and experience. When simulation results or signal behavior deviate from the designer's expectations, the cause could be an error in various parts of the hardware description code. In these cases, the designer must carefully examine the code to identify and correct possible errors.
Run-Time Debugging with ChipScope
When implementing large designs, numerous errors can occur, and some may only appear after extensive simulation. Since simulation can be time-consuming, particularly for large designs, relying solely on simulators for debugging isn't practical.
To tackle this issue, Xilinx developed ChipScope, a software that utilizes the Jtag interface available on FPGA chips. This allows designers to monitor their desired register values during the run time after configuring the FPGA. ChipScope is included in the ISE Design Suite.
To use ChipScope, the designer must first add a specific IP core provided in the ISE software to the project, creating an interface between ChipScope and the FPGA. With this IP core, designers can select two types of signals in the FPGA:
Signals the designer wishes to monitor during run time (i.e., data);
Signals the designer wants to use as conditions for data sampling.
For example, if a designer selects signals A and B as data and signal C as the sampling condition, ChipScope software can determine when a particular condition occurs on signal C and sample the register values of A and B via the Jtag port on the FPGA chip. These values are then displayed in the ChipScope software GUI.
One advantage of ChipScope is faster debugging, as it uses the actual circuit running in the FPGA, which operates at high speeds. This method also accounts for scenarios that are difficult to simulate and calculates results under realistic conditions.
Digital Circuit Testing with MATLAB
Digital circuit testing often requires comparing the results of an implemented design with a reference model. To create this reference model, simulators like MATLAB are typically used. After generating the model, a set of different inputs must be applied to evaluate all possible design conditions. The results of applying these inputs should be stored in a file.
To verify the implemented circuit's functionality, the same set of inputs must be applied to the hardware description code simulator (e.g., ModelSim or ISim) and the corresponding outputs stored in a file. The final step in design validation is comparing the reference model results with the hardware description code simulation results, which can be done using the same simulation software (e.g., MATLAB).
In professional digital hardware design processes, validation using a reference model is a critical stage for demonstrating the proper functionality of the project to project managers or employers.
Conclusion
Advanced FPGA-based digital system design is becoming increasingly significant, and manufacturers continue to add new features to their products every year. The "Introduction to FPGA" article series has explored basic concepts related to using FPGAs in digital design and provided an overview of the design process.
It's important to note that in order to become a proficient digital designer specializing in FPGA and VHDL, you need to not only be familiar with and master FPGA technology and associated design software but also enhance your knowledge in digital design domains and the implementation of signal processing algorithms.