--- /dev/null
+# Module: Unified AddOn Module for TRB5sc with internal trg logic and pin-header inputs
+package CtsMod1a;
+
+@ISA = (CtsBaseModule);
+
+use warnings;
+use strict;
+use TrbRegister;
+use Data::Dumper;
+
+sub moduleName {"Trigger Input Multiplexer"}
+
+sub init {
+ my $self = $_[0];
+ my $address = $_[1];
+
+ my $trb = $self->{'_cts'}{'_trb'};
+
+ my $regs = $self->{'_registers'};
+ my $prop = $self->{'_properties'};
+
+ my $cprop = $self->{'_cts'}{'_properties'};
+ my $header = $self->{'_cts'}{'_enum'}{0x1a}->read();
+
+
+# registers
+ for(my $i = 0; $i < $header->{'len'}; $i++) {
+ my $key = "trg_input_mux$i";
+
+ $regs->{$key} = new TrbRegister($address + 1 + $i, $trb, {
+ 'input' => {'lower' => 0, 'len' => 7, 'type' => 'enum', 'enum' =>
+ {
+# 0 => 'trig_rj[3]', 1 => 'trig_rj[4]',
+# 34 => 'int_trg[0]', 35 => 'int_trg[1]'
+ }
+ }
+ }, {
+ 'accessmode' => "rw",
+ 'export' => 1,
+ 'monitor' => '1',
+ 'label' => "Input Multiplexer $i"
+ });
+
+ my $chanStart = 0;
+ for(my $k=0; $k<4; $k++) {
+ $regs->{$key}{'_defs'}{'input'}{'enum'}{$k+$chanStart} = "internal[$k]";
+ }
+
+ $chanStart = 4;
+ for(my $k=0; $k<8; $k++) {
+ $regs->{$key}{'_defs'}{'input'}{'enum'}{$k+$chanStart} = "hdrio[".($k+16)."]";
+ }
+
+ }
+
+
+ for(my $i = 0; $i < $header->{'itc_len'}; $i++) {
+ $self->{'_cts'}->getProperties->{'itc_assignments'}[$i + $header->{'itc_base'}] = "Trigger Multiplexer $i";
+ }
+
+# properties
+ $prop->{"trg_inp_mux_count"} = $header->{'len'};
+ $prop->{"trg_inp_mux_itc_base"} = $header->{'itc_base'};
+}
+
+1;
<field name="TriggerOutputs" start="8" bits="4" format="unsigned" noflag="true">
<description>Number of outputs of the trigger logic</description>
</field>
+ <field name="TriggerMultiplicities" start="12" bits="4" format="unsigned" noflag="true">
+ <description>Number of multiplicity logic blocks</description>
+ </field>
+ <field name="TriggerCoincidences" start="16" bits="8" format="unsigned" noflag="true">
+ <description>Number of coincidence blocks</description>
+ </field>
</register>
<register name="Multiplicity" address="0032" mode="r" >
<description>Coincidence interval is fixed to 4 clock cycles or configurable in TriggerStretchSet</description>