![]() |
|
ADSP 21xx
Have you found this site useful? Did we save you time? Did we cure your head-ache? Is your hair growing back now? Please make a donation to help with maintenance. |
Objective Real-Time Software on the ADSP21XXObjective CodeIntroductionCrucial to the manipulation of software objects is the efficient building of data pointers. The RISC like architecture of the ADSP family of digital signal processors with their large files of data index registers, is very well suited to this task, while the algebraic assembly language command set makes it easy to understand the flow of the code. The definition and use of multi dimensional data structures is best explained in a simple example. An Audio ObjectLet us examine the case of a 4 channel audio recorder. This device uses 4 CODECs for which we need a set of variables for the manipulation of Pulse Code Molulation (PCM) data. Our good friend Mr H.Acker would define the output audio variables as aud_a till aud_d. He would then handle the audio from the main program loop with calls to four procedures called aud_pcm_out_a till aud_pcm_out_d, like this:
This is however, clearly inefficient and is a typical example of redundant spaghetti code. H.Acker created four procedures that are essentially the same, except for the addresses of the variables they are accessing. A better aproach would be to define a structure, with a for loop and indirect addressing, as in this flat C example, but how does one do this in assembler?
A Simple Assembler ObjectData structures are the essence of object oriented design. If we can effectively handle structured data in assembler, then we can write objective code. Objects are accessed with data pointers, using the index registers for indirect addressing.
If an object consists of only 4 similar variables, a simple array declaration can be used.
|
|
Copyright © 1996-2008, Aerospace Software Ltd., GPL. |