id: trellis_pccc_decoder_combined_xx
label: PCCC Decoder Combo
category: '[Core]/Trellis Coding'

parameters:
-   id: type
    label: Input Type
    dtype: enum
    options: [c, f]
    option_labels: [Complex, Float]
    option_attributes:
        io: [complex, float]
        table: [complex_vector, real_vector]
    hide: part
-   id: out_type
    label: Output Type
    dtype: enum
    options: [i, s, b]
    option_labels: [Int, Short, Byte]
    option_attributes:
        io: [int, short, byte]
    hide: part
-   id: o_fsm_args
    label: FSM 1
    dtype: raw
-   id: o_init_state
    label: Initial State 1
    dtype: int
    default: '0'
-   id: o_final_state
    label: Final State 1
    dtype: int
    default: '-1'
-   id: i_fsm_args
    label: FSM 2
    dtype: raw
-   id: i_init_state
    label: Initial State 2
    dtype: int
    default: '0'
-   id: i_final_state
    label: Final State 2
    dtype: int
    default: '-1'
-   id: interleaver
    label: Interleaver
    dtype: raw
-   id: block_size
    label: Block Size
    dtype: int
-   id: iterations
    label: Iterations
    dtype: int
    default: '10'
-   id: dim
    label: Dimensionality
    dtype: int
-   id: table
    label: Constellation
    dtype: ${ type.table }
-   id: metric_type
    label: Metric Type
    dtype: enum
    options: [digital.TRELLIS_EUCLIDEAN, digital.TRELLIS_HARD_SYMBOL, digital.TRELLIS_HARD_BIT]
    option_labels: [Euclidean, Hard Symbol, Hard Bit]
-   id: siso_type
    label: SISO Type
    dtype: enum
    options: [trellis.TRELLIS_MIN_SUM, trellis.TRELLIS_SUM_PRODUCT]
    option_labels: [Min Sum, Sum Product]
-   id: scaling
    label: Scaling
    dtype: real
    default: '1.0'

inputs:
-   domain: stream
    dtype: ${ type.io }

outputs:
-   domain: stream
    dtype: ${ out_type.io }

asserts:
- ${ (isinstance(eval(""" o_fsm_args """[1:-1], locals(),globals()), str) and open(o_fsm_args).close()) or True }
- ${ (isinstance(eval(""" i_fsm_args """[1:-1], locals(),globals()), str) and open(i_fsm_args).close()) or True }

templates:
    imports: from gnuradio import trellis, digital
    make: "trellis.pccc_decoder_combined_${type}${out_type}(\n    trellis.fsm(${o_fsm_args}),\
        \ ${o_init_state}, ${o_final_state},\n    trellis.fsm(${i_fsm_args}), ${i_init_state},\
        \ ${i_final_state},\n    trellis.interleaver(${interleaver}),\n    ${block_size},\n\
        \    ${iterations},\n    ${siso_type},\n    ${dim}, ${table}, ${metric_type},\n\
        \    ${scaling})\n  "
    callbacks:
    - set_scaling(${scaling})

documentation: |-
    PCCC turbo Decoder combined with metric calculation.
    The fsm arguments are passed directly to the trellis.fsm() constructor.

file_format: 1
