aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/convert/gen_convert_general.py
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/convert/gen_convert_general.py')
-rw-r--r--host/lib/convert/gen_convert_general.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/host/lib/convert/gen_convert_general.py b/host/lib/convert/gen_convert_general.py
index 52b4212b4..b8d64aa4b 100644
--- a/host/lib/convert/gen_convert_general.py
+++ b/host/lib/convert/gen_convert_general.py
@@ -33,8 +33,6 @@ DECLARE_CONVERTER(item32, 1, sc16_item32_$(end), 1, PRIORITY_GENERAL){
const item32_t *input = reinterpret_cast<const item32_t *>(inputs[0]);
item32_t *output = reinterpret_cast<item32_t *>(outputs[0]);
- if (scale_factor == 0){} //avoids unused warning
-
for (size_t i = 0; i < nsamps; i++){
output[i] = $(to_wire)(input[i]);
}
@@ -44,15 +42,13 @@ DECLARE_CONVERTER(sc16_item32_$(end), 1, item32, 1, PRIORITY_GENERAL){
const item32_t *input = reinterpret_cast<const item32_t *>(inputs[0]);
item32_t *output = reinterpret_cast<item32_t *>(outputs[0]);
- if (scale_factor == 0){} //avoids unused warning
-
for (size_t i = 0; i < nsamps; i++){
output[i] = $(to_host)(input[i]);
}
}
"""
-TMPL_CONV_GEN2_COMPLEX = """
+TMPL_CONV_GEN2_SC16 = """
DECLARE_CONVERTER($(cpu_type), 1, sc16_item32_$(end), 1, PRIORITY_GENERAL){
const $(cpu_type)_t *input = reinterpret_cast<const $(cpu_type)_t *>(inputs[0]);
item32_t *output = reinterpret_cast<item32_t *>(outputs[0]);
@@ -70,7 +66,9 @@ DECLARE_CONVERTER(sc16_item32_$(end), 1, $(cpu_type), 1, PRIORITY_GENERAL){
output[i] = item32_sc16_to_$(cpu_type)($(to_host)(input[i]), scale_factor);
}
}
+"""
+TMPL_CONV_GEN2_SC8 = """
DECLARE_CONVERTER(sc8_item32_$(end), 1, $(cpu_type), 1, PRIORITY_GENERAL){
const item32_t *input = reinterpret_cast<const item32_t *>(size_t(inputs[0]) & ~0x3);
$(cpu_type)_t *output = reinterpret_cast<$(cpu_type)_t *>(outputs[0]);
@@ -103,8 +101,6 @@ DECLARE_CONVERTER($(cpu_type), $(width), sc16_item16_usrp1, 1, PRIORITY_GENERAL)
#end for
boost::uint16_t *output = reinterpret_cast<boost::uint16_t *>(outputs[0]);
- if (scale_factor == 0){} //avoids unused warning
-
for (size_t i = 0, j = 0; i < nsamps; i++){
#for $w in range($width)
output[j++] = $(to_wire)(boost::int16_t(input$(w)[i].real()$(do_scale)));
@@ -119,8 +115,6 @@ DECLARE_CONVERTER(sc16_item16_usrp1, 1, $(cpu_type), $(width), PRIORITY_GENERAL)
$(cpu_type)_t *output$(w) = reinterpret_cast<$(cpu_type)_t *>(outputs[$(w)]);
#end for
- if (scale_factor == 0){} //avoids unused warning
-
for (size_t i = 0, j = 0; i < nsamps; i++){
#for $w in range($width)
output$(w)[i] = $(cpu_type)_t(
@@ -138,8 +132,6 @@ DECLARE_CONVERTER(sc8_item16_usrp1, 1, $(cpu_type), $(width), PRIORITY_GENERAL){
$(cpu_type)_t *output$(w) = reinterpret_cast<$(cpu_type)_t *>(outputs[$(w)]);
#end for
- if (scale_factor == 0){} //avoids unused warning
-
for (size_t i = 0, j = 0; i < nsamps; i++){
#for $w in range($width)
{
@@ -170,7 +162,12 @@ if __name__ == '__main__':
):
for cpu_type in 'fc64', 'fc32', 'sc16':
output += parse_tmpl(
- TMPL_CONV_GEN2_COMPLEX,
+ TMPL_CONV_GEN2_SC16,
+ end=end, to_host=to_host, to_wire=to_wire, cpu_type=cpu_type
+ )
+ for cpu_type in 'fc64', 'fc32', 'sc16', 'sc8':
+ output += parse_tmpl(
+ TMPL_CONV_GEN2_SC8,
end=end, to_host=to_host, to_wire=to_wire, cpu_type=cpu_type
)
output += parse_tmpl(