<?xml version="1.0"?>
<!--
###################################################
## PCCC Encoder
###################################################
 -->

<block>
  <name>PCCC Encoder</name>
  <key>trellis_pccc_encoder_xx</key>
  <category>[Core]/Trellis Coding</category>
  <import>from gnuradio import trellis</import>
  <make>trellis.pccc_encoder_$(type)(trellis.fsm($o_fsm_args), $o_init_state, trellis.fsm($i_fsm_args), $i_init_state, trellis.interleaver($interleaver_args), $bl)</make>
  <param>
    <name>Type</name>
    <key>type</key>
    <type>enum</type>
    <option>
      <name>Byte->Byte</name>
      <key>bb</key>
      <opt>input:byte</opt>
      <opt>output:byte</opt>
    </option>
    <option>
      <name>Byte->Short</name>
      <key>bs</key>
      <opt>input:byte</opt>
      <opt>output:short</opt>
    </option>
    <option>
      <name>Byte->Int</name>
      <key>bi</key>
      <opt>input:byte</opt>
      <opt>output:int</opt>
    </option>
    <option>
      <name>Short->Short</name>
      <key>ss</key>
      <opt>input:short</opt>
      <opt>output:short</opt>
    </option>
    <option>
      <name>Short->Int</name>
      <key>si</key>
      <opt>input:short</opt>
      <opt>output:int</opt>
    </option>
    <option>
      <name>Int->Int</name>
      <key>ii</key>
      <opt>input:int</opt>
      <opt>output:int</opt>
    </option>
  </param>
  <param>
    <name>FSM 1</name>
    <key>o_fsm_args</key>
    <type>raw</type>
  </param>
  <param>
    <name>Initial State 1</name>
    <key>o_init_state</key>
    <value>0</value>
    <type>int</type>
  </param>
  <param>
    <name>FSM 2</name>
    <key>i_fsm_args</key>
    <type>raw</type>
  </param>
  <param>
    <name>Initial State 2</name>
    <key>i_init_state</key>
    <value>0</value>
    <type>int</type>
  </param>
  <param>
    <name>Interleaver</name>
    <key>interleaver_args</key>
    <type>raw</type>
  </param>
  <param>
    <name>Blocklength</name>
    <key>bl</key>
    <type>int</type>
  </param>
  <check>(isinstance(eval(""" $o_fsm_args """[1:-1], locals(),globals()), str) and open($o_fsm_args).close()) or True</check>
  <check>(isinstance(eval(""" $i_fsm_args """[1:-1], locals(),globals()), str) and open($i_fsm_args).close()) or True </check>
  <sink>
    <name>in</name>
    <type>$type.input</type>
  </sink>
  <source>
    <name>out</name>
    <type>$type.output</type>
  </source>
  <doc>
The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors.
  </doc>
</block>
