SystemC Development with CapsimTMK

IIR Digital Filter Implemented with Biquads

SystemC Development

 

Getting Started

Download

Blocks

Sample Applications

SystemC Resources

IIR Filter Example

The IIR filter is implemented with biquad sections and implements a voiceband low pass filter. The block diagram is created with CapsimTMK. All the SystemC block header files and the main.cpp code that instantiates and connects the blocks along with clock generation and reset are automatically generated from the topology.

 

 

 

 

 

 

Biquad Section

 

 

 

 

 

 

Section a1 a2 b1 b2
1 1.000000000e+00 0 -1.435730934e+00 8.886723518e-01
2 -1.259838581e+00 1 -1.304100513e+00 5.943995118e-01
3 -7.034238577e-01 1.0 -6.085025668e-01 0
         

a0=1.0

Normailzation=1/3.728533173e+01
Sampling Rate= 3200 Hz


The following results are based on an impulse stimulus with 128 samples. The frequency response is based on the FFT of the 128 point impulse response.

Blocks and Conversions
XML SystemC
SystemC Header Block
C Stub Block
imp.c
biquad.c

See main.cpp for instantiation and connections.

The topology generated by CapsimTMK is shown here.

The XML Topology from which main.cpp is generated is shown here.

Impulse REsponse (128 Samples)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Frequency Response (128 Point FFT)

 

 

 

 

 

 

 

 

 

 

 

 

 

CapsimTMK Topology

# topology file: iirfil.t
#--------------------------------------------------- 
       # Title: 
       # Author: 
       # Date: 
       # Description: 
       #--------------------------------------------------- 
inform title 
       inform author 
       inform date 
       inform descrip 
arg -1 (none)
param int 128 numberOfSamples "Total number of samples to output"
       block imp0 imp
param float 1 zsec1 "zsec1"
       param float 0 zsec2 "zsec2"
       param float -1.43573093414306641 psec1 "psec1"
       param float 0.888672351837158203 psec2 "psec2"
       block biquad0 biquad
param float -1.25983858108520508 zsec1 "zsec1"
       param float 1 zsec2 "zsec2"
       param float -1.30410051345825195 psec1 "psec1"
       param float 0.594399511814117432 psec2 "psec2"
       block biquad1 biquad
param float -0.703423857688903809 zsec1 "zsec1"
       param float 0.999999880790710449 zsec2 "zsec2"
       param float -0.608502566814422607 psec1 "psec1"
       param float 0 psec2 "psec2"
       block biquad2 biquad
param int 1 control "TControl (0=off 1=on)"
       block printsc0 printsc
param float 0.02682019855 factor "Gain factor"
       block gainsc0 gainsc
connect imp0 0 biquad0 0 {imp0:y:float,biquad0:x:float}
       connect biquad0 0 biquad1 0 {biquad0:y:float,biquad1:x:float}
       connect biquad1 0 biquad2 0 {biquad1:y:float,biquad2:x:float}
       connect biquad2 0 gainsc0 0 {biquad2:y:float,gainsc0:x:float}
       connect gainsc0 0 printsc0 0 {gainsc0:y:float,printsc0:x:float}

XML Topology (Created by top2xml.pl)

<TOPOLOGY>
<INFORMATION>
 <INFO><ELEMENT>title</ELEMENT><TEXT></TEXT></INFO>
 <INFO><ELEMENT>author</ELEMENT><TEXT></TEXT></INFO>
 <INFO><ELEMENT>date</ELEMENT><TEXT></TEXT></INFO>
 <INFO><ELEMENT>descrip</ELEMENT><TEXT></TEXT></INFO>
 </INFORMATION>
<ARGUMENTS>
 <ARG><NUMBER>-1</NUMBER><TYPE>(none)</TYPE><VALUE></VALUE><DEF>arg</DEF></ARG>
 </ARGUMENTS>
     
<BLOCKS>
<BLOCK_INST>
 <PARAMETERS>
 <PARAM><TYPE>int</TYPE><VALUE>128</VALUE><NAME>numberOfSamples</NAME><DEF>"Total number of samples to output"</DEF></PARAM>
 </PARAMETERS>
 <BLOCK><NAME>imp0</NAME><MODEL>imp</MODEL></BLOCK>
 </BLOCK_INST>
     
<BLOCK_INST>
 <PARAMETERS>
 <PARAM><TYPE>float</TYPE><VALUE>1</VALUE><NAME>zsec1</NAME><DEF>"zsec1"</DEF></PARAM>
 <PARAM><TYPE>float</TYPE><VALUE>0</VALUE><NAME>zsec2</NAME><DEF>"zsec2"</DEF></PARAM>
 <PARAM><TYPE>float</TYPE><VALUE>-1.43573093414306641</VALUE><NAME>psec1</NAME><DEF>"psec1"</DEF></PARAM>
 <PARAM><TYPE>float</TYPE><VALUE>0.888672351837158203</VALUE><NAME>psec2</NAME><DEF>"psec2"</DEF></PARAM>
 </PARAMETERS>
 <BLOCK><NAME>biquad0</NAME><MODEL>biquad</MODEL></BLOCK>
 </BLOCK_INST>
     
<BLOCK_INST>
 <PARAMETERS>
 <PARAM><TYPE>float</TYPE><VALUE>-1.25983858108520508</VALUE><NAME>zsec1</NAME><DEF>"zsec1"</DEF></PARAM>
 <PARAM><TYPE>float</TYPE><VALUE>1</VALUE><NAME>zsec2</NAME><DEF>"zsec2"</DEF></PARAM>
 <PARAM><TYPE>float</TYPE><VALUE>-1.30410051345825195</VALUE><NAME>psec1</NAME><DEF>"psec1"</DEF></PARAM>
 <PARAM><TYPE>float</TYPE><VALUE>0.594399511814117432</VALUE><NAME>psec2</NAME><DEF>"psec2"</DEF></PARAM>
 </PARAMETERS>
 <BLOCK><NAME>biquad1</NAME><MODEL>biquad</MODEL></BLOCK>
 </BLOCK_INST>
     
<BLOCK_INST>
 <PARAMETERS>
 <PARAM><TYPE>float</TYPE><VALUE>-0.703423857688903809</VALUE><NAME>zsec1</NAME><DEF>"zsec1"</DEF></PARAM>
 <PARAM><TYPE>float</TYPE><VALUE>0.999999880790710449</VALUE><NAME>zsec2</NAME><DEF>"zsec2"</DEF></PARAM>
 <PARAM><TYPE>float</TYPE><VALUE>-0.608502566814422607</VALUE><NAME>psec1</NAME><DEF>"psec1"</DEF></PARAM>
 <PARAM><TYPE>float</TYPE><VALUE>0</VALUE><NAME>psec2</NAME><DEF>"psec2"</DEF></PARAM>
 </PARAMETERS>
 <BLOCK><NAME>biquad2</NAME><MODEL>biquad</MODEL></BLOCK>
 </BLOCK_INST>
     
<BLOCK_INST>
 <PARAMETERS>
 <PARAM><TYPE>int</TYPE><VALUE>1</VALUE><NAME>control</NAME><DEF>"TControl (0=off 1=on)"</DEF></PARAM>
 </PARAMETERS>
 <BLOCK><NAME>printsc0</NAME><MODEL>printsc</MODEL></BLOCK>
 </BLOCK_INST>
     
<BLOCK_INST>
 <PARAMETERS>
 <PARAM><TYPE>float</TYPE><VALUE>0.02682019855</VALUE><NAME>factor</NAME><DEF>"Gain factor"</DEF></PARAM>
 </PARAMETERS>
 <BLOCK><NAME>gainsc0</NAME><MODEL>gainsc</MODEL></BLOCK>
 </BLOCK_INST>
     
</BLOCKS>
<CONNECTIONS>
 <CONNECT>
 <FROM>
 <NAME>imp0</NAME><PORT>0</PORT><PNAME>y</PNAME><PTYPE>float</PTYPE>
 </FROM>
 <TO>
 <NAME>biquad0</NAME><PORT>0</PORT><PNAME>x</PNAME><PTYPE>float</PTYPE>
 </TO>
 </CONNECT>
 <CONNECT>
 <FROM>
 <NAME>biquad0</NAME><PORT>0</PORT><PNAME>y</PNAME><PTYPE>float</PTYPE>
 </FROM>
 <TO>
 <NAME>biquad1</NAME><PORT>0</PORT><PNAME>x</PNAME><PTYPE>float</PTYPE>
 </TO>
 </CONNECT>
 <CONNECT>
 <FROM>
 <NAME>biquad1</NAME><PORT>0</PORT><PNAME>y</PNAME><PTYPE>float</PTYPE>
 </FROM>
 <TO>
 <NAME>biquad2</NAME><PORT>0</PORT><PNAME>x</PNAME><PTYPE>float</PTYPE>
 </TO>
 </CONNECT>
 <CONNECT>
 <FROM>
 <NAME>biquad2</NAME><PORT>0</PORT><PNAME>y</PNAME><PTYPE>float</PTYPE>
 </FROM>
 <TO>
 <NAME>gainsc0</NAME><PORT>0</PORT><PNAME>x</PNAME><PTYPE>float</PTYPE>
 </TO>
 </CONNECT>
 <CONNECT>
 <FROM>
 <NAME>gainsc0</NAME><PORT>0</PORT><PNAME>y</PNAME><PTYPE>float</PTYPE>
 </FROM>
 <TO>
 <NAME>printsc0</NAME><PORT>0</PORT><PNAME>x</PNAME><PTYPE>float</PTYPE>
 </TO>
 </CONNECT>
</CONNECTIONS>
</TOPOLOGY>

 

 

 

 

 


Contact | ©2007 Silcon DSP Corporation , Portland, Oregon