8.3. Performing Software Simulation
Before going through the process of choosing an FPGA-based platform target and compiling/synthesizing the encryption algorithm to that target, we will first use a standard C development environment to verify that the application, including both the legacy C code and the modified Impulse C version of the code, is correct in terms of the computations being performed. Because the Impulse C libraries are compatible with most popular C development environments, we can perform this test using any number of such compiler/debugger environments.
The test bench that we will create for this encryption process will allow us to directly compare the results of both encrypting and decrypting a stream of characters that originate from a text file, as shown in Figure 8-3.
Figure 8-3. Block diagram of the complete encryption/decryption test bench.
As shown in the diagram, the software simulation consists of six distinct processes:
This method of creating test benches in C, in which an Impulse C algorithm is tested in parallel with a legacy, known-good algorithm, is extremely useful, particularly when you will be making later C-language optimizations to the algorithm.
By using a standard IDE in conjunction with the Application Monitor provided with the Impulse tools, we can use standard C debugging techniques (including source-level debugging) while observing how data moves between the various processes in the system, which now includes two versions of both the encryption and decryption processes, plus the test consumer and producer processes. The result, using Visual Studio as the debugger, is shown in Figures 8-4 and 8-5.
Figure 8-4. Debugging the Impulse C encryption processing using Visual Studio.
Figure 8-5. Application monitoring.