Use FeatureC++ to develop SystemC modules —— a case study

来源:互联网 发布:单片机开发工程师 编辑:程序博客网 时间:2024/05/09 02:29

  This case is based on the implementation of a Fast Fourier Transform (FFT). It’s an example shipped with SystemC release. The system is consisted of a Source module (generate the data to be transformed), a FFT module (transform the data), and a Sink module (receive the transformed data). Its communication protocol is described as follow.

  FFT block initiates the reading of a sample by sending a "data_req" signal to the source. It waits for "data_valid" signal from the source to become high; then it lowers the "data_req" signal and reads in data samples from its input ports. Once the FFT calculation is performed, the block writes the transformed values to a sink. It puts the transformed value on its output ports and sends a "data_ready" signal to the sink. It waits for "data_ack" signal from the sink to go high and then writes out the next value.

  For architecture exploration, two models of the FFT system are developed. They share the communication protocol but differentiate at the data type to be transformed. The data type of the first model is float and second is sc_int<16>. Since the communication protocol is same, there is plenty of duplicate code within these two models. The duplication makes the development of other models harder, and easier to be inconsistent with existing ones, which hampers the architectural exploration of the FFT system. To eliminate the duplication, we FOR this system, separate its communication protocol and computation into different layers and thus make the communication protocol reusable.

  The project can be download at http://www.kaixin001.com/file/file.php?verify=6304157_1008_6304157_1223043483_ab5417317ab33eebf59253b4c22128bb&fileid=831633&uid=6304157

We encapsulate the communication protocol into the base layer. The base FFT module can be seen in the project, read_in, compute, write_out are all hook functions related with computation and will be refined in the computation layer. Base source and sink module can be seen in the project, as well as base top module. Comparing the codes with the communication protocol, we see that the base layer is a straightforward and cohesive implementation of the protocol. We encapsulate the float point related FFT computation into the flpt layer. We encapsulate the fix point related FFT computation into the fxpt layer. Now, to obtain our float point model, all we need to do is write a simple configuration file to configure the composition of base layer and flpt layer; and the fix point model can be obtained by modifying the configuration file to compose fxpt layer with base layer.

  As we can see from the case, the featurezation of communication protocol and computation model makes the architectural exploration of the FFT system much easier.

A.     Performance analysis

  To analyze the performance of our models, we develop a performance analysis layer. And for the purpose of compare, we analyze the performance of the two original models by injecting a fragment of same code into them. The result of the performance analysis is shown in Table 1. From the result we can see that the performance overhead of integrating FeatureC++ is ignorable. 

Modelbefore FORafter FORFOR overhead
Float point 330.2ms345.3ms4.57%
Fix point 423.35ms435.97ms2.98%

Table 1: average perform time of the FFT system before/after FOR. Every performance transforms 400 groups of sample data and the average time is obtained by 60 times performance.

原创粉丝点击