Changes between Initial Version and Version 1 of TRM_8b10_Decoding


Ignore:
Timestamp:
Nov 8, 2013, 10:17:53 AM (12 years ago)
Author:
Eric Hazen
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TRM_8b10_Decoding

    v1 v1  
     1Up to [[TrackerReadoutModule]]
     2
     3Data from the TDC is encoded using
     4[http://en.wikipedia.org/wiki/8b/10b_encoding 8b10b]
     5
     6Need to double-check the following, but here are our current assumptions:
     7<pre>
     8Each 32-bit word is sent as four bytes, in network byte order. This would be:
     9
     10{{{
     11  1.  bits 31:24
     12  2.  bits 23:16
     13  3.  bits 15:8
     14  4.  bits 7:0
     15
     16}}}
     17Each byte is encoded 8b/10b using the "IBM" 8b10b encoding
     18http://en.wikipedia.org/wiki/8B10B#Encoding_tables
     19where the 8-bit code (ABCDEFGH) maps to bits (01234567)
     20and the 10-bit code (abcdei fghj) maps to bits (0123456789).
     21In the 10-bit code the bits are shifted out LSB-first so abcdeifghj come out
     22in that order with a being sent first.
     23
     24What 8b10b code is sent while the link is idle?  It says "0''s" in your
     25document, but does that mean D.0.0?
     26</pre>
     27
     28Decoding involves a 3-step process:
     29
     30==  Data recovery  ==
     31
     32This is the process of recovering a reliable stream of serial data from a data link for which
     33no separate clock is available.  See for example
     34[http://ohm.bu.edu/~hazen/Papers/blind_oversampling_CDR.pdf this paper]
     35
     36Below is a prototype VHDL entity for a data recovery block.  The <b>oversamp</b> parameter sets
     37the ratio of the <b>clk</b> rate to the bit rate.  The <b>d</b> input is the bit stream from
     38the TDC.  The <b>q</b> output is the recovered data stream, with <b>dav</b>=1 indicating
     39a valid bit.  Generally, <b>dav</b> will be high one clock every 5th for an oversampling
     40factor of 5.  The <b>err</b> output may indicate a failure to identify a valid bit stream.
     41
     42{{{
     43  entity data_rec is
     44    generic (
     45      oversamp : integer := 5);           -- oversampling factor               
     46    port (
     47      clk   : in  std_logic;              -- oversampling clock                 
     48      rst_n : in  std_logic;              -- active low async reset             
     49      d     : in  std_logic;              -- bitstream                         
     50      q     : out std_logic;              -- data output                       
     51      dav   : out std_logic;              -- data valid                         
     52      err   : out std_logic);             -- error output                       
     53  end data_rec;
     54
     55}}}
     56==  Byte synchronization  ==
     57
     58Byte synchronization is the process of assembling the bit stream from the data recovery
     59block into 10-bit symbols.  The synchronizer watches for a specific unique pattern which
     60does not otherwise occur in the bit stream to acquire synchronization, then simply
     61shifts 10 bits at a time into a register and provides them as output to the decoder.
     62
     63The TDC sends the 8b10b code K.28.1 ("0011111001" or "1100000110") at the start of each transmission.
     64This code contains the unique bit sequence "0011111" or "1100000" which does not otherwise occur in
     65the bit stream.
     66
     67Below is a prototype VHDL entity for a synchronizer.
     68
     69
     70{{{
     71  entity synchro is
     72    port (
     73      clk     : in  std_logic;                      -- oversampling clock         
     74      rst_n   : in  std_logic;                      -- active low async reset     
     75      d       : in  std_logic;                      -- serial bits in             
     76      dav_in  : in  std_logic;                      -- input data valid           
     77      comma   : out std_logic;                      -- comma sequence detected   
     78      in_sync : out std_logic;                      -- synchronized               
     79      err     : out std_logic;                      -- error in bit stream       
     80      dav_out : out std_logic;                      -- data valid out             
     81      q       : out std_logic_vector(9 downto 0));  -- symbol out                 
     82  end synchro;
     83
     84}}}
     85
     86==  8b10b decoding  ==
     87
     88This is the process of converting the 10-bit symbols from the bit stream
     89back to 8-bit bytes.  A simple decoder may be downloaded
     90from [http://opencores.org/project,8b10b_encdec opencores]
     91prototype VHDL entity for the decoder:
     92
     93{{{
     94  entity dec_8b10b is
     95    port (
     96      clk    : in  std_logic;                     -- oversampling clock
     97      rst_n  : in  std_logic;                     -- asynchronous reset active low
     98      d_in   : in  std_logic_vector(9 downto 0);  -- data symbol in
     99      dav_in : in  std_logic;                     -- input data valid
     100      d_out  : out std_logic_vector(7 downto 0);  -- decoded data out
     101      k      : out std_logic);                    -- control character
     102  end dec_8b10b;
     103
     104}}}
     105