##############################################################
# MVLC Trigger I/O  setup via internal VME interface         #
##############################################################

# Note: This file was generated by mvme. Editing existing
# values is allowed and these changes will be used by mvme
# when next parsing the script. Changes to the basic
# structure, like adding new write or read commands, are not
# allowed. These changes will be lost the next time the file
# is modified by mvme.

# The initialization commands for each Trigger I/O unit are
# wrapped in mvlc_stack_begin/end blocks. This is to ensure
# the commands are executed atomically without being
# interleaved by other commands also touching the Trigger I/O
# system, e.g. the routine for readout of the builtin DSO.

# Check for minimum required mvme version
mvme_require_version 1.9.1

# Internal MVLC VME interface address
setbase 0xffff0000

# Level0 #####################################################

# timer0
mvlc_stack_begin
  0x0200 0x0000    # select L0.Unit0
  0x0302      0    # range (0:ns, 1:us, 2:ms, 3:s)
  0x0304      0    # delay [ns]
  0x0306      0    # period [in range units]
mvlc_stack_end

# timer1
mvlc_stack_begin
  0x0200 0x0001    # select L0.Unit1
  0x0302      0    # range (0:ns, 1:us, 2:ms, 3:s)
  0x0304      0    # delay [ns]
  0x0306      0    # period [in range units]
mvlc_stack_end

# timer2
mvlc_stack_begin
  0x0200 0x0002    # select L0.Unit2
  0x0302      0    # range (0:ns, 1:us, 2:ms, 3:s)
  0x0304      0    # delay [ns]
  0x0306      0    # period [in range units]
mvlc_stack_end

# timer3
mvlc_stack_begin
  0x0200 0x0003    # select L0.Unit3
  0x0302      0    # range (0:ns, 1:us, 2:ms, 3:s)
  0x0304      0    # delay [ns]
  0x0306      0    # period [in range units]
mvlc_stack_end

# trigger_resource0
mvlc_stack_begin
  0x0200 0x0004    # select L0.Unit4
  0x0380      0    # type: 0=IRQ, 1=SoftTrigger, 2=SlaveTrigger
  0x0300      0    # irq_index (zero-based: 0: IRQ1, .., 6: IRQ7)
  0x0306      0    # slave_trigger: delay [ns]
  0x0308      0    # slave_trigger: width [ns]
  0x030a      0    # slave_trigger: holdoff [ns]
  0x030c      0    # slave_trigger: invert (start on trailing edge of input)
  0x0382      0    # slave trigger number (0..3)
mvlc_stack_end

# trigger_resource1
mvlc_stack_begin
  0x0200 0x0005    # select L0.Unit5
  0x0380      0    # type: 0=IRQ, 1=SoftTrigger, 2=SlaveTrigger
  0x0300      0    # irq_index (zero-based: 0: IRQ1, .., 6: IRQ7)
  0x0306      0    # slave_trigger: delay [ns]
  0x0308      0    # slave_trigger: width [ns]
  0x030a      0    # slave_trigger: holdoff [ns]
  0x030c      0    # slave_trigger: invert (start on trailing edge of input)
  0x0382      0    # slave trigger number (0..3)
mvlc_stack_end

# trigger_resource2
mvlc_stack_begin
  0x0200 0x0006    # select L0.Unit6
  0x0380      0    # type: 0=IRQ, 1=SoftTrigger, 2=SlaveTrigger
  0x0300      0    # irq_index (zero-based: 0: IRQ1, .., 6: IRQ7)
  0x0306      0    # slave_trigger: delay [ns]
  0x0308      0    # slave_trigger: width [ns]
  0x030a      0    # slave_trigger: holdoff [ns]
  0x030c      0    # slave_trigger: invert (start on trailing edge of input)
  0x0382      0    # slave trigger number (0..3)
mvlc_stack_end

# trigger_resource3
mvlc_stack_begin
  0x0200 0x0007    # select L0.Unit7
  0x0380      0    # type: 0=IRQ, 1=SoftTrigger, 2=SlaveTrigger
  0x0300      0    # irq_index (zero-based: 0: IRQ1, .., 6: IRQ7)
  0x0306      0    # slave_trigger: delay [ns]
  0x0308      0    # slave_trigger: width [ns]
  0x030a      0    # slave_trigger: holdoff [ns]
  0x030c      0    # slave_trigger: invert (start on trailing edge of input)
  0x0382      0    # slave trigger number (0..3)
mvlc_stack_end

# trigger_resource4
mvlc_stack_begin
  0x0200 0x0008    # select L0.Unit8
  0x0380      0    # type: 0=IRQ, 1=SoftTrigger, 2=SlaveTrigger
  0x0300      0    # irq_index (zero-based: 0: IRQ1, .., 6: IRQ7)
  0x0306      0    # slave_trigger: delay [ns]
  0x0308      0    # slave_trigger: width [ns]
  0x030a      0    # slave_trigger: holdoff [ns]
  0x030c      0    # slave_trigger: invert (start on trailing edge of input)
  0x0382      0    # slave trigger number (0..3)
mvlc_stack_end

# trigger_resource5
mvlc_stack_begin
  0x0200 0x0009    # select L0.Unit9
  0x0380      0    # type: 0=IRQ, 1=SoftTrigger, 2=SlaveTrigger
  0x0300      0    # irq_index (zero-based: 0: IRQ1, .., 6: IRQ7)
  0x0306      0    # slave_trigger: delay [ns]
  0x0308      0    # slave_trigger: width [ns]
  0x030a      0    # slave_trigger: holdoff [ns]
  0x030c      0    # slave_trigger: invert (start on trailing edge of input)
  0x0382      0    # slave trigger number (0..3)
mvlc_stack_end

# trigger_resource6
mvlc_stack_begin
  0x0200 0x000a    # select L0.Unit10
  0x0380      0    # type: 0=IRQ, 1=SoftTrigger, 2=SlaveTrigger
  0x0300      0    # irq_index (zero-based: 0: IRQ1, .., 6: IRQ7)
  0x0306      0    # slave_trigger: delay [ns]
  0x0308      0    # slave_trigger: width [ns]
  0x030a      0    # slave_trigger: holdoff [ns]
  0x030c      0    # slave_trigger: invert (start on trailing edge of input)
  0x0382      0    # slave trigger number (0..3)
mvlc_stack_end

# trigger_resource7
mvlc_stack_begin
  0x0200 0x000b    # select L0.Unit11
  0x0380      0    # type: 0=IRQ, 1=SoftTrigger, 2=SlaveTrigger
  0x0300      0    # irq_index (zero-based: 0: IRQ1, .., 6: IRQ7)
  0x0306      0    # slave_trigger: delay [ns]
  0x0308      0    # slave_trigger: width [ns]
  0x030a      0    # slave_trigger: holdoff [ns]
  0x030c      0    # slave_trigger: invert (start on trailing edge of input)
  0x0382      0    # slave trigger number (0..3)
mvlc_stack_end

# stack_busy0
mvlc_stack_begin
  0x0200 0x000c    # select L0.Unit12
  0x0300      0    # stack_index
mvlc_stack_end

# stack_busy1
mvlc_stack_begin
  0x0200 0x000d    # select L0.Unit13
  0x0300      0    # stack_index
mvlc_stack_end

# NIM0
mvlc_stack_begin
  0x0200 0x0010    # select L0.Unit16
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM1
mvlc_stack_begin
  0x0200 0x0011    # select L0.Unit17
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM2
mvlc_stack_begin
  0x0200 0x0012    # select L0.Unit18
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM3
mvlc_stack_begin
  0x0200 0x0013    # select L0.Unit19
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM4
mvlc_stack_begin
  0x0200 0x0014    # select L0.Unit20
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM5
mvlc_stack_begin
  0x0200 0x0015    # select L0.Unit21
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM6
mvlc_stack_begin
  0x0200 0x0016    # select L0.Unit22
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM7
mvlc_stack_begin
  0x0200 0x0017    # select L0.Unit23
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM8
mvlc_stack_begin
  0x0200 0x0018    # select L0.Unit24
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM9
mvlc_stack_begin
  0x0200 0x0019    # select L0.Unit25
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM10
mvlc_stack_begin
  0x0200 0x001a    # select L0.Unit26
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM11
mvlc_stack_begin
  0x0200 0x001b    # select L0.Unit27
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM12
mvlc_stack_begin
  0x0200 0x001c    # select L0.Unit28
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# NIM13
mvlc_stack_begin
  0x0200 0x001d    # select L0.Unit29
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x030a      0    # direction (0:in, 1:out)
  0x0310      0    # output activate
mvlc_stack_end

# IRQ1
mvlc_stack_begin
  0x0200 0x0021    # select L0.Unit33
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
mvlc_stack_end

# IRQ2
mvlc_stack_begin
  0x0200 0x0022    # select L0.Unit34
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
mvlc_stack_end

# IRQ3
mvlc_stack_begin
  0x0200 0x0023    # select L0.Unit35
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
mvlc_stack_end

# IRQ4
mvlc_stack_begin
  0x0200 0x0024    # select L0.Unit36
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
mvlc_stack_end

# IRQ5
mvlc_stack_begin
  0x0200 0x0025    # select L0.Unit37
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
mvlc_stack_end

# IRQ6
mvlc_stack_begin
  0x0200 0x0026    # select L0.Unit38
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
mvlc_stack_end

# Level1 #####################################################

# L1.LUT0
mvlc_stack_begin
  0x0200 0x0100    # select L1.Unit0
  0x0300 0x0000    # cells 0-3
  0x0302 0x0000    # cells 4-7
  0x0304 0x0000    # cells 8-11
  0x0306 0x0000    # cells 12-15
  0x0308 0x0000    # cells 16-19
  0x030a 0x0000    # cells 20-23
  0x030c 0x0000    # cells 24-27
  0x030e 0x0000    # cells 28-31
  0x0310 0x0000    # cells 32-35
  0x0312 0x0000    # cells 36-39
  0x0314 0x0000    # cells 40-43
  0x0316 0x0000    # cells 44-47
  0x0318 0x0000    # cells 48-51
  0x031a 0x0000    # cells 52-55
  0x031c 0x0000    # cells 56-59
  0x031e 0x0000    # cells 60-63
mvlc_stack_end

# L1.LUT1
mvlc_stack_begin
  0x0200 0x0101    # select L1.Unit1
  0x0300 0x0000    # cells 0-3
  0x0302 0x0000    # cells 4-7
  0x0304 0x0000    # cells 8-11
  0x0306 0x0000    # cells 12-15
  0x0308 0x0000    # cells 16-19
  0x030a 0x0000    # cells 20-23
  0x030c 0x0000    # cells 24-27
  0x030e 0x0000    # cells 28-31
  0x0310 0x0000    # cells 32-35
  0x0312 0x0000    # cells 36-39
  0x0314 0x0000    # cells 40-43
  0x0316 0x0000    # cells 44-47
  0x0318 0x0000    # cells 48-51
  0x031a 0x0000    # cells 52-55
  0x031c 0x0000    # cells 56-59
  0x031e 0x0000    # cells 60-63
mvlc_stack_end

# L1.LUT2
mvlc_stack_begin
  0x0200 0x0102    # select L1.Unit2
  0x0300 0x0000    # cells 0-3
  0x0302 0x0000    # cells 4-7
  0x0304 0x0000    # cells 8-11
  0x0306 0x0000    # cells 12-15
  0x0308 0x0000    # cells 16-19
  0x030a 0x0000    # cells 20-23
  0x030c 0x0000    # cells 24-27
  0x030e 0x0000    # cells 28-31
  0x0310 0x0000    # cells 32-35
  0x0312 0x0000    # cells 36-39
  0x0314 0x0000    # cells 40-43
  0x0316 0x0000    # cells 44-47
  0x0318 0x0000    # cells 48-51
  0x031a 0x0000    # cells 52-55
  0x031c 0x0000    # cells 56-59
  0x031e 0x0000    # cells 60-63
  0x0380      0    # connect input0 to 'NIM8'
  0x0382      0    # connect input1 to 'NIM9'
  0x0384      0    # connect input2 to 'NIM10'
mvlc_stack_end

# L1.LUT3
mvlc_stack_begin
  0x0200 0x0103    # select L1.Unit3
  0x0300 0x0000    # cells 0-3
  0x0302 0x0000    # cells 4-7
  0x0304 0x0000    # cells 8-11
  0x0306 0x0000    # cells 12-15
  0x0308 0x0000    # cells 16-19
  0x030a 0x0000    # cells 20-23
  0x030c 0x0000    # cells 24-27
  0x030e 0x0000    # cells 28-31
  0x0310 0x0000    # cells 32-35
  0x0312 0x0000    # cells 36-39
  0x0314 0x0000    # cells 40-43
  0x0316 0x0000    # cells 44-47
  0x0318 0x0000    # cells 48-51
  0x031a 0x0000    # cells 52-55
  0x031c 0x0000    # cells 56-59
  0x031e 0x0000    # cells 60-63
mvlc_stack_end

# L1.LUT4
mvlc_stack_begin
  0x0200 0x0104    # select L1.Unit4
  0x0300 0x0000    # cells 0-3
  0x0302 0x0000    # cells 4-7
  0x0304 0x0000    # cells 8-11
  0x0306 0x0000    # cells 12-15
  0x0308 0x0000    # cells 16-19
  0x030a 0x0000    # cells 20-23
  0x030c 0x0000    # cells 24-27
  0x030e 0x0000    # cells 28-31
  0x0310 0x0000    # cells 32-35
  0x0312 0x0000    # cells 36-39
  0x0314 0x0000    # cells 40-43
  0x0316 0x0000    # cells 44-47
  0x0318 0x0000    # cells 48-51
  0x031a 0x0000    # cells 52-55
  0x031c 0x0000    # cells 56-59
  0x031e 0x0000    # cells 60-63
mvlc_stack_end

# L1.LUT5
mvlc_stack_begin
  0x0200 0x0105    # select L1.Unit5
  0x0300 0x0000    # cells 0-3
  0x0302 0x0000    # cells 4-7
  0x0304 0x0000    # cells 8-11
  0x0306 0x0000    # cells 12-15
  0x0308 0x0000    # cells 16-19
  0x030a 0x0000    # cells 20-23
  0x030c 0x0000    # cells 24-27
  0x030e 0x0000    # cells 28-31
  0x0310 0x0000    # cells 32-35
  0x0312 0x0000    # cells 36-39
  0x0314 0x0000    # cells 40-43
  0x0316 0x0000    # cells 44-47
  0x0318 0x0000    # cells 48-51
  0x031a 0x0000    # cells 52-55
  0x031c 0x0000    # cells 56-59
  0x031e 0x0000    # cells 60-63
mvlc_stack_end

# L1.LUT6
mvlc_stack_begin
  0x0200 0x0106    # select L1.Unit6
  0x0300 0x0000    # cells 0-3
  0x0302 0x0000    # cells 4-7
  0x0304 0x0000    # cells 8-11
  0x0306 0x0000    # cells 12-15
  0x0308 0x0000    # cells 16-19
  0x030a 0x0000    # cells 20-23
  0x030c 0x0000    # cells 24-27
  0x030e 0x0000    # cells 28-31
  0x0310 0x0000    # cells 32-35
  0x0312 0x0000    # cells 36-39
  0x0314 0x0000    # cells 40-43
  0x0316 0x0000    # cells 44-47
  0x0318 0x0000    # cells 48-51
  0x031a 0x0000    # cells 52-55
  0x031c 0x0000    # cells 56-59
  0x031e 0x0000    # cells 60-63
mvlc_stack_end

# Level2 #####################################################

# L2.LUT0
mvlc_stack_begin
  0x0200 0x0200    # select L2.Unit0
  0x0300 0x0000    # cells 0-3
  0x0302 0x0000    # cells 4-7
  0x0304 0x0000    # cells 8-11
  0x0306 0x0000    # cells 12-15
  0x0308 0x0000    # cells 16-19
  0x030a 0x0000    # cells 20-23
  0x030c 0x0000    # cells 24-27
  0x030e 0x0000    # cells 28-31
  0x0310 0x0000    # cells 32-35
  0x0312 0x0000    # cells 36-39
  0x0314 0x0000    # cells 40-43
  0x0316 0x0000    # cells 44-47
  0x0318 0x0000    # cells 48-51
  0x031a 0x0000    # cells 52-55
  0x031c 0x0000    # cells 56-59
  0x031e 0x0000    # cells 60-63
  0x0320 0b0000    # strobed_outputs
  0x0380      0    # connect input0 to 'timer0'
  0x0382      0    # connect input1 to 'timer0'
  0x0384      0    # connect input2 to 'timer0'
  # L2.LUT0 strobe gate generator
  0x0332      0    # delay [ns]
  0x0334      8    # width [ns]
  0x0336      0    # holdoff [ns]
  0x0338      0    # invert (start on trailing edge of input)
  0x0386      0    # connect strobe_input to 'timer0'
mvlc_stack_end

# L2.LUT1
mvlc_stack_begin
  0x0200 0x0201    # select L2.Unit1
  0x0300 0x0000    # cells 0-3
  0x0302 0x0000    # cells 4-7
  0x0304 0x0000    # cells 8-11
  0x0306 0x0000    # cells 12-15
  0x0308 0x0000    # cells 16-19
  0x030a 0x0000    # cells 20-23
  0x030c 0x0000    # cells 24-27
  0x030e 0x0000    # cells 28-31
  0x0310 0x0000    # cells 32-35
  0x0312 0x0000    # cells 36-39
  0x0314 0x0000    # cells 40-43
  0x0316 0x0000    # cells 44-47
  0x0318 0x0000    # cells 48-51
  0x031a 0x0000    # cells 52-55
  0x031c 0x0000    # cells 56-59
  0x031e 0x0000    # cells 60-63
  0x0320 0b0000    # strobed_outputs
  0x0380      0    # connect input0 to 'timer0'
  0x0382      0    # connect input1 to 'timer0'
  0x0384      0    # connect input2 to 'timer0'
  # L2.LUT1 strobe gate generator
  0x0332      0    # delay [ns]
  0x0334      8    # width [ns]
  0x0336      0    # holdoff [ns]
  0x0338      0    # invert (start on trailing edge of input)
  0x0386      0    # connect strobe_input to 'timer0'
mvlc_stack_end

# L2.LUT2
mvlc_stack_begin
  0x0200 0x0202    # select L2.Unit2
  0x0300 0x0000    # cells 0-3
  0x0302 0x0000    # cells 4-7
  0x0304 0x0000    # cells 8-11
  0x0306 0x0000    # cells 12-15
  0x0308 0x0000    # cells 16-19
  0x030a 0x0000    # cells 20-23
  0x030c 0x0000    # cells 24-27
  0x030e 0x0000    # cells 28-31
  0x0310 0x0000    # cells 32-35
  0x0312 0x0000    # cells 36-39
  0x0314 0x0000    # cells 40-43
  0x0316 0x0000    # cells 44-47
  0x0318 0x0000    # cells 48-51
  0x031a 0x0000    # cells 52-55
  0x031c 0x0000    # cells 56-59
  0x031e 0x0000    # cells 60-63
  0x0320 0b0000    # strobed_outputs
  0x0380      0    # connect input0 to 'timer0'
  0x0382      0    # connect input1 to 'timer0'
  0x0384      0    # connect input2 to 'timer0'
  # L2.LUT2 strobe gate generator
  0x0332      0    # delay [ns]
  0x0334      8    # width [ns]
  0x0336      0    # holdoff [ns]
  0x0338      0    # invert (start on trailing edge of input)
  0x0386      0    # connect strobe_input to 'timer0'
mvlc_stack_end

# Level3 #####################################################

# StackStart0
mvlc_stack_begin
  0x0200 0x0300    # select L3.Unit0
  0x0300      0    # activate
  0x0302      0    # stack index
  0x0304      0    # delay [ns]
  0x0380      0    # connect input0 to 'timer0'
mvlc_stack_end

# StackStart1
mvlc_stack_begin
  0x0200 0x0301    # select L3.Unit1
  0x0300      0    # activate
  0x0302      0    # stack index
  0x0304      0    # delay [ns]
  0x0380      0    # connect input0 to 'timer0'
mvlc_stack_end

# StackStart2
mvlc_stack_begin
  0x0200 0x0302    # select L3.Unit2
  0x0300      0    # activate
  0x0302      0    # stack index
  0x0304      0    # delay [ns]
  0x0380      0    # connect input0 to 'timer0'
mvlc_stack_end

# StackStart3
mvlc_stack_begin
  0x0200 0x0303    # select L3.Unit3
  0x0300      0    # activate
  0x0302      0    # stack index
  0x0304      0    # delay [ns]
  0x0380      0    # connect input0 to 'timer0'
mvlc_stack_end

# MasterTrigger0
mvlc_stack_begin
  0x0200 0x0304    # select L3.Unit4
  0x0300      0    # activate
  0x0380      0    # connect input0 to 'timer0'
mvlc_stack_end

# MasterTrigger1
mvlc_stack_begin
  0x0200 0x0305    # select L3.Unit5
  0x0300      0    # activate
  0x0380      0    # connect input0 to 'timer0'
mvlc_stack_end

# MasterTrigger2
mvlc_stack_begin
  0x0200 0x0306    # select L3.Unit6
  0x0300      0    # activate
  0x0380      0    # connect input0 to 'timer0'
mvlc_stack_end

# MasterTrigger3
mvlc_stack_begin
  0x0200 0x0307    # select L3.Unit7
  0x0300      0    # activate
  0x0380      0    # connect input0 to 'timer0'
mvlc_stack_end

# Counter0+Timestamper
mvlc_stack_begin
  0x0200 0x0308    # select L3.Unit8
  0x030e      0    # clear on latch
  0x0380      0    # connect input0 to 'timer0'
  0x0382     21    # connect input1 to '<not connected>'
mvlc_stack_end

# Counter1
mvlc_stack_begin
  0x0200 0x0309    # select L3.Unit9
  0x030e      0    # clear on latch
  0x0380      0    # connect input0 to 'timer0'
  0x0382     21    # connect input1 to '<not connected>'
mvlc_stack_end

# Counter2
mvlc_stack_begin
  0x0200 0x030a    # select L3.Unit10
  0x030e      0    # clear on latch
  0x0380      0    # connect input0 to 'timer0'
  0x0382     21    # connect input1 to '<not connected>'
mvlc_stack_end

# Counter3
mvlc_stack_begin
  0x0200 0x030b    # select L3.Unit11
  0x030e      0    # clear on latch
  0x0380      0    # connect input0 to 'timer0'
  0x0382     21    # connect input1 to '<not connected>'
mvlc_stack_end

# Counter4
mvlc_stack_begin
  0x0200 0x030c    # select L3.Unit12
  0x030e      0    # clear on latch
  0x0380      0    # connect input0 to 'timer0'
  0x0382     21    # connect input1 to '<not connected>'
mvlc_stack_end

# Counter5
mvlc_stack_begin
  0x0200 0x030d    # select L3.Unit13
  0x030e      0    # clear on latch
  0x0380      0    # connect input0 to 'timer0'
  0x0382     21    # connect input1 to '<not connected>'
mvlc_stack_end

# Counter6
mvlc_stack_begin
  0x0200 0x030e    # select L3.Unit14
  0x030e      0    # clear on latch
  0x0380      0    # connect input0 to 'timer0'
  0x0382     21    # connect input1 to '<not connected>'
mvlc_stack_end

# Counter7
mvlc_stack_begin
  0x0200 0x030f    # select L3.Unit15
  0x030e      0    # clear on latch
  0x0380      0    # connect input0 to 'timer0'
  0x0382     21    # connect input1 to '<not connected>'
mvlc_stack_end

# NIM unit connections (Note: NIM setup is done in the Level0 section)

# NIM0
mvlc_stack_begin
  0x0200 0x0310    # select L3.Unit16
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM1
mvlc_stack_begin
  0x0200 0x0311    # select L3.Unit17
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM2
mvlc_stack_begin
  0x0200 0x0312    # select L3.Unit18
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM3
mvlc_stack_begin
  0x0200 0x0313    # select L3.Unit19
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM4
mvlc_stack_begin
  0x0200 0x0314    # select L3.Unit20
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM5
mvlc_stack_begin
  0x0200 0x0315    # select L3.Unit21
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM6
mvlc_stack_begin
  0x0200 0x0316    # select L3.Unit22
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM7
mvlc_stack_begin
  0x0200 0x0317    # select L3.Unit23
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM8
mvlc_stack_begin
  0x0200 0x0318    # select L3.Unit24
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM9
mvlc_stack_begin
  0x0200 0x0319    # select L3.Unit25
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM10
mvlc_stack_begin
  0x0200 0x031a    # select L3.Unit26
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM11
mvlc_stack_begin
  0x0200 0x031b    # select L3.Unit27
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM12
mvlc_stack_begin
  0x0200 0x031c    # select L3.Unit28
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# NIM13
mvlc_stack_begin
  0x0200 0x031d    # select L3.Unit29
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# LVDS0
mvlc_stack_begin
  0x0200 0x031e    # select L3.Unit30
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x0310      0    # output activate
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# LVDS1
mvlc_stack_begin
  0x0200 0x031f    # select L3.Unit31
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x0310      0    # output activate
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

# LVDS2
mvlc_stack_begin
  0x0200 0x0320    # select L3.Unit32
  0x0300      0    # delay [ns]
  0x0302      0    # width [ns]
  0x0304      0    # holdoff [ns]
  0x0306      0    # invert (start on trailing edge of input)
  0x0310      0    # output activate
  0x0380      0    # connect input0 to 'L2.LUT0.OUT0'
mvlc_stack_end

##############################################################
# MVLC Trigger I/O specific meta information                 #
##############################################################
meta_block_begin mvlc_trigger_io
names:
  level0:
    0: timer0
    1: timer1
    2: timer2
    3: timer3
    4: trigger_resource0
    5: trigger_resource1
    6: trigger_resource2
    7: trigger_resource3
    8: trigger_resource4
    9: trigger_resource5
    10: trigger_resource6
    11: trigger_resource7
    12: stack_busy0
    13: stack_busy1
    14: sysclk
    15: daq_start
    16: NIM0
    17: NIM1
    18: NIM2
    19: NIM3
    20: NIM4
    21: NIM5
    22: NIM6
    23: NIM7
    24: NIM8
    25: NIM9
    26: NIM10
    27: NIM11
    28: NIM12
    29: NIM13
    30: <unused>
    31: <unused>
    32: <unused>
    33: IRQ1
    34: IRQ2
    35: IRQ3
    36: IRQ4
    37: IRQ5
    38: IRQ6
  level1:
    0:
      0: L1.LUT0.OUT0
      1: L1.LUT0.OUT1
      2: L1.LUT0.OUT2
    1:
      0: L1.LUT1.OUT0
      1: L1.LUT1.OUT1
      2: L1.LUT1.OUT2
    2:
      0: L1.LUT2.OUT0
      1: L1.LUT2.OUT1
      2: L1.LUT2.OUT2
    3:
      0: L1.LUT3.OUT0
      1: L1.LUT3.OUT1
      2: L1.LUT3.OUT2
    4:
      0: L1.LUT4.OUT0
      1: L1.LUT4.OUT1
      2: L1.LUT4.OUT2
    5:
      0: L1.LUT5.OUT0
      1: L1.LUT5.OUT1
      2: L1.LUT5.OUT2
    6:
      0: L1.LUT6.OUT0
      1: L1.LUT6.OUT1
      2: L1.LUT6.OUT2
  level2:
    0:
      0: L2.LUT0.OUT0
      1: L2.LUT0.OUT1
      2: L2.LUT0.OUT2
    1:
      0: L2.LUT1.OUT0
      1: L2.LUT1.OUT1
      2: L2.LUT1.OUT2
    2:
      0: L2.LUT2.OUT0
      1: L2.LUT2.OUT1
      2: L2.LUT2.OUT2
  level3:
    0: StackStart0
    1: StackStart1
    2: StackStart2
    3: StackStart3
    4: MasterTrigger0
    5: MasterTrigger1
    6: MasterTrigger2
    7: MasterTrigger3
    8: Counter0+Timestamper
    9: Counter1
    10: Counter2
    11: Counter3
    12: Counter4
    13: Counter5
    14: Counter6
    15: Counter7
    30: LVDS0
    31: LVDS1
    32: LVDS2
    33: <not connected>
settings:
  level0:
    0:
      soft_activate: false
    1:
      soft_activate: false
    2:
      soft_activate: false
    3:
      soft_activate: false
  level3:
    8:
      soft_activate: false
    9:
      soft_activate: false
    10:
      soft_activate: false
    11:
      soft_activate: false
    12:
      soft_activate: false
    13:
      soft_activate: false
    14:
      soft_activate: false
    15:
      soft_activate: false
meta_block_end
