Choosing Functions to Generate

After completing the design of a circuit, you must decide which parts of the circuit will need to be dynamically reconfigured. You then specify which C Code functions from each CAM in the circuit should be generated into the C Code.

Design the Circuit

The example we will use is a simple audio filter. It puts the low frequencies on the left speaker channel and the high frequencies on the right speaker channel. The design is deliberately not as compact or efficient as it could be, but uses a variety of CAMs for the purposes of this tutorial.

Choose the CAM C Code Functions

The circuit is now complete. We have made the decision that we need to dynamically reconfigure the high-pass filter on the right channel, and the gain stage on the left channel. By default all CAM C Code functions are on, so we need to turn off the functions for the CAMs we will not be dynamically reconfiguring.

To bring up the C Code functions for a particular CAM, you can:

1.Right-click on the CAM and choose C Code Functions from the context menu;

2.Open the Set CAM Parameters Window and click on the C Code… button.

Using one of these methods, we open the C Code Functions Window for the gain stage on the right channel. This CAM has been named GainInv_Right. We do not need to dynamically reconfigure this CAM, so we deselect all of the functions if offers.

Next we need to turn off all of the functions for low-pass filter. This time we will use the Global C Code Functions Window to turn off the functions. To open this window, choose C Code à CAM Functions… from the AnadigmDesigner®2 main menu. This window will show us the C Code functions of every CAM in the circuit organized in several different ways.

We first see is a list of all the available CAM Types in the Selection Pane. The window shows that all functions for the CAM Type ANx20 Standard\GainInv are turned off. This means than no C Code functions will be generated for any CAM in the circuit that is this type. This is because we only have one instance of this CAM Type (the GainInv_Right) and we turned off all of its functions.

We notice in the window that the MUX input cell has C Code functions and they are turned on. We do not need to program the MUX CAM, so we uncheck the box to turn all of its functions off.

Now we will turn off the functions for the low-pass filter. However, we cannot use this particular view to do it. If we unchecked the ANx20 Standard\FilterBiquad, it would turn off the C Code functions for all CAMs of that type, meaning it would also turn off the functions of our high-pass filter. To achieve our goal, first click on the Group By selection box and choose Instance Name from the list. The Selection Pane on the right will now show a list of all the CAM instances in the circuit. We can see that the GainInv_Right and InputCell4 (the MUX) already have all of their C Code turned off. To turn off the functions for that low-pass filter on the left channel, click on uncheck the box next to Filter_Left.

Right now, all of the C Code functions for the Filter_Right and the Gain_Left will be generated. We may not need every function they have to offer, so we will probe a little further to eliminate unnecessary functions.

By clicking on the ‘+’ next to Instance Name in the CAM Explorer on the left we can expand the node to list all of the CAM instance names. First select Filter_Right. The Selection Pane then shows all of the available C Code functions for that CAM instance. We do not need to explicitly change capacitor values using C Code, so we turn the SetBQHighPassCaps function off. Next select Gain_Left in the CAM Explorer. We will not be using fixed point math, so we turn off the fixed_setGainHold function by unchecking it in the Selection Pane.

Now the Gain_Left CAM and the Filter_Right CAM have one C Code function turned on and one C Code function turned off. Now select the root Instance Name node in the CAM Explorer. In the Selection Pane, you can see that the check in box next to these two CAMs is gray, indicating that C Code functions for these CAMs are not all the way on, nor all the way off.