--- /dev/null
+# Module: Unified AddOn Module for TRB3sc with KEL connectors and backplane
+package CtsMod18;
+
+@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'}{0x18}->read();
+
+ print "Trigger Modules 0x12 and 0x18 cannot be instantiated in the same design\n" if exists $self->{'_cts'}{'_enum'}{0x12};
+
+# 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 = 2;
+ for(my $k=0; $k<32; $k++) {
+ $regs->{$key}{'_defs'}{'input'}{'enum'}{$k+$chanStart} = "kel[$k]";
+ }
+
+ my $chanStart = 36;
+ for(my $k=0; $k<9; $k++) {
+ $regs->{$key}{'_defs'}{'input'}{'enum'}{$k*2+$chanStart} = "bkpl[$k][0]";
+ $regs->{$key}{'_defs'}{'input'}{'enum'}{$k*2+1+$chanStart} = "bkpl[$k][1]";
+ }
+
+ }
+
+
+ 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;