- At the command prompt, type
open Lab1_3.slx
.This opens the Simulink design shown in the following figure. This design is similar to the one in the previous two steps. However, this time the filter is designed with discrete components and is only partially complete. As part of this step, you will complete this design and learn how to add and configure discrete parts.
This discrete filter operates in this way:
- Samples arrive through port In and after a delay stored in a shift register (instance ASR).
- A ROM is required for the filter coefficients.
- A counter is required to select both the data and coefficient samples for calculation.
- A multiply accumulate unit is required to perform the calculations.
- The final down-sample unit selects an output every nth cycle.
Start by adding the discrete components to the design.
- Click the Library Browser button in the
Simulink toolbar to open the Simulink Library Browser.
- Expand the Xilinx Blockset menu.
- As shown in the following figure, select the Sources section in the HDL library, then
right-click Counter to add this
component to the design.
- Select the Memory section (shown at the bottom left in the figure above) and add a ROM to the design.
- Finally, select the DSP section and add a DSP Macro 1.0 to the design.
- Connect the three new instances to the rest of the design as
shown in the following figure:
You will now configure the instances to correctly filter the data.
- Double-click the FDATool
instance and select Filter Coefficients from the
toolbar to review the filter specifications.
This shows the same specifications as the previous steps in Lab 1 and confirms there are 11 coefficients. You can also confirm, by double-clicking on the input Gateway In that the input sample rate is once again 20 MHz (Sample period = 1/20e6). With this information, you can now configure the discrete components.
- Close the FDATool Properties Editor.
- Double-click the Counter
instance to open the Properties Editor.
- For the Counter type, select Count limited and enter this value for Count to value:
length(xlfda_numerator('FDATool'))-1
This will ensure the counter counts from 0 to 10 (11 coefficient and data addresses).
- For Output type, leave default value at Unsigned and in Number of Bits enter the value 4. Only 4 binary address bits are required to count to 11.
- For the Explicit period, enter the value
1/(11*20e6)
to ensure the sample period is 11 times the input data rate. The filter must perform 11 calculations for each input sample.
- Click OK to exit the Properties Editor.
- For the Counter type, select Count limited and enter this value for Count to value:
- Double-click the ROM
instance to open the Properties Editor.
- For the Depth, enter the value
length(xlfda_numerator('FDATool'))
. This will ensure the ROM has 11 elements. - For the Initial value vector, enter
xlfda_numerator('FDATool')
. The coefficient values will be provided by the FDATool instance.
- Click OK to exit the Properties Editor.
- For the Depth, enter the value
- Double-click the DSP Macro 1.0
instance to open the Properties Editor.
- In the Instructions tab, replace the existing
Instructions with
A*B+P
and then addA*B
. When thesel
input is false the DSP will multiply and accumulate. When thesel
input is true the DSP will simply multiply.
- In the Pipeline Options tab, use the Pipeline Options drop-down menu to select By_Tier.
- Select Tier 3 and
Tier 5. This will ensure
registers are used at the inputs to A and B and between the multiply and
accumulate operations.
- In the Instructions tab, replace the existing
Instructions with
In this step you will see how
Model Composer can be used to build a design using discrete components to realize a very
efficient hardware design.