summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2')
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad.cpp67
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad.h79
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad2.f6
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/delay_line.cpp55
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/delay_line.h70
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/getres.cpp52
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/getres.h66
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/golden/biquad2.log100
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/main.cpp77
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/op_queue.cpp83
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/op_queue.h75
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/testbench.cpp104
-rw-r--r--src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/testbench.h69
13 files changed, 903 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad.cpp b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad.cpp
new file mode 100644
index 000000000..7664893a5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad.cpp
@@ -0,0 +1,67 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ biquad.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/* Filename biquad.cc */
+/* This is the implementation file for synchronous process `biquad' */
+
+#include "biquad.h"
+
+void biquad::entry()
+{
+ float Acc; // Accumulator
+ float sample; // Input sample
+
+ if ((bool) reset == true) {
+ Del[0] = Del[1] = Del[2] = Del[3] = 0.0;
+ out.write(0.0);
+ wait();
+ }
+
+ while (true) {
+ sample = in.read();
+ Acc = Cte[0] * sample;
+ for (int i = 0; i < 4; i++) {
+ Acc += Cte[i+1] * Del[i];
+ }
+ Acc = Acc / 1024.0;
+ Del[1] = Del[0]; Del[0] = sample;
+ Del[3] = Del[2]; Del[2] = Acc;
+ out.write(Acc);
+ wait();
+ }
+
+} // end of entry function
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad.h b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad.h
new file mode 100644
index 000000000..dd25ed436
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad.h
@@ -0,0 +1,79 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ biquad.h --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/* Filename biquad.h */
+/* This is the interface file for synchronous process `biquad' */
+
+#include "systemc.h"
+
+SC_MODULE( biquad )
+{
+ SC_HAS_PROCESS( biquad );
+
+ sc_in_clk clk;
+
+ sc_in<float> in;
+ sc_in<bool> reset;
+ sc_out<float> out;
+
+ int num_taps; //internal variable
+ float Del[4]; //internal variable
+ float Cte[5]; //internal variable
+
+ // Constructor
+ biquad( sc_module_name NAME,
+ sc_clock& CLK,
+ sc_signal<float>& IN1,
+ sc_signal<bool>& RESET,
+ sc_signal<float>& OUT1 )
+ {
+ clk(CLK);
+ in(IN1); reset(RESET); out(OUT1);
+ SC_CTHREAD( entry, clk.pos() );
+ reset_signal_is(reset,true);
+ // initialize the coefficient matrix
+ Cte[0] = 1.0;
+ Cte[1] = 2.0;
+ Cte[2] = 1.0;
+ Cte[3] = 0.75;
+ Cte[4] = -0.125;
+ Del[0] = Del[1] = Del[2] = Del[3] = 0.0;
+ }
+
+ // Process functionality in member function below
+ void entry();
+};
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad2.f b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad2.f
new file mode 100644
index 000000000..3afa2d3b8
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/biquad2.f
@@ -0,0 +1,6 @@
+biquad2/biquad.cpp
+biquad2/delay_line.cpp
+biquad2/getres.cpp
+biquad2/main.cpp
+biquad2/op_queue.cpp
+biquad2/testbench.cpp
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/delay_line.cpp b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/delay_line.cpp
new file mode 100644
index 000000000..8a5d03a82
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/delay_line.cpp
@@ -0,0 +1,55 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ delay_line.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/* Filename delay_line.cc */
+/* This is the implementation file for synchronous process `delay_line' */
+
+#include "delay_line.h"
+
+void delay_line::entry()
+{
+ for( int i = 0; i < delay; ++ i ) {
+ line[i] = 0;
+ }
+ while (true) {
+ out.write(line[delay-1]);
+ for (int i = delay - 1; i > 0; i--)
+ line[i] = line[i-1];
+ line[0] = in.read();
+ wait();
+ }
+} // end of entry function
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/delay_line.h b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/delay_line.h
new file mode 100644
index 000000000..931a3a526
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/delay_line.h
@@ -0,0 +1,70 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ delay_line.h --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/* Filename delay_line.h */
+/* This is the interface file for synchronous process `delay_line' */
+
+#include "systemc.h"
+
+SC_MODULE( delay_line )
+{
+ SC_HAS_PROCESS( delay_line );
+
+ sc_in_clk clk;
+
+ sc_in<float> in;
+ sc_out<float> out;
+
+ const int delay; //internal variable
+ float *line; // delay line
+
+ // Constructor
+ delay_line( sc_module_name NAME,
+ sc_clock& CLK,
+ sc_signal<float>& IN1,
+ sc_signal<float>& OUT1,
+ int DELAY=4 ) : delay(DELAY)
+ {
+ clk(CLK);
+ in(IN1); out(OUT1);
+ SC_CTHREAD( entry, clk.pos() );
+ line = new float[delay];
+ }
+
+ // Process functionality in member function below
+ void entry();
+};
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/getres.cpp b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/getres.cpp
new file mode 100644
index 000000000..2b54423e2
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/getres.cpp
@@ -0,0 +1,52 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ getres.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/* Filename getres.cc */
+/* This is the implementation file for synchronous process `getres' */
+
+#include "getres.h"
+
+void getres::entry()
+{
+ while (true) {
+ pop.write(true);
+ wait();
+ char buf[BUFSIZ];
+ sprintf( buf, "Result = %f", result.read() );
+ cout << buf << endl;
+ }
+} // end of entry function
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/getres.h b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/getres.h
new file mode 100644
index 000000000..d3ba7279b
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/getres.h
@@ -0,0 +1,66 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ getres.h --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/* Filename getres.h */
+/* This is the interface file for synchronous process `getres' */
+
+#include "systemc.h"
+
+SC_MODULE( getres )
+{
+ SC_HAS_PROCESS( getres );
+
+ sc_in_clk clk;
+
+ sc_in<float> result;
+ sc_out<bool> pop;
+
+ // Constructor
+ getres( sc_module_name NAME,
+ sc_clock& CLK,
+ sc_signal<float>& RESULT,
+ sc_signal<bool>& POP )
+ {
+ clk(CLK);
+ result(RESULT);
+ pop(POP);
+ SC_CTHREAD( entry, clk.pos() );
+ }
+
+ // Process functionality in member function below
+ void entry();
+};
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/golden/biquad2.log b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/golden/biquad2.log
new file mode 100644
index 000000000..e7ab8cd52
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/golden/biquad2.log
@@ -0,0 +1,100 @@
+SystemC Simulation
+Result = 0.000000
+Result = 0.000000
+Result = 0.000000
+Result = 0.000000
+Result = 0.000000
+Result = 0.000000
+Input = 0.000000 Output = 0.000000 Result = 0.000000
+Input = 0.062791 Output = 0.000000 Result = 0.000000
+Input = 0.125333 Output = 0.000061 Result = 0.000000
+Input = 0.187381 Output = 0.000245 Result = 0.000000
+Input = 0.248690 Output = 0.000489 Result = 0.000000
+Input = 0.309017 Output = 0.000732 Result = 0.000000
+Input = 0.368125 Output = 0.000971 Result = 0.000000
+Input = 0.425779 Output = 0.001207 Result = 0.000000
+Input = 0.481754 Output = 0.001437 Result = 0.000000
+Input = 0.535827 Output = 0.001662 Result = 0.000061
+Input = 0.587785 Output = 0.001881 Result = 0.000245
+Input = 0.637424 Output = 0.002092 Result = 0.000489
+Input = 0.684547 Output = 0.002295 Result = 0.000732
+Input = 0.728969 Output = 0.002489 Result = 0.000971
+Input = 0.770513 Output = 0.002673 Result = 0.001207
+Input = 0.809017 Output = 0.002846 Result = 0.001437
+Input = 0.844328 Output = 0.003009 Result = 0.001662
+Input = 0.876307 Output = 0.003159 Result = 0.001881
+Input = 0.904827 Output = 0.003297 Result = 0.002092
+Input = 0.929776 Output = 0.003422 Result = 0.002295
+Input = 0.951056 Output = 0.003533 Result = 0.002489
+Input = 0.968583 Output = 0.003631 Result = 0.002673
+Input = 0.982287 Output = 0.003714 Result = 0.002846
+Input = 0.992115 Output = 0.003782 Result = 0.003009
+Input = 0.998027 Output = 0.003836 Result = 0.003159
+Input = 1.000000 Output = 0.003874 Result = 0.003297
+Input = 0.998027 Output = 0.003897 Result = 0.003422
+Input = 0.992115 Output = 0.003905 Result = 0.003533
+Input = 0.982287 Output = 0.003897 Result = 0.003631
+Input = 0.968583 Output = 0.003874 Result = 0.003714
+Input = 0.951057 Output = 0.003836 Result = 0.003782
+Input = 0.929777 Output = 0.003782 Result = 0.003836
+Input = 0.904827 Output = 0.003714 Result = 0.003874
+Input = 0.876307 Output = 0.003631 Result = 0.003897
+Input = 0.844328 Output = 0.003533 Result = 0.003905
+Input = 0.809017 Output = 0.003422 Result = 0.003897
+Input = 0.770513 Output = 0.003297 Result = 0.003874
+Input = 0.728969 Output = 0.003159 Result = 0.003836
+Input = 0.684547 Output = 0.003009 Result = 0.003782
+Input = 0.637424 Output = 0.002847 Result = 0.003714
+Input = 0.587785 Output = 0.002673 Result = 0.003631
+Input = 0.535827 Output = 0.002489 Result = 0.003533
+Input = 0.481754 Output = 0.002295 Result = 0.003422
+Input = 0.425779 Output = 0.002092 Result = 0.003297
+Input = 0.368125 Output = 0.001881 Result = 0.003159
+Input = 0.309017 Output = 0.001663 Result = 0.003009
+Input = 0.248690 Output = 0.001438 Result = 0.002847
+Input = 0.187381 Output = 0.001207 Result = 0.002673
+Input = 0.125333 Output = 0.000971 Result = 0.002489
+Input = 0.062791 Output = 0.000732 Result = 0.002295
+Input = 0.000000 Output = 0.000490 Result = 0.002092
+Input = -0.062790 Output = 0.000245 Result = 0.001881
+Input = -0.125333 Output = 0.000000 Result = 0.001663
+Input = -0.187381 Output = -0.000245 Result = 0.001438
+Input = -0.248690 Output = -0.000489 Result = 0.001207
+Input = -0.309017 Output = -0.000732 Result = 0.000971
+Input = -0.368124 Output = -0.000971 Result = 0.000732
+Input = -0.425779 Output = -0.001207 Result = 0.000490
+Input = -0.481754 Output = -0.001437 Result = 0.000245
+Input = -0.535827 Output = -0.001662 Result = 0.000000
+Input = -0.587785 Output = -0.001881 Result = -0.000245
+Input = -0.637424 Output = -0.002092 Result = -0.000489
+Input = -0.684547 Output = -0.002295 Result = -0.000732
+Input = -0.728969 Output = -0.002489 Result = -0.000971
+Input = -0.770513 Output = -0.002673 Result = -0.001207
+Input = -0.809017 Output = -0.002846 Result = -0.001437
+Input = -0.844328 Output = -0.003009 Result = -0.001662
+Input = -0.876307 Output = -0.003159 Result = -0.001881
+Input = -0.904827 Output = -0.003297 Result = -0.002092
+Input = -0.929776 Output = -0.003422 Result = -0.002295
+Input = -0.951056 Output = -0.003533 Result = -0.002489
+Input = -0.968583 Output = -0.003631 Result = -0.002673
+Input = -0.982287 Output = -0.003714 Result = -0.002846
+Input = -0.992115 Output = -0.003782 Result = -0.003009
+Input = -0.998027 Output = -0.003836 Result = -0.003159
+Input = -1.000000 Output = -0.003874 Result = -0.003297
+Input = -0.998027 Output = -0.003897 Result = -0.003422
+Input = -0.992115 Output = -0.003905 Result = -0.003533
+Input = -0.982287 Output = -0.003897 Result = -0.003631
+Input = -0.968583 Output = -0.003874 Result = -0.003714
+Input = -0.951057 Output = -0.003836 Result = -0.003782
+Input = -0.929777 Output = -0.003782 Result = -0.003836
+Input = -0.904827 Output = -0.003714 Result = -0.003874
+Input = -0.876307 Output = -0.003631 Result = -0.003897
+Input = -0.844328 Output = -0.003533 Result = -0.003905
+Input = -0.809017 Output = -0.003422 Result = -0.003897
+Input = -0.770513 Output = -0.003297 Result = -0.003874
+Input = -0.728969 Output = -0.003159 Result = -0.003836
+Input = -0.684547 Output = -0.003009 Result = -0.003782
+Input = -0.637424 Output = -0.002847 Result = -0.003714
+Input = -0.587785 Output = -0.002673 Result = -0.003631
+Input = -0.535827 Output = -0.002489 Result = -0.003533
+Input = -0.481754 Output = -0.002295 Result = -0.003422
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/main.cpp b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/main.cpp
new file mode 100644
index 000000000..d7924c12b
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/main.cpp
@@ -0,0 +1,77 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/* Main routine for biquad simulation */
+
+#include "testbench.h"
+#include "biquad.h"
+#include "delay_line.h"
+#include "op_queue.h"
+#include "getres.h"
+
+int
+sc_main(int ac, char *av[])
+{
+ sc_signal<float> sample;
+ sc_signal<float> result;
+ sc_signal<float> delayed_out;
+ sc_signal<float> final_out;
+ sc_signal<bool> reset;
+ sc_signal<bool> pop;
+
+ sample = 0.0;
+ result = 0.0;
+ delayed_out = 0.0;
+ final_out = 0.0;
+ pop = false;
+
+ sc_clock clk("Clock", CLOCK_PERIOD, SC_NS);
+
+ testbench TB("TB", clk, result, reset, sample);
+ biquad filter("BFILTER", clk, sample, reset, result);
+ delay_line D("Delay", clk, result, delayed_out);
+ op_queue OPQ("OPQueue", clk, delayed_out, pop, final_out, 1000);
+ getres OP("OPStage", clk, final_out, pop);
+
+ int n;
+ if (ac == 2)
+ n = atoi(av[1]);
+ else
+ n = 10000;
+ sc_start(n, SC_NS);
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/op_queue.cpp b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/op_queue.cpp
new file mode 100644
index 000000000..082cd93ac
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/op_queue.cpp
@@ -0,0 +1,83 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ op_queue.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/* Filename op_queue.cc */
+/* This is the implementation file for synchronous process `op_queue' */
+
+#include "op_queue.h"
+
+// Queue management. Assuming a circular queue.
+
+void op_queue::entry()
+{
+ bool to_pop;
+ int tail, head;
+ bool queue_empty = true;
+ bool queue_full = false;
+
+ out = 0.0;
+
+ head = 0;
+ tail = 0;
+ while (true) {
+ if (!queue_full) {
+ queue[tail] = in.read();
+ tail = (tail + 1) % queue_size;
+ queue_empty = false;
+ if (tail == head) queue_full = true;
+ }
+ else {
+ cout << "Warning: Data is being lost because queue is full" << endl;
+ }
+
+ to_pop = pop.read();
+ if (to_pop) {
+ if (!queue_empty) {
+ out.write(queue[head]);
+ head = (head + 1) % queue_size;
+ queue_full = false;
+ if (head == tail) queue_empty = true;
+ }
+ else {
+ cout << "Warning: No data in queue to be popped" << endl;
+ }
+ }
+
+ wait();
+ }
+
+} // end of entry function
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/op_queue.h b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/op_queue.h
new file mode 100644
index 000000000..041dd7220
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/op_queue.h
@@ -0,0 +1,75 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ op_queue.h --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/* Filename op_queue.h */
+/* This is the interface file for synchronous process `op_queue' */
+
+#include "systemc.h"
+
+SC_MODULE( op_queue )
+{
+ SC_HAS_PROCESS( op_queue );
+
+ sc_in_clk clk;
+
+ sc_in<float> in;
+ sc_in<bool> pop;
+ sc_out<float> out;
+
+ const int queue_size; //internal variable
+ float *queue; //internal variable
+
+ // Constructor
+ op_queue( sc_module_name NAME,
+ sc_clock& CLK,
+ sc_signal<float>& IN1,
+ sc_signal<bool>& POP,
+ sc_signal<float>& OUT1,
+ int QUEUE_SIZE = 4 )
+ : queue_size(QUEUE_SIZE)
+ {
+ clk(CLK);
+ in(IN1);
+ pop(POP);
+ out(OUT1);
+ SC_CTHREAD( entry, clk.pos() );
+ queue = new float[queue_size];
+ }
+
+ // Process functionality in member function below
+ void entry();
+};
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/testbench.cpp b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/testbench.cpp
new file mode 100644
index 000000000..983bada92
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/testbench.cpp
@@ -0,0 +1,104 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ testbench.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/* Filename testbench.cc */
+/* This is the implementation file for synchronous process `testbench' */
+
+#include "testbench.h"
+
+float gen_sample(float t);
+
+void testbench::entry()
+{
+ float sample_val;
+ float result_val;
+ float time;
+
+ FILE *data1 = fopen("Sample", "w");
+ FILE *data2 = fopen("Result", "w");
+
+ reset.write(true);
+ wait(5);
+ reset.write(false);
+ wait();
+
+ time = 0.0;
+ while (true) {
+ sample_val = gen_sample(time);
+ sample.write(sample_val);
+ wait();
+ result_val = result.read();
+ fprintf(data1, "%f\t%f\n", time, sample_val);
+ fprintf(data2, "%f\t%f\n", time, result_val);
+ char buf[BUFSIZ];
+ sprintf( buf, "Input = %f\tOutput = %f\t", sample_val, result_val );
+ cout << buf << flush;
+ time += 1.0;
+ }
+} // end of entry function
+
+
+float
+gen_step(float t)
+{
+ if (t < 10.0)
+ return (0.0);
+ else
+ return (1.0);
+}
+
+float
+gen_impulse(float t)
+{
+ if (t == 20.00)
+ return (1.00);
+ else
+ return (0.00);
+}
+
+float
+gen_sine(float t, float freq) // freq in Hertz
+{
+ return sin(6.283185 * freq * t * CLOCK_PERIOD * 1e-9);
+}
+
+// This function actually generates the samples
+float
+gen_sample(float t)
+{
+ return (gen_sine(t, 100000));
+}
diff --git a/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/testbench.h b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/testbench.h
new file mode 100644
index 000000000..121a7552c
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/testbench.h
@@ -0,0 +1,69 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ testbench.h --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/* Filename testbench.h */
+/* This is the interface file for synchronous process `testbench' */
+
+#include "systemc.h"
+
+SC_MODULE( testbench )
+{
+ SC_HAS_PROCESS( testbench );
+
+ sc_in_clk clk;
+
+ sc_in<float> result;
+ sc_out<bool> reset;
+ sc_out<float> sample;
+
+ // Constructor
+ testbench( sc_module_name NAME,
+ sc_clock& CLK,
+ sc_signal<float>& RESULT,
+ sc_signal<bool>& RESET,
+ sc_signal<float>& SAMPLE )
+ {
+ clk(CLK);
+ result(RESULT); reset(RESET); sample(SAMPLE);
+ SC_CTHREAD( entry, clk.pos() );
+ }
+
+ // Process functionality in member function below
+ void entry();
+};
+
+#define CLOCK_PERIOD 100