]> jspc29.x-matter.uni-frankfurt.de Git - hades_mdc_settings.git/commitdiff
add board lists to be filled during installation.
authorJan Michel <michel@physik.uni-frankfurt.de>
Wed, 12 Oct 2022 09:52:32 +0000 (11:52 +0200)
committerJan Michel <michel@physik.uni-frankfurt.de>
Wed, 12 Oct 2022 09:52:32 +0000 (11:52 +0200)
add script to generate addresses.db

installation/addresses_mdc.db [deleted file]
installation/mbo_positions.db [new file with mode: 0644]
installation/powerdistributor_positions.db [moved from installation/addresses_powerdistributor.db with 100% similarity]
scripts/README.md
scripts/generate_address_list.pl [new file with mode: 0755]

diff --git a/installation/addresses_mdc.db b/installation/addresses_mdc.db
deleted file mode 100644 (file)
index 2535ea0..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#Address  #   S/N   #   FPGA  #
-###################################################
-#Plane 0, Sector 0
-
- 0x8e00        0         5
- 0x1000        0         0
- 0x1001        0         1
-
- 0x8e01        0         5
- 0x1010        0         0
- 0x1011        0         1
-
- 0x8e02        0         5
- 0x1020        0         0
- 0x1021        0         1
- 0x1022        0         2
-
-
-
-
-
-
-
- OEP FPGA:
-
-    1 digit: 8 (as for all hubs)
-    2 digit: e/f (inner/outer MDC)
-    3 digit: 0..b (chamber number, 0..5 for MDC1/3 6..B for MDC2/4)
-    4 digit: 0..f (MBO number)
-
-TDC FPGA:
-
-    1 digit: 1/2 (inner/outer MDC)
-    2 digit: 0..b (chamber number, 0..5 for MDC1/3 6..B for MDC2/4)
-    3 digit: 0..f (MBO number)
-    4 digit: 0..2 (FPGA number)
-
-Hub FPGA:
-
-    1 digit: 8 (as for all hubs)
-    2 digit: 5
-    3 digit: 0..b (crate number, 0..5 inner MDC, 6..b outer MDC sectors)
-    4 digit FPGA number in crate (0:master & Subevent ID)
diff --git a/installation/mbo_positions.db b/installation/mbo_positions.db
new file mode 100644 (file)
index 0000000..188e16f
--- /dev/null
@@ -0,0 +1,403 @@
+#Plane   Sector   Board    Long     Serial
+##########################################
+0        0        0        0        0
+0        0        1        1        0
+0        0        2        1        0
+0        0        3        0        0
+0        0        4        0        0
+0        0        5        0        0
+0        0        6        1        0
+0        0        7        1        0
+0        0        8        0        0
+0        0        9        0        0
+0        0        10       1        0
+0        0        11       0        0
+0        0        12       1        0
+0        0        13       0        0
+
+0        1        0        0        0
+0        1        1        1        0
+0        1        2        1        0
+0        1        3        0        0
+0        1        4        0        0
+0        1        5        0        0
+0        1        6        1        0
+0        1        7        1        0
+0        1        8        0        0
+0        1        9        0        0
+0        1        10       1        0
+0        1        11       0        0
+0        1        12       1        0
+0        1        13       0        0
+
+0        2        0        0        0
+0        2        1        1        0
+0        2        2        1        0
+0        2        3        0        0
+0        2        4        0        0
+0        2        5        0        0
+0        2        6        1        0
+0        2        7        1        0
+0        2        8        0        0
+0        2        9        0        0
+0        2        10       1        0
+0        2        11       0        0
+0        2        12       1        0
+0        2        13       0        0
+
+0        3        0        0        0
+0        3        1        1        0
+0        3        2        1        0
+0        3        3        0        0
+0        3        4        0        0
+0        3        5        0        0
+0        3        6        1        0
+0        3        7        1        0
+0        3        8        0        0
+0        3        9        0        0
+0        3        10       1        0
+0        3        11       0        0
+0        3        12       1        0
+0        3        13       0        0
+
+0        4        0        0        0
+0        4        1        1        0
+0        4        2        1        0
+0        4        3        0        0
+0        4        4        0        0
+0        4        5        0        0
+0        4        6        1        0
+0        4        7        1        0
+0        4        8        0        0
+0        4        9        0        0
+0        4        10       1        0
+0        4        11       0        0
+0        4        12       1        0
+0        4        13       0        0
+
+0        5        0        0        0
+0        5        1        1        0
+0        5        2        1        0
+0        5        3        0        0
+0        5        4        0        0
+0        5        5        0        0
+0        5        6        1        0
+0        5        7        1        0
+0        5        8        0        0
+0        5        9        0        0
+0        5        10       1        0
+0        5        11       0        0
+0        5        12       1        0
+0        5        13       0        0
+
+##########################################
+
+1        0        0        0        0
+1        0        1        0        0
+1        0        2        0        0
+1        0        3        0        0
+1        0        4        0        0
+1        0        5        0        0
+1        0        6        0        0
+1        0        7        0        0
+1        0        8        0        0
+1        0        9        0        0
+1        0        10       0        0
+1        0        11       0        0
+1        0        12       0        0
+1        0        13       0        0
+1        0        14       1        0
+1        0        15       1        0
+
+1        1        0        0        0
+1        1        1        0        0
+1        1        2        0        0
+1        1        3        0        0
+1        1        4        0        0
+1        1        5        0        0
+1        1        6        0        0
+1        1        7        0        0
+1        1        8        0        0
+1        1        9        0        0
+1        1        10       0        0
+1        1        11       0        0
+1        1        12       0        0
+1        1        13       0        0
+1        1        14       1        0
+1        1        15       1        0
+
+1        2        0        0        0
+1        2        1        0        0
+1        2        2        0        0
+1        2        3        0        0
+1        2        4        0        0
+1        2        5        0        0
+1        2        6        0        0
+1        2        7        0        0
+1        2        8        0        0
+1        2        9        0        0
+1        2        10       0        0
+1        2        11       0        0
+1        2        12       0        0
+1        2        13       0        0
+1        2        14       1        0
+1        2        15       1        0
+
+1        3        0        0        0
+1        3        1        0        0
+1        3        2        0        0
+1        3        3        0        0
+1        3        4        0        0
+1        3        5        0        0
+1        3        6        0        0
+1        3        7        0        0
+1        3        8        0        0
+1        3        9        0        0
+1        3        10       0        0
+1        3        11       0        0
+1        3        12       0        0
+1        3        13       0        0
+1        3        14       1        0
+1        3        15       1        0
+
+1        4        0        0        0
+1        4        1        0        0
+1        4        2        0        0
+1        4        3        0        0
+1        4        4        0        0
+1        4        5        0        0
+1        4        6        0        0
+1        4        7        0        0
+1        4        8        0        0
+1        4        9        0        0
+1        4        10       0        0
+1        4        11       0        0
+1        4        12       0        0
+1        4        13       0        0
+1        4        14       1        0
+1        4        15       1        0
+
+1        5        0        0        0
+1        5        1        0        0
+1        5        2        0        0
+1        5        3        0        0
+1        5        4        0        0
+1        5        5        0        0
+1        5        6        0        0
+1        5        7        0        0
+1        5        8        0        0
+1        5        9        0        0
+1        5        10       0        0
+1        5        11       0        0
+1        5        12       0        0
+1        5        13       0        0
+1        5        14       1        0
+1        5        15       1        0
+
+##########################################                                
+
+2        0        0        1        0
+2        0        1        0        0
+2        0        2        0        0
+2        0        3        0        0
+2        0        4        0        0
+2        0        5        1        0
+2        0        6        1        0
+2        0        7        0        0
+2        0        8        0        0
+2        0        9        0        0
+2        0        10       0        0
+2        0        11       1        0
+2        0        12       0        0
+2        0        13       1        0
+2        0        14       1        0
+2        0        15       0        0
+
+2        1        0        1        0
+2        1        1        0        0
+2        1        2        0        0
+2        1        3        0        0
+2        1        4        0        0
+2        1        5        1        0
+2        1        6        1        0
+2        1        7        0        0
+2        1        8        0        0
+2        1        9        0        0
+2        1        10       0        0
+2        1        11       1        0
+2        1        12       0        0
+2        1        13       1        0
+2        1        14       1        0
+2        1        15       0        0
+
+2        2        0        1        0
+2        2        1        0        0
+2        2        2        0        0
+2        2        3        0        0
+2        2        4        0        0
+2        2        5        1        0
+2        2        6        1        0
+2        2        7        0        0
+2        2        8        0        0
+2        2        9        0        0
+2        2        10       0        0
+2        2        11       1        0
+2        2        12       0        0
+2        2        13       1        0
+2        2        14       1        0
+2        2        15       0        0
+
+2        3        0        1        0
+2        3        1        0        0
+2        3        2        0        0
+2        3        3        0        0
+2        3        4        0        0
+2        3        5        1        0
+2        3        6        1        0
+2        3        7        0        0
+2        3        8        0        0
+2        3        9        0        0
+2        3        10       0        0
+2        3        11       1        0
+2        3        12       0        0
+2        3        13       1        0
+2        3        14       1        0
+2        3        15       0        0
+
+2        4        0        1        0
+2        4        1        0        0
+2        4        2        0        0
+2        4        3        0        0
+2        4        4        0        0
+2        4        5        1        0
+2        4        6        1        0
+2        4        7        0        0
+2        4        8        0        0
+2        4        9        0        0
+2        4        10       0        0
+2        4        11       1        0
+2        4        12       0        0
+2        4        13       1        0
+2        4        14       1        0
+2        4        15       0        0
+
+2        5        0        1        0
+2        5        1        0        0
+2        5        2        0        0
+2        5        3        0        0
+2        5        4        0        0
+2        5        5        1        0
+2        5        6        1        0
+2        5        7        0        0
+2        5        8        0        0
+2        5        9        0        0
+2        5        10       0        0
+2        5        11       1        0
+2        5        12       0        0
+2        5        13       1        0
+2        5        14       1        0
+2        5        15       0        0
+
+##########################################
+
+3        0        0        0        0
+3        0        1        0        0
+3        0        2        0        0
+3        0        3        1        0
+3        0        4        1        0
+3        0        5        0        0
+3        0        6        0        0
+3        0        7        0        0
+3        0        8        0        0
+3        0        9        1        0
+3        0        10       1        0
+3        0        11       0        0
+3        0        12       0        0
+3        0        13       1        0
+3        0        14       1        0
+3        0        15       0        0
+
+3        1        0        0        0
+3        1        1        0        0
+3        1        2        0        0
+3        1        3        1        0
+3        1        4        1        0
+3        1        5        0        0
+3        1        6        0        0
+3        1        7        0        0
+3        1        8        0        0
+3        1        9        1        0
+3        1        10       1        0
+3        1        11       0        0
+3        1        12       0        0
+3        1        13       1        0
+3        1        14       1        0
+3        1        15       0        0
+
+3        2        0        0        0
+3        2        1        0        0
+3        2        2        0        0
+3        2        3        1        0
+3        2        4        1        0
+3        2        5        0        0
+3        2        6        0        0
+3        2        7        0        0
+3        2        8        0        0
+3        2        9        1        0
+3        2        10       1        0
+3        2        11       0        0
+3        2        12       0        0
+3        2        13       1        0
+3        2        14       1        0
+3        2        15       0        0
+
+3        3        0        0        0
+3        3        1        0        0
+3        3        2        0        0
+3        3        3        1        0
+3        3        4        1        0
+3        3        5        0        0
+3        3        6        0        0
+3        3        7        0        0
+3        3        8        0        0
+3        3        9        1        0
+3        3        10       1        0
+3        3        11       0        0
+3        3        12       0        0
+3        3        13       1        0
+3        3        14       1        0
+3        3        15       0        0
+
+3        4        0        0        0
+3        4        1        0        0
+3        4        2        0        0
+3        4        3        1        0
+3        4        4        1        0
+3        4        5        0        0
+3        4        6        0        0
+3        4        7        0        0
+3        4        8        0        0
+3        4        9        1        0
+3        4        10       1        0
+3        4        11       0        0
+3        4        12       0        0
+3        4        13       1        0
+3        4        14       1        0
+3        4        15       0        0
+
+3        5        0        0        0
+3        5        1        0        0
+3        5        2        0        0
+3        5        3        1        0
+3        5        4        1        0
+3        5        5        0        0
+3        5        6        0        0
+3        5        7        0        0
+3        5        8        0        0
+3        5        9        1        0
+3        5        10       1        0
+3        5        11       0        0
+3        5        12       0        0
+3        5        13       1        0
+3        5        14       1        0
+3        5        15       0        0
index 47d732346c8730c26104ac8a6e794575d31a5e0d..3a6b9eed43da3bcc5d1c676d940edfbce3611458 100644 (file)
@@ -1,15 +1,20 @@
 #Scripts#
 
 * `generate_pasttrec_settings.pl` prepares data from common baseline database
- * loads settings to FPGA directly
- * writes trbcmd files for later writing to Flash ROM
- * settings are written for boards currently in the system (otherwise serial number / uid can't be matched to addresses)
- * default PASTTREC registers are currently hardcoded (!)
 * loads settings to FPGA directly
 * writes trbcmd files for later writing to Flash ROM
 * settings are written for boards currently in the system (otherwise serial number / uid can't be matched to addresses)
 * default PASTTREC registers are currently hardcoded (!)
 
 * `merge_and_flash_settings.pl` generates and loads settings from the 'settings' directory to the FPGAs flashes
 
 * `generate_address_settings.pl` makes the files needed to automatically set the board addresses from Flash ROM
 
+* `pasttrec_set_threshold.pl` sets an identical threshold to all Pasttrec (temporarily)
+
+* `pasttrec_baseline_finder.pl` basic baseline finder script
+
+* `generate_address_list.pl` takes the list of installed MBO serial numbers and generates the address.db file for DAQ
 
 ##Notes##
 All scripts assume that the daqtool repository is available next to this repository.
diff --git a/scripts/generate_address_list.pl b/scripts/generate_address_list.pl
new file mode 100755 (executable)
index 0000000..431c675
--- /dev/null
@@ -0,0 +1,98 @@
+#!/usr/bin/perl -w
+use warnings;
+no warnings "portable";
+use FileHandle;
+use Getopt::Long;
+use Data::Dumper;
+
+my $DEBUG = 0;       #print debug messages
+
+my $boards;
+my $longs;
+
+
+###############################################################################
+#Read file with list of installed boards & MBO size
+###############################################################################
+open FILE, "../installation/mbo_positions.db" or die $!."\nmbo_positions.db not found.";
+while (my $a = <FILE>) {
+  if(my @values = $a =~ /^\s*(\d)\s+(\d)\s+(\d+)\s+(\d)\s+(\d+)\s*/) {
+    my $p    = shift @values;
+    my $s    = shift @values;
+    my $b    = shift @values;
+    my $long = shift @values;
+    my $id   = shift @values;
+    
+    $boards->[$p][$s][$b] = $id;
+    $longs->[$p][$s][$b]  = $long;
+    }
+  }
+close FILE;
+
+###############################################################################
+#Generate list with all 1236 board addressess
+###############################################################################
+open(FILE, '>', "../settings_oep/auto/addresses_mdc.db") or die $!;
+
+print FILE "\n\n#This file is generated automatically. DO NOT EDIT.\n\n";
+print FILE "#Address  #   S/N   #   FPGA  #\n";
+print FILE "###################################################\n";
+
+foreach my $p (0..3) {
+  foreach my $s (0..5) {
+    foreach my $b (0..15) {
+    
+      my $str;
+
+      my $addr = 0x8000 + ($p<2?0x0e00:0x0f00) + ($p%2 ? $s*16+96 : $s*16) + $b;
+      $str .= sprintf("  0x%04x      %03i        %i\n",$addr,$boards->[$p][$s][$b],5);
+      
+      $addr = ($p<2?0x1000:0x2000) + ($p%2 ? $s*256+6*256 : $s*256) + $b*16 + 0;
+      $str .= sprintf("  0x%04x      %03i        %i\n",$addr,$boards->[$p][$s][$b],0);
+
+      $addr = ($p<2?0x1000:0x2000) + ($p%2 ? $s*256+6*256 : $s*256) + $b*16 + 1;
+      $str .= sprintf("  0x%04x      %03i        %i\n",$addr,$boards->[$p][$s][$b],1);
+
+      if($longs->[$p][$s][$b]) {
+        $addr = ($p<2?0x1000:0x2000) + ($p%2 ? $s*256+6*256 : $s*256) + $b*16 + 2;
+        $str .= sprintf("  0x%04x      %03i        %i\n",$addr,$boards->[$p][$s][$b],2);
+        };
+      
+      print FILE $str;
+      last if $p == 0 && $b == 13;
+      }
+    print FILE "\n";  
+    }
+  print FILE "\n";  
+  }
+
+close FILE;
+
+
+__END__
+
+
+###############################################################################
+#Addressing scheme
+###############################################################################
+
+ OEP FPGA:
+
+    1 digit: 8 (as for all hubs)
+    2 digit: e/f (inner/outer MDC)
+    3 digit: 0..b (chamber number, 0..5 for MDC1/3 6..B for MDC2/4)
+    4 digit: 0..f (MBO number)
+
+TDC FPGA:
+
+    1 digit: 1/2 (inner/outer MDC)
+    2 digit: 0..b (chamber number, 0..5 for MDC1/3 6..B for MDC2/4)
+    3 digit: 0..f (MBO number)
+    4 digit: 0..2 (FPGA number)
+
+Hub FPGA:
+
+    1 digit: 8 (as for all hubs)
+    2 digit: 5
+    3 digit: 0..b (crate number, 0..5 inner MDC, 6..b outer MDC sectors)
+    4 digit FPGA number in crate (0:master & Subevent ID)