Add wasm tacle-bench targets

This commit is contained in:
2026-06-12 20:06:22 +02:00
parent 30daa8a00c
commit 08c2e9c13d
1122 changed files with 520422 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# ~~~
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2026, Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU)
# ~~~
cmake_minimum_required(VERSION 3.20)
project(iir)
set(TACLEBENCH_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../..")
set(REPOSITORY_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../..")
set(APP_TARGET_NAME "${CMAKE_PROJECT_NAME}")
if(DEFINED TACLEBENCH_VARIANT AND "${TACLEBENCH_VARIANT}" STREQUAL "inline")
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/inline/iir.c")
else()
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/default/iir.c")
endif()
include(${REPOSITORY_ROOT_PATH}/cmake/taclebench_wasm.cmake)

View File

@ -0,0 +1,39 @@
File: iir.c
Original provenience: DSPstone benchmark suite (floating point),
http://www.ice.rwth-aachen.de/research/tools-projects/entry/detail/dspstone
2015-10-10:
- Removed original header comment, replaced by TACLeBench header.
- Removed all preprocessor macros, integrated them directly in the source code.
- Added prefix "iir" to all global symbols.
- Added explicit forward declarations of functions.
- Replaced local variables "wi", "coefficients" and "x" that store the
benchmark's input data by global variables.
- Replaced initialization function iir_pin_down by TACLeBench-compliant
initialization code.
- Removed second call of iir_pin_down from function iir_main since it does
not make sense at all.
- Added new function iir_return producing a checksum as return value.
- Added new function iir_main according to TACLeBench guidelines.
iir_main is annotated as entry-point for timing analysis.
- Applied code formatting according to the following rules
- Lines shall not be wider than 80 characters; whenever possible, appropriate
line breaks shall be inserted to keep lines below 80 characters
- Indentation is done using whitespaces only, no tabs. Code is indented by
two whitespaces
- Two empty lines are put between any two functions
- In non-empty lists or index expressions, opening '(' and '[' are followed by
one whitespace, closing ')' and ']' are preceded by one whitespace
- In comma- or colon-separated argument lists, one whitespace is put after
each comma/colon
- Names of functions and global variables all start with a benchmark-specific
prefix (here: bs_) followed by lowercase letter (e.g., bs_square)
- For pointer types, one whitespace is put before the '*'
- Operators within expressions shall be preceded and followed by one
whitespace
- Code of then- and else-parts of if-then-else statements shall be put in
separate lines, not in the same lines as the if-condition or the keyword
"else"
- Opening braces '{' denoting the beginning of code for some if-else or loop
body shall be put at the end of the same line where the keywords "if",
"else", "for", "while" etc. occur

Binary file not shown.

View File

@ -0,0 +1,663 @@
(module $iir.wasm
(type (;0;) (func (param i32 i32)))
(type (;1;) (func))
(type (;2;) (func (result i32)))
(import "__pragma" "loopbound" (func $__pragma_loopbound (type 0)))
(func $__wasm_apply_data_relocs (type 1))
(func $iir_init (type 1)
(local i32 i32 i32)
global.get $__stack_pointer
i32.const 16
i32.sub
local.tee 0
global.set $__stack_pointer
local.get 0
i32.const 0
i32.store8 offset=15
i32.const 20
i32.const 20
call $__pragma_loopbound
i32.const 0
i32.const 1088421888
i32.store offset=1024
i32.const 0
i32.const 1088421888
i32.store offset=1028
i32.const 0
i32.const 1088421888
i32.store offset=1032
i32.const 0
i32.const 1088421888
i32.store offset=1036
i32.const 0
i32.const 1088421888
i32.store offset=1040
i32.const 0
i32.const 1088421888
i32.store offset=1044
i32.const 0
i32.const 1088421888
i32.store offset=1048
i32.const 0
i32.const 1088421888
i32.store offset=1052
i32.const 0
i32.const 1088421888
i32.store offset=1056
i32.const 0
i32.const 1088421888
i32.store offset=1060
i32.const 0
i32.const 1088421888
i32.store offset=1064
i32.const 0
i32.const 1088421888
i32.store offset=1068
i32.const 0
i32.const 1088421888
i32.store offset=1072
i32.const 0
i32.const 1088421888
i32.store offset=1076
i32.const 0
i32.const 1088421888
i32.store offset=1080
i32.const 0
i32.const 1088421888
i32.store offset=1084
i32.const 0
i32.const 1088421888
i32.store offset=1088
i32.const 0
i32.const 1088421888
i32.store offset=1092
i32.const 0
i32.const 1088421888
i32.store offset=1096
i32.const 0
i32.const 1088421888
i32.store offset=1100
i32.const 8
i32.const 8
call $__pragma_loopbound
i32.const 0
i32.const 1065353216
i32.store offset=1136
i32.const 0
i32.const 0
i32.store offset=1104
i32.const 0
i32.const 0
i32.store offset=1108
i32.const 0
i32.const 0
i32.store offset=1112
i32.const 0
i32.const 0
i32.store offset=1116
i32.const 0
i32.const 0
i32.store offset=1120
i32.const 0
i32.const 0
i32.store offset=1124
i32.const 0
i32.const 0
i32.store offset=1128
i32.const 0
i32.const 0
i32.store offset=1132
i32.const 80
i32.const 80
call $__pragma_loopbound
i32.const -80
local.set 1
loop ;; label = @1
local.get 1
i32.const 1104
i32.add
local.tee 2
local.get 2
i32.load8_u
local.get 0
i32.load8_u offset=15
i32.xor
i32.store8
local.get 1
i32.const 1105
i32.add
local.tee 2
local.get 2
i32.load8_u
local.get 0
i32.load8_u offset=15
i32.xor
i32.store8
local.get 1
i32.const 1106
i32.add
local.tee 2
local.get 2
i32.load8_u
local.get 0
i32.load8_u offset=15
i32.xor
i32.store8
local.get 1
i32.const 1107
i32.add
local.tee 2
local.get 2
i32.load8_u
local.get 0
i32.load8_u offset=15
i32.xor
i32.store8
local.get 1
i32.const 4
i32.add
local.tee 1
br_if 0 (;@1;)
end
i32.const 32
i32.const 32
call $__pragma_loopbound
i32.const 0
i32.const 0
i32.load8_u offset=1104
local.get 0
i32.load8_u offset=15
i32.xor
i32.store8 offset=1104
i32.const 0
i32.const 0
i32.load8_u offset=1105
local.get 0
i32.load8_u offset=15
i32.xor
i32.store8 offset=1105
i32.const 0
i32.const 0
i32.load8_u offset=1106
local.get 0
i32.load8_u offset=15
i32.xor
i32.store8 offset=1106
i32.const 0
i32.const 0
i32.load8_u offset=1107
local.get 0
i32.load8_u offset=15
i32.xor
i32.store8 offset=1107
i32.const 0
i32.const 0
i32.load8_u offset=1108
local.get 0
i32.load8_u offset=15
i32.xor
i32.store8 offset=1108
i32.const 0
i32.const 0
i32.load8_u offset=1109
local.get 0
i32.load8_u offset=15
i32.xor
i32.store8 offset=1109
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1110
i32.xor
i32.store8 offset=1110
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1111
i32.xor
i32.store8 offset=1111
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1112
i32.xor
i32.store8 offset=1112
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1113
i32.xor
i32.store8 offset=1113
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1114
i32.xor
i32.store8 offset=1114
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1115
i32.xor
i32.store8 offset=1115
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1116
i32.xor
i32.store8 offset=1116
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1117
i32.xor
i32.store8 offset=1117
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1118
i32.xor
i32.store8 offset=1118
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1119
i32.xor
i32.store8 offset=1119
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1120
i32.xor
i32.store8 offset=1120
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1121
i32.xor
i32.store8 offset=1121
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1122
i32.xor
i32.store8 offset=1122
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1123
i32.xor
i32.store8 offset=1123
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1124
i32.xor
i32.store8 offset=1124
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1125
i32.xor
i32.store8 offset=1125
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1126
i32.xor
i32.store8 offset=1126
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1127
i32.xor
i32.store8 offset=1127
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1128
i32.xor
i32.store8 offset=1128
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1129
i32.xor
i32.store8 offset=1129
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1130
i32.xor
i32.store8 offset=1130
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1131
i32.xor
i32.store8 offset=1131
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1132
i32.xor
i32.store8 offset=1132
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1133
i32.xor
i32.store8 offset=1133
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1134
i32.xor
i32.store8 offset=1134
i32.const 0
local.get 0
i32.load8_u offset=15
i32.const 0
i32.load8_u offset=1135
i32.xor
i32.store8 offset=1135
local.get 0
i32.const 16
i32.add
global.set $__stack_pointer)
(func $iir_main (type 1)
(local f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32)
i32.const 0
f32.load offset=1136
local.set 0
i32.const 4
i32.const 4
call $__pragma_loopbound
i32.const 0
f32.load offset=1024
local.set 1
i32.const 0
f32.load offset=1104
local.set 2
i32.const 0
f32.load offset=1028
local.set 3
i32.const 0
f32.load offset=1108
local.set 4
i32.const 0
f32.load offset=1032
local.set 5
i32.const 0
f32.load offset=1036
local.set 6
i32.const 0
f32.load offset=1104
local.set 7
i32.const 0
f32.load offset=1040
local.set 8
i32.const 0
f32.load offset=1108
local.set 9
i32.const 0
i32.const 0
f32.load offset=1104
f32.store offset=1108
i32.const 0
local.get 0
local.get 1
local.get 2
f32.mul
f32.sub
local.get 3
local.get 4
f32.mul
f32.sub
local.tee 0
f32.store offset=1104
i32.const 0
f32.load offset=1044
local.set 1
i32.const 0
f32.load offset=1112
local.set 2
i32.const 0
f32.load offset=1048
local.set 3
i32.const 0
f32.load offset=1116
local.set 4
i32.const 0
f32.load offset=1052
local.set 10
i32.const 0
f32.load offset=1056
local.set 11
i32.const 0
f32.load offset=1112
local.set 12
i32.const 0
f32.load offset=1060
local.set 13
i32.const 0
f32.load offset=1116
local.set 14
i32.const 0
i32.const 0
f32.load offset=1112
f32.store offset=1116
i32.const 0
local.get 8
local.get 9
f32.mul
local.get 6
local.get 7
f32.mul
local.get 5
local.get 0
f32.mul
f32.add
f32.add
local.get 1
local.get 2
f32.mul
f32.sub
local.get 3
local.get 4
f32.mul
f32.sub
local.tee 0
f32.store offset=1112
i32.const 0
f32.load offset=1064
local.set 1
i32.const 0
f32.load offset=1120
local.set 2
i32.const 0
f32.load offset=1068
local.set 3
i32.const 0
f32.load offset=1124
local.set 4
i32.const 0
f32.load offset=1072
local.set 5
i32.const 0
f32.load offset=1076
local.set 6
i32.const 0
f32.load offset=1120
local.set 7
i32.const 0
f32.load offset=1080
local.set 8
i32.const 0
f32.load offset=1124
local.set 9
i32.const 0
i32.const 0
f32.load offset=1120
f32.store offset=1124
i32.const 0
local.get 13
local.get 14
f32.mul
local.get 11
local.get 12
f32.mul
local.get 10
local.get 0
f32.mul
f32.add
f32.add
local.get 1
local.get 2
f32.mul
f32.sub
local.get 3
local.get 4
f32.mul
f32.sub
local.tee 0
f32.store offset=1120
i32.const 0
f32.load offset=1084
local.set 1
i32.const 0
f32.load offset=1128
local.set 2
i32.const 0
f32.load offset=1088
local.set 3
i32.const 0
f32.load offset=1132
local.set 4
i32.const 0
f32.load offset=1092
drop
i32.const 0
f32.load offset=1096
drop
i32.const 0
f32.load offset=1128
drop
i32.const 0
f32.load offset=1100
drop
i32.const 0
f32.load offset=1132
drop
i32.const 0
i32.const 0
f32.load offset=1128
f32.store offset=1132
i32.const 0
local.get 8
local.get 9
f32.mul
local.get 6
local.get 7
f32.mul
local.get 5
local.get 0
f32.mul
f32.add
f32.add
local.get 1
local.get 2
f32.mul
f32.sub
local.get 3
local.get 4
f32.mul
f32.sub
f32.store offset=1128)
(func $__original_main (type 2) (result i32)
(local f32 i32)
call $iir_init
call $iir_main
i32.const 8
i32.const 8
call $__pragma_loopbound
block ;; label = @1
block ;; label = @2
i32.const 0
f32.load offset=1104
f32.const 0x0p+0 (;=0;)
f32.add
i32.const 0
f32.load offset=1108
f32.add
i32.const 0
f32.load offset=1112
f32.add
i32.const 0
f32.load offset=1116
f32.add
i32.const 0
f32.load offset=1120
f32.add
i32.const 0
f32.load offset=1124
f32.add
i32.const 0
f32.load offset=1128
f32.add
i32.const 0
f32.load offset=1132
f32.add
local.tee 0
f32.abs
f32.const 0x1p+31 (;=2.14748e+09;)
f32.lt
i32.eqz
br_if 0 (;@2;)
local.get 0
i32.trunc_f32_s
local.set 1
br 1 (;@1;)
end
i32.const -2147483648
local.set 1
end
local.get 1
i32.const 400
i32.ne)
(table (;0;) 1 1 funcref)
(memory (;0;) 1)
(global $__stack_pointer (mut i32) (i32.const 5248))
(global (;1;) i32 (i32.const 1140))
(global (;2;) i32 (i32.const 5248))
(export "memory" (memory 0))
(export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs))
(export "entrypoint" (func $iir_main))
(export "main" (func $__original_main))
(export "__data_end" (global 1))
(export "__heap_base" (global 2)))

View File

@ -0,0 +1,160 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 2.0
Name: iir
Author: Juan Martinez Velarde
Function:
The equations of each biquad section filter are:
w(n) = x(n) - ai1*w(n-1) - ai2*w(n-2)
y(n) = b0*w(n) + bi1*w(n-1) + bi2*w(n-2)
Biquads are sequentally positioned. Input sample for biquad i is
xi-1(n). Output sample for biquad i is xi(n).
System input sample is x0(n). System output sample is xN(n) = y(n)
for N biquads.
Each section performs following filtering (biquad i) :
wi(n)
xi-1(n) ---(-)---------->-|->---bi0---(+)-------> xi(n)
A | A
| |1/z| |
| | wi(n-1) |
| v |
|-<--ai1----<-|->---bi1-->-|
| | |
| |1/z| |
| | wi(n-2) |
| v |
|-<--ai2----<--->---bi2-->-|
The values wi(n-1) and wi(n-2) are stored in wi1 and wi2
Source: DSPstone
http://www.ice.rwth-aachen.de/research/tools-projects/entry/detail/dspstone
Original name: iir_N_sections_float
Changes:
24-03-94 creation fixed-point (Martinez Velarde)
16-03-95 adaption floating-point (Harald L. Schraut)
License: may be used, modified, and re-distributed freely
*/
/*
Forward declaration of functions
*/
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
void iir_init(void);
int iir_return(void);
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
iir_main(void);
__attribute__((noinline)) __attribute__((export_name("main"))) int main(void);
/*
Declaration of global variables
*/
volatile float iir_wi[2 * 4];
volatile float iir_coefficients[5 * 4];
float iir_x;
/*
Initialization- and return-value-related functions
*/
void
iir_init(void) {
int f;
unsigned int i;
unsigned char *p;
volatile char bitmask = 0;
__pragma_loopbound(20, 20);
for (f = 0; f < 5 * 4; f++)
iir_coefficients[f] = 7;
__pragma_loopbound(8, 8);
for (f = 0; f < 2 * 4; f++)
iir_wi[f] = 0;
iir_x = (float) 1;
/*
Apply volatile XOR-bitmask to entire input array.
*/
p = (unsigned char *) &iir_coefficients[0];
__pragma_loopbound(80, 80);
for (i = 0; i < sizeof(iir_coefficients); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &iir_wi[0];
__pragma_loopbound(32, 32);
for (i = 0; i < sizeof(iir_wi); ++i, ++p)
*p ^= bitmask;
}
int
iir_return(void) {
float checksum = 0.0;
int f;
__pragma_loopbound(8, 8);
for (f = 0; f < 2 * 4; f++)
checksum += iir_wi[f];
return ((int) checksum);
}
/*
Main functions
*/
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
iir_main(void) {
register float w;
int f;
register volatile float *ptr_coeff, *ptr_wi1, *ptr_wi2;
register float y;
ptr_coeff = &iir_coefficients[0];
ptr_wi1 = &iir_wi[0];
ptr_wi2 = &iir_wi[1];
y = iir_x;
__pragma_loopbound(4, 4);
for (f = 0; f < 4; f++) {
w = y - *ptr_coeff++ * *ptr_wi1;
w -= *ptr_coeff++ * *ptr_wi2;
y = *ptr_coeff++ * w;
y += *ptr_coeff++ * *ptr_wi1;
y += *ptr_coeff++ * *ptr_wi2;
*ptr_wi2++ = *ptr_wi1;
*ptr_wi1++ = w;
ptr_wi2++;
ptr_wi1++;
}
}
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
iir_init();
iir_main();
return (iir_return() - 400 != 0);
}

View File

@ -0,0 +1,168 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 2.0
Name: iir
Author: Juan Martinez Velarde
Function:
The equations of each biquad section filter are:
w(n) = x(n) - ai1*w(n-1) - ai2*w(n-2)
y(n) = b0*w(n) + bi1*w(n-1) + bi2*w(n-2)
Biquads are sequentally positioned. Input sample for biquad i is
xi-1(n). Output sample for biquad i is xi(n).
System input sample is x0(n). System output sample is xN(n) = y(n)
for N biquads.
Each section performs following filtering (biquad i) :
wi(n)
xi-1(n) ---(-)---------->-|->---bi0---(+)-------> xi(n)
A | A
| |1/z| |
| | wi(n-1) |
| v |
|-<--ai1----<-|->---bi1-->-|
| | |
| |1/z| |
| | wi(n-2) |
| v |
|-<--ai2----<--->---bi2-->-|
The values wi(n-1) and wi(n-2) are stored in wi1 and wi2
Source: DSPstone
http://www.ice.rwth-aachen.de/research/tools-projects/entry/detail/dspstone
Original name: iir_N_sections_float
Changes:
24-03-94 creation fixed-point (Martinez Velarde)
16-03-95 adaption floating-point (Harald L. Schraut)
License: may be used, modified, and re-distributed freely
*/
/*
Forward declaration of functions
*/
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
__attribute__((always_inline)) static inline void iir_init(void);
__attribute__((always_inline)) static inline int iir_return(void);
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
iir_main(void);
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void);
/*
Declaration of global variables
*/
volatile float iir_wi[2 * 4];
volatile float iir_coefficients[5 * 4];
float iir_x;
/*
Initialization- and return-value-related functions
*/
__attribute__((always_inline)) static inline void
iir_init(void) {
int f;
unsigned int i;
unsigned char *p;
volatile char bitmask = 0;
__pragma_loopbound(20, 20);
for (f = 0; f < 5 * 4; f++)
iir_coefficients[f] = 7;
__pragma_loopbound(8, 8);
for (f = 0; f < 2 * 4; f++)
iir_wi[f] = 0;
iir_x = (float) 1;
/*
Apply volatile XOR-bitmask to entire input array.
*/
p = (unsigned char *) &iir_coefficients[0];
__pragma_loopbound(80, 80);
for (i = 0; i < sizeof(iir_coefficients); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &iir_wi[0];
__pragma_loopbound(32, 32);
for (i = 0; i < sizeof(iir_wi); ++i, ++p)
*p ^= bitmask;
}
__attribute__((always_inline)) static inline int
iir_return(void) {
float checksum = 0.0;
int f;
__pragma_loopbound(8, 8);
for (f = 0; f < 2 * 4; f++)
checksum += iir_wi[f];
return ((int) checksum);
}
/*
Main functions
*/
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
iir_main(void) {
register float w;
int f;
register volatile float *ptr_coeff, *ptr_wi1, *ptr_wi2;
register float y;
ptr_coeff = &iir_coefficients[0];
ptr_wi1 = &iir_wi[0];
ptr_wi2 = &iir_wi[1];
y = iir_x;
__pragma_loopbound(4, 4);
for (f = 0; f < 4; f++) {
w = y - *ptr_coeff++ * *ptr_wi1;
w -= *ptr_coeff++ * *ptr_wi2;
y = *ptr_coeff++ * w;
y += *ptr_coeff++ * *ptr_wi1;
y += *ptr_coeff++ * *ptr_wi2;
*ptr_wi2++ = *ptr_wi1;
*ptr_wi1++ = w;
ptr_wi2++;
ptr_wi1++;
}
}
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
iir_init();
iir_main();
return (iir_return() - 400 != 0);
}

View File

@ -0,0 +1,163 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 2.0
Name: iir
Author: Juan Martinez Velarde
Function:
The equations of each biquad section filter are:
w(n) = x(n) - ai1*w(n-1) - ai2*w(n-2)
y(n) = b0*w(n) + bi1*w(n-1) + bi2*w(n-2)
Biquads are sequentally positioned. Input sample for biquad i is
xi-1(n). Output sample for biquad i is xi(n).
System input sample is x0(n). System output sample is xN(n) = y(n)
for N biquads.
Each section performs following filtering (biquad i) :
wi(n)
xi-1(n) ---(-)---------->-|->---bi0---(+)-------> xi(n)
A | A
| |1/z| |
| | wi(n-1) |
| v |
|-<--ai1----<-|->---bi1-->-|
| | |
| |1/z| |
| | wi(n-2) |
| v |
|-<--ai2----<--->---bi2-->-|
The values wi(n-1) and wi(n-2) are stored in wi1 and wi2
Source: DSPstone
http://www.ice.rwth-aachen.de/research/tools-projects/entry/detail/dspstone
Original name: iir_N_sections_float
Changes:
24-03-94 creation fixed-point (Martinez Velarde)
16-03-95 adaption floating-point (Harald L. Schraut)
License: may be used, modified, and re-distributed freely
*/
/*
Forward declaration of functions
*/
void iir_init( void );
int iir_return( void );
void iir_main( void );
int main( void );
/*
Declaration of global variables
*/
volatile float iir_wi[ 2 * 4 ];
volatile float iir_coefficients[ 5 * 4 ];
float iir_x;
/*
Initialization- and return-value-related functions
*/
void iir_init( void )
{
int f;
unsigned int i;
unsigned char *p;
volatile char bitmask = 0;
_Pragma( "loopbound min 20 max 20" )
for ( f = 0 ; f < 5 * 4; f++ )
iir_coefficients[ f ] = 7;
_Pragma( "loopbound min 8 max 8" )
for ( f = 0 ; f < 2 * 4; f++ )
iir_wi[ f ] = 0;
iir_x = ( float ) 1;
/*
Apply volatile XOR-bitmask to entire input array.
*/
p = ( unsigned char * ) &iir_coefficients[ 0 ];
_Pragma( "loopbound min 80 max 80" )
for ( i = 0; i < sizeof( iir_coefficients ); ++i, ++p )
*p ^= bitmask;
p = ( unsigned char * ) &iir_wi[ 0 ];
_Pragma( "loopbound min 32 max 32" )
for ( i = 0; i < sizeof( iir_wi ); ++i, ++p )
*p ^= bitmask;
}
int iir_return( void )
{
float checksum = 0.0;
int f;
_Pragma( "loopbound min 8 max 8" )
for ( f = 0 ; f < 2 * 4; f++ )
checksum += iir_wi[ f ];
return ( ( int ) checksum );
}
/*
Main functions
*/
void _Pragma( "entrypoint" ) iir_main( void )
{
register float w;
int f;
register volatile float *ptr_coeff, *ptr_wi1, *ptr_wi2;
register float y;
ptr_coeff = &iir_coefficients[ 0 ];
ptr_wi1 = &iir_wi[ 0 ];
ptr_wi2 = &iir_wi[ 1 ];
y = iir_x ;
_Pragma( "loopbound min 4 max 4" )
for ( f = 0 ; f < 4 ; f++ ) {
w = y - *ptr_coeff++ * *ptr_wi1;
w -= *ptr_coeff++ * *ptr_wi2;
y = *ptr_coeff++ * w;
y += *ptr_coeff++ * *ptr_wi1;
y += *ptr_coeff++ * *ptr_wi2;
*ptr_wi2++ = *ptr_wi1;
*ptr_wi1++ = w;
ptr_wi2++;
ptr_wi1++;
}
}
int main( void )
{
iir_init();
iir_main();
return ( iir_return() - 400 != 0 );
}