G.726 ADPCM Codec

An example of a G.726 (ADPCM) firmware development process using CD2450.

title

1. Scenario

You plan to develop a firmware of G.726 ADPCM type data compression algorithm using CD2450 DSP core. But, you do not need the full compliance of the G.726, and need to minimize the code, yet keep a toll quality compression. So, you may need to hear the decoded sound to check the distortion your program may bring every time you change your program parameters. Now, what you need for this purpose will be something like Fig.1.

S/W Environment.

Fig.1 Development environment.


Probably, you do not have any hardware necessary to construct such architecture at the time point you may start the project. None the less, you need to develop the firmware assigning all the parameters with which some acceptable compression quality and code size, MIPS balance. This situation is quite normal for the firmware developers. As the basic algorithm in this example (G.726) is widely known and well analyzed, you probably just code it to obtain a first cut code without having big troubles. But, you do not have a hardware to check it.

title

2. S/W only environment.

You may try to use simulator to check your code, instead of just sitting back to wait for the hardware's coming out. But, how can we handle the real time input and output data? You can store an input data stream on a file, and the corresponding output data stream can be stored in an output file. If you can read/write .WAV file from your firmware or simulator, this would not be a big problem. So, you would get the architecture like Fig.2, now.

System you may need.

Fig.2 Simulation environment.

title

3. I/O Simulation.

Q.

OK. We can use a simulator on the Algorithm part, for sure. The inp.wav and out.wav files are no problem to accept. But, you are missing two more points to cover the whole simulation. (1)We are assigning some hardware ports to input/output ports, How can we connect the inp.wav/out.wav files with the algorithm part? (2)We use interrupt to synchronize the I/O with the algorithm, How can we do it?

A.

Don't worry. The BUGSFINDER has a simple idea to resolve the problems. Let's say you want assign EXT2 register as the input port and the DRAM0 address 0x1000 as the output port. You expect to read a datum from the inp.wav file when you try to "read" a datum from EXT2 register(port). In the same way, a datum written into the RAM0 address 0x1000 is automatically written into the out.wav file. These are done utilizing a powerful "break point" capability of the BUGSFINDER. So, you do not need to modify your program(Firmware) to set up these I/O simulation.
The interrupt is also simulated using "break point function" easily.

title

4. Simulation.


Now, you have prepared the first cut of your G.726 program: g726.x, which read the input data from EXT3 register address and output the data onto EXT4 register address. The BUGSFINDER currently runs on only US DOS window to get the best simulation speed. Opening screen of the BUGSFINDER under 43 line window is like Fig.3.

Opening Screen.

Fig.3 Bugsfinder Opening Window.

title

5. Set Up

You can set up the BUGSFINDER interactively using mouse, or just use the command sub window to type in from keyboard.

load g726.x
brk N=4000 always interrupt:2
brk read:ext3 always Read:ext3=inp.wav/wav
brk write:ext4 always Write:ext4=out5.wav/wav

Program Set up.

Fig.4 Set up commands.

title

6. Run the Simulator

Then, you can run the simulation by hitting Ctl-F9. The simulation takes place in about 100K - 300K instructions/sec. on a Pentium 166MHz PC. The simulation stops by hitting the left SHIFT key. The screen of the BUGSFINDER is refreshed when the simulation stops.

Sim stop.

Fig.5 Bugsfinder stops by hitting the left SHIFT key.

title

7. Check the result.

After closing the inp.wav/out.wav files with "Close" command, you can get an output WAV file. You can listen to the output through your PC sound card H/W with any multimedia player.
Click Original to hear the original sound.
Click 16Kbps ADPCMto hear the 16 Kbps ADPCM sound generated by the G726.X program.
Click 32Kbps ADPCMto hear the 32 Kbps ADPCM sound generated by the G726.X program.

  • If you use MATLAB and hope to control the BUGSFINDER from your MATLAB environment, please check MATLAB I/Fto see an example.


---END---

Return to Clarkspur HOME PAGE .