【正文】
thm of ROM pression As is known, phase truncation error is the main factor of output waveform distortion. To avoid this, the ROM size must be exponentially increased, however the EAB of FPGA is limited. So the algorithm of ROM pression based on the symmetry of sine wave is adopted in the system. Sine wave of one period is divided into 4 sections: [0~π/2] 、 [π/2~π] 、 [π~3π/2] 、 [3π/2~2π]. Using the symmetry of sine wave, sampled amplitudes of the first section are stored in the ROM table. By address conversion and amplitude conversion, sampled amplitudes of one period sine wave can be generated. By this means, the ROM size is a quarter of the previous size. In the same ROM, sampling points can be increased by 4 times with this method. Sampled amplitudes of quarter wave are stored in the ROM table. The output address of phase accumulator is (L+2)bit. The low Lbit are used to query the ROM table while the high 2bit are used to identify phase sections. When the highest bit is 1, the output of ROM table should be symmetrically converted by the amplitude convertor. When the second highest bit is 1, the Lbit address should be symmetrically converted by the address convertor. 4. System design based on FPGA The system can be divided into two function modules: sine wave generation module and harmonic synthesis module. Sine wave generation module is the key part of the system. It can be divided into phase accumulator module and ROM pression module . Altera FPGA EP2C5Q208C8 is adopted as the core ponent of the system. VHDL is used to program the whole system. Compilation and simulation are implemented in Quartus Ⅱ . . Sine wave generation module phase accumulator module is posed of 24bit accumulator and 11bit adder. Under the control of system clock, the output of 24bit accumulator is accumulated with 9bit frequency control word. Then 11bit adder adds 11bit phase control word to the output of accumulator. High 13bit of the final result are used as address to query the ROM pression module. ROM pression module is posed of address convertor, amplitude convertor and ROM table. 13bit address of phase accumulator module is divided into three parts. The highest bit is used as trigger signal of the amplitude convertor. The second highest bit is used as trigger signal of the address convertor. The low 11bit are used to query the ROM table. Then sampled amplitudes of sine wave are generated. Simulation result of sine wave generation module is shown in . Frequency control word is set as 50 while phase control word is set as 180. When the enable signal is turned into low level, the first output value is the waveform data of address 180 in the ROM table. With each rising edge of system clock, the waveform data of address 180, 181, 182, 183 are sent out. The output values are respectively 76, 76, 77, 77. . Harmonic synthes