]> jspc29.x-matter.uni-frankfurt.de Git - clocked_tdc.git/commitdiff
add data format document, slight change to header word
authorJan Michel <michel@physik.uni-frankfurt.de>
Thu, 8 Dec 2022 15:54:11 +0000 (16:54 +0100)
committerJan Michel <michel@physik.uni-frankfurt.de>
Thu, 8 Dec 2022 15:54:11 +0000 (16:54 +0100)
code/ReadoutHandler.vhd
dataformat.md [new file with mode: 0644]

index 48b0c988e2f5ae276f78b5836514435415bcbe36..deb51db08f007078abdef328119978e78070ec1e 100644 (file)
@@ -151,7 +151,7 @@ begin
     when IDLE =>
       channel := 0;
       if collect_start_tdc = '1' then
-        cdc_data_in <= x"1DC0" & "000" & REFERENCE_IN;
+        cdc_data_in <= x"DC00" & "000" & REFERENCE_IN;
         if GROUP_NUM = '0' then
           cdc_write <= '1';        
         end if;  
@@ -164,13 +164,11 @@ begin
         hit_valid <= '1';
         DATA_READ_OUT(channel) <= '1';
       end if;  
---       else
-        if channel < 15 then
-          channel := channel + 1;
-        else
-          state_data <= END1;
-        end if;
---       end if;  
+      if channel < 15 then
+        channel := channel + 1;
+      else
+        state_data <= END1;
+      end if;
       
     when END1 =>
       state_data <= END2;
diff --git a/dataformat.md b/dataformat.md
new file mode 100644 (file)
index 0000000..aa66a4a
--- /dev/null
@@ -0,0 +1,70 @@
+Clocked TDC (MDC edition)
+==
+
+
+
+
+General Remarks
+--
+
+* Each FPGA contains 32 TDC channels
+  * Counting starts from 0, the reference channel has no channel number
+
+* Data is not output in ordered fashion, hits are sent mixed between channels, not ordered by time.
+* There might be up to 10 hits per channel
+
+* TDC calibration is not necessary by default
+* TDC calibration is implemented in two options (usual 0xd trigger type):
+  * Internal calibration with a 50 ns long pulse
+  * Calibration pulse using the analog front-end chips 
+    * about 110 ns long, depending on front-end settings
+    * Might give several hits especially with low thresholds
+  
+
+Data Format (v0)
+--
+* All time information is encoded in units of 0.4 ns.
+* All timestamps have 13 Bit
+  * Overflow happens after 3276.8 ns
+* All hits can be assumed to be in a window between -2000 and +1200 ns relative to the reference time
+
+* Header word
+  * always sent as first word
+  * (31..24) TDC Header marker 0xDC
+  * (19..16) data format version 0
+  * (12..0) Reference Time timestamp
+
+* Hit data words
+  * all remaining words after header
+  * (12..0) Trailing Edge timestamp
+  * (25..13) Leading Edge timestamp
+  * (26) Error Flag
+  * (31..27) Channel number (0 - 31)
+  
+  
+Data Format (v1)
+--
+
+* Same as v0, but channel numbers are encoded differently
+  * to support setups with more than 32 channels
+  * not to be used in MDC, but e.g. on Trb5sc
+  * The Header word followed by an arbitrary amount of data is repeated N = ceil(channels/3) times, e.g. 3 times for a 48 channel TDC.
+  * Bit 31 distinguishes between Header words and hit words
+
+* Header word
+  * 0xDC01rrrr
+  * (31..24) TDC Header marker 0xDC
+  * **(23..20) TDC Channel group number**
+  * **(19..16) data format version 1**
+  * (12..0) Reference Time timestamp
+
+* Hit data words
+  * (12..0) Trailing Edge timestamp
+  * (25..13) Leading Edge timestamp
+  * (26) Error Flag
+  * **(30..27) Channel number (0 - 15)**
+  * **(31) TDC Hit word marker (always 0)**
+  
+
+  
+