1 數(shù)據(jù)鏈路層
數(shù)據(jù)鏈路層包括發(fā)送和接收兩個(gè)部分,本章主要介紹數(shù)據(jù)流從進(jìn)入到發(fā)射器的數(shù)據(jù)鏈路層到從接收器的數(shù)據(jù)鏈路層出來的所經(jīng)過的具體處理過程以及涉及到的模塊。
下面的圖21和圖22分別是發(fā)送數(shù)據(jù)鏈路層和接收數(shù)據(jù)鏈路層的內(nèi)部結(jié)構(gòu)圖,本章節(jié)將從發(fā)送鏈路層開始介紹每一個(gè)具體模塊的功能,同時(shí)由于接收鏈路層中包含的模塊總是發(fā)送的模塊的功能是相對(duì)的,所以在介紹發(fā)送鏈路層中的模塊時(shí),將同時(shí)介紹接收部分模塊的功能。
進(jìn)入鏈路層的數(shù)據(jù)是在傳輸層映射為數(shù)據(jù)幀的,進(jìn)入數(shù)據(jù)鏈路層的數(shù)據(jù)以幀為最小單元,而數(shù)據(jù)鏈路層工作在charcter clock時(shí)鐘域,所以在進(jìn)入數(shù)據(jù)鏈路層后,farme data 將先經(jīng)過Frame_to_octet模塊,F(xiàn)rame_to_octet模塊將輸入的數(shù)據(jù)幀轉(zhuǎn)換成octet的數(shù)據(jù)流。
數(shù)據(jù)流在Scrambler模塊將進(jìn)行加擾處,加擾的功能是可選擇的。
經(jīng)過加擾處理的數(shù)據(jù)流經(jīng)過alignment_character_generator模塊將進(jìn)行字節(jié)替換,字節(jié)替換的目的是為了檢測(cè)數(shù)據(jù)通道數(shù)據(jù)流是否工作正常。
Mux模塊通過TX_controller模塊選擇需要數(shù)據(jù)的數(shù)據(jù)流
數(shù)據(jù)流在8b/10bcoder模塊中將進(jìn)行編碼操作,并最終輸出到serdes_tx模塊。
TX_contrller 為數(shù)據(jù)鏈路層的控制模塊,該模塊通過control interface與上層接口交互控制信息,并對(duì)控制信息進(jìn)行解析,進(jìn)而控制數(shù)據(jù)鏈路層的工作流程。
Initial_lane_alignment_sequcence_generator是不同數(shù)據(jù)通道間的同步序列的生成模塊,該模塊將在系統(tǒng)啟動(dòng)同步后,產(chǎn)生所需要的同步序列。
?
圖21:數(shù)據(jù)鏈路層發(fā)送器的內(nèi)部結(jié)構(gòu)圖
在接收器部分,數(shù)據(jù)鏈路層的數(shù)據(jù)流的具體操作如下:
物理層的serdes模塊將輸入的1bit的串行數(shù)據(jù)流轉(zhuǎn)換為10bit并行數(shù)據(jù)流,并通過特殊的對(duì)齊字節(jié)完成數(shù)據(jù)流的對(duì)齊,并將對(duì)齊完后的數(shù)據(jù)通過8b/10b進(jìn)行解碼,并出輸出8bit位寬的octet數(shù)據(jù)流。
解碼輸出的數(shù)據(jù)流將通過lane_alignment_buffering_detection_monitoring模塊,該模塊將通過對(duì)校準(zhǔn)字符在數(shù)據(jù)幀中的位置,來判斷現(xiàn)階段的數(shù)據(jù)傳輸不同通道間是否同步。
接下來數(shù)據(jù)流經(jīng)過Frame_alignment_detection_monitoring模塊,該模塊也是通過對(duì)校準(zhǔn)字符在數(shù)據(jù)幀中的檢測(cè)來數(shù)據(jù)幀是否發(fā)生對(duì)齊的錯(cuò)誤。
在經(jīng)過兩級(jí)的對(duì)齊檢測(cè)后,數(shù)據(jù)將進(jìn)入descrambler模塊進(jìn)行數(shù)據(jù)的解擾。
解擾后的數(shù)據(jù)流將通過octet_to_frame模塊從新組合成數(shù)據(jù)幀,傳輸?shù)綌?shù)據(jù)傳輸層。
圖22:數(shù)據(jù)鏈路層接收射器的內(nèi)部結(jié)構(gòu)圖
以上便是系統(tǒng)中數(shù)據(jù)鏈路層對(duì)數(shù)據(jù)流的控制和處理流程,SystemC的模型中,上述的每一個(gè)模塊將有相對(duì)應(yīng)的模型,并且SystemC中模塊的名字將與上述圖中的模塊名稱保持一致。
1.1 RX Controller
Rxcontroller作為數(shù)據(jù)鏈路成的控制核心,其內(nèi)部需要完成的工作主要為兩個(gè)方面,一方面通過數(shù)據(jù)接口與上層進(jìn)行控制數(shù)據(jù)交換,一方面完成數(shù)據(jù)鏈路層的工作狀態(tài)控制,本章將系統(tǒng)的介紹數(shù)據(jù)鏈路層的工作狀態(tài)控制。
在Rx controller內(nèi)需要完成的工作包括:code group synchronization、initial frame synchronization,這兩部分表現(xiàn)為兩個(gè)狀態(tài)機(jī)的控制,完成數(shù)據(jù)流的同步和數(shù)據(jù)幀的同步。
1.1.1 code group synchronization
code group synchronization的功能在系統(tǒng)上電或者要求系統(tǒng)從新同步時(shí)完成數(shù)據(jù)流的同步,該同步的具體的過程是在serdes的CDR模塊中實(shí)現(xiàn)的,完成1bit數(shù)據(jù)流到10bit的串行轉(zhuǎn)換。具體的同步細(xì)節(jié)如下:
在同步要求開始后,接收控制器發(fā)送同步請(qǐng)求,此時(shí)SYNC信號(hào)將保持低電平,發(fā)射器在接收到同步請(qǐng)求后,將會(huì)發(fā)送comma碼:/K/=/K28.5/
接收控制器在接收以下的情況下降釋放同步請(qǐng)求:
Subclass 0 devcies:在接收到4個(gè)有效的K碼后,在任何數(shù)據(jù)幀的邊界釋放同步請(qǐng)求。
Subclass 1和Subclass 2:在接收到4個(gè)有效的k碼后,在數(shù)據(jù)的復(fù)幀(mutliframe)的邊界釋放同步請(qǐng)求,也就是將SYNC信號(hào)拉高。
在接收到另外4個(gè)有效的comma碼后,系統(tǒng)將認(rèn)為數(shù)據(jù)code group synchronization完成。
當(dāng)接收到一個(gè)無效的數(shù)據(jù)時(shí),狀態(tài)機(jī)將進(jìn)入檢測(cè)模式。
如果在檢測(cè)模式中,累積收到3個(gè)無效數(shù)據(jù)時(shí),認(rèn)為系統(tǒng)未同步。
在檢測(cè)模式中,如果檢測(cè)到4個(gè)正確數(shù)據(jù)后會(huì)認(rèn)為系統(tǒng)同步正常。
同步請(qǐng)求由接收器通過SYNC信號(hào)傳輸?shù)桨l(fā)送器,并且SYNC低電平有效,SYNC信號(hào)只有在frame clock 的上升沿才會(huì)發(fā)送變化,但是也分兩種情況:
Subclass 0:任何frame clock的上升沿
Subclass 1和Subclass 2:任何frame clock 和multiframe clock對(duì)齊的上升沿。
SYNC信號(hào)的低電平持續(xù)時(shí)間必須大于5個(gè)數(shù)據(jù)幀或者9個(gè)octet的持續(xù)時(shí)間。
Code groupsynchronization 同步的狀態(tài)機(jī)轉(zhuǎn)換圖如圖23所示,變量的具體意義在表1中有詳細(xì)的描述。
圖23:Code groupsynchronization state machine
?
Variable
?
Meaning
?
Icounter
?
Counter used in the CS_CHECK phase to count the number of invalid symbols
?
INVALID
?
Asserted by receiver to indicate that the current symbol is an invalid symbol given the current running disparity.
?
K_received
?
Asserted when the current symbol corresponds to control character K28.5
?
Kcounter
?
Counter used in the CS_INIT phase to count the number of valid K28.5 symbols
?
sync_request
?
Asserted by receiver when loss of code group synchronization has been detected. Note that sync_request does not drive SYNC~ directly, as SYNC~ assertion/de-assertion is based on more than just the sync_request signal described here.
?
VALID
?
Asserted by receiver to indicate that the current symbol is a valid symbol given the current running disparity.
?
Vcounter
?
Counter used in the CS_CHECK phase to count the number of successive valid symbols
?
code groupsynchronization只需要在SYNC有效時(shí)進(jìn)行,而在數(shù)據(jù)的正常傳輸時(shí),兩個(gè)相鄰字節(jié)中的某1bit出現(xiàn)錯(cuò)誤,也將有可能出現(xiàn)comma碼,而此時(shí)的comma碼將不能用來作為同步的檢測(cè)的標(biāo)準(zhǔn)。
1.1.2 Initial frame synchronization
Initial framesynchronization 的狀態(tài)機(jī)如圖24所示,該系統(tǒng)復(fù)位時(shí),狀態(tài)機(jī)將進(jìn)入initial state,octet counter 將會(huì)被清零,而的code group synchronization 將在系統(tǒng)復(fù)位后生成同步請(qǐng)求,在這種情況下,framesynchronization 將一直處于initialstate。
圖23:frame synchronizationstate machine
Frame synchronization的狀態(tài)機(jī)將在code group synchronization完成后,并且發(fā)送器停止發(fā)送K碼后進(jìn)入FS_DATA狀態(tài),在該狀態(tài)下,octet counter將會(huì)進(jìn)行計(jì)算,以標(biāo)記當(dāng)前的octet在frame中的位置,octet counter的計(jì)數(shù)范圍是:0 到F-1.如果有同步請(qǐng)求狀態(tài)機(jī)將直接回到FS_INIT狀態(tài),但是如果有各個(gè)接受器的情況下,其他接受器發(fā)送SYNC請(qǐng)求時(shí),當(dāng)前接收器并不知道有同步請(qǐng)求的情況下,狀態(tài)機(jī)只能通過檢測(cè)連續(xù)的K28.5來判斷狀態(tài)機(jī)是否跳轉(zhuǎn)。
如果K28.5被檢測(cè)到,狀態(tài)機(jī)將進(jìn)入FS_CHECK狀態(tài),在FS_CHECK狀態(tài)中,octet counter將繼續(xù)計(jì)數(shù),如果有4個(gè)K28.5被檢測(cè)到,狀態(tài)機(jī)將直接跳轉(zhuǎn)到initial 狀態(tài)。
?
Variable
?
Meaning
?
any_sync_request
?
A sync request asserted by any receiver connected to the link.
?
CHECK_ALIGNMENT
?
Perform frame alignment monitoring, see subclause 7.3
?
F
?
Number of octets per frame
?
Kcounter
?
Counter used in the FS_CHECK phase to count the number of K28.5 symbols
?
K_received
?
Asserted when the current symbol corresponds to control character K28.5 (valid or invalid)
?
Ocounter
?
Counter used to mark the position of the current octet in the frame.
?
sync_request
?
Asserted by receiver when loss of code group synchronization has been detected or if another error requires re-initialization.
?
1.2 Tx controller
Tx controller主要功能與Rx controller是保持一致的,其內(nèi)部需要完成狀態(tài)如下圖所示:
具體的流程如下:
在系統(tǒng)復(fù)位后,狀態(tài)機(jī)進(jìn)入SYNC狀態(tài),在該狀態(tài)下發(fā)送器將持續(xù)的發(fā)送K28.5的comma碼,在SYNC信號(hào)被釋放后的第一個(gè)數(shù)據(jù)幀到來時(shí),狀態(tài)機(jī)將跳轉(zhuǎn)到INIT_LANE狀態(tài)。
在LINIT_LANE狀態(tài)下,狀態(tài)機(jī)將通過控制信號(hào)控制Initial lanealignment sequence generator模塊開始生產(chǎn)lane同步的序列,并控制MUX模塊輸出Initial lane alignment sequence。
在Initial lane alignment sequence發(fā)送完畢后,狀態(tài)機(jī)將進(jìn)入正常的數(shù)據(jù)發(fā)送狀況,并在系統(tǒng)要求同步時(shí)進(jìn)入SYNC狀態(tài)。
?
Variable
?
Meaning
?
7C_octet
?
Asserted when the scrambler outputs a 0x7C (28.3) octet
?
alignment_sent
?
Used to indicate a /K28.3/ or /K28.7/ has been sent in the previous frame.
?
FC_octet
?
Asserted when the scrambler outputs a 0xFC (28.7) octet
?
frame_end
?
Asserted by transmitter to indicate end of frame.
?
(multi)frame_start
?
Asserted by transmitter to indicate start of frame for devices belonging to the NMCDA-SL device class, or start of multiframe for devices belonging to other device classes. (See clause 9).
?
lane_seq_end
?
Asserted by transmitter to indicate end of initial lane alignment sequence
?
multiframe_end
?
Asserted by transmitter to indicate end of multiframe. Only to be asserted if both sides of the lane support lane synchronization.
?
NewOvalue
?
Value of last octet in current frame
?
OldOvalue
?
Used for storage of last octet in frame
?
SEND_A
?
Send /K28.3/ symbol
?
SEND_DATA
?
Send code group belonging to current data octet
?
SEND_F
?
Send /K28.7/ symbol
?
SEND_K
?
Send /K28.5/ symbol
?
SEND_LANE_SEQ
?
Send initial lane alignment sequence
?
sync_request_tx
?
asserted when transmitter detects a synchronization request
1.3 Initial frame synchronization
在系統(tǒng)數(shù)據(jù)鏈路建立起來時(shí),數(shù)據(jù)幀的同步將通過以下方式實(shí)現(xiàn):
在code group synchronization期間,發(fā)送器將一直發(fā)送標(biāo)志符comma碼K28.5。
在code group synchronization結(jié)束后,在接收器接收到第一個(gè)不是K28.5的字符開始,認(rèn)為是數(shù)據(jù)幀的開始,如果發(fā)送器發(fā)送的是initial lanealignment sequence,那么K28.5后面緊跟的將是K28.0。
在第一個(gè)K28.0以后,接收器認(rèn)為每F個(gè)octet為一個(gè)數(shù)據(jù)幀。
1.3.1 Frame alignment monitoring andcorrection
1.3.1.1 Alignment charaters
數(shù)據(jù)幀的對(duì)齊通過對(duì)齊標(biāo)志符comma碼來完成,這些comma將在特定的情況下插入到數(shù)據(jù)流中,接收器將在確定接收到的comma有效時(shí),將以comma在數(shù)據(jù)幀的位置為標(biāo)志,從新的同步接收器中的數(shù)據(jù)幀,在一般的情況下,系統(tǒng)認(rèn)為多次在數(shù)據(jù)幀的某一個(gè)位置檢測(cè)到comma,才會(huì)認(rèn)為該comma是有效的,并且以此作為依據(jù)來從新同步接收器中的數(shù)據(jù)幀。
對(duì)齊數(shù)據(jù)幀的標(biāo)準(zhǔn)符是comma碼/F/=/K28.5/,但是如果發(fā)送和接收器都支持通道間的通道,那么comma碼/A/=/28.3/也將會(huì)出現(xiàn)在復(fù)幀的結(jié)束,他也可以作為數(shù)據(jù)幀同步的標(biāo)志符。
根據(jù)數(shù)據(jù)是否進(jìn)行加擾處理,對(duì)于對(duì)齊標(biāo)志符的處理將分為兩種情況。
1.3.1.2 Character replacement withoutscrambling
在接收器和發(fā)送器都支持通道同步的情況下,對(duì)齊標(biāo)志符的在發(fā)送器內(nèi)的替換和在接收器中的還原需要遵循如下的操作:
當(dāng)前數(shù)字幀的最后一個(gè)octet,當(dāng)前復(fù)幀的最后一個(gè)octe除外,等于上一次數(shù)據(jù)幀的最后一個(gè)octet,那么當(dāng)前數(shù)據(jù)幀的最后的octet將用/F/=/K28.7/來代替,但是如果上數(shù)據(jù)幀已經(jīng)發(fā)生了對(duì)齊標(biāo)志符,本次數(shù)據(jù)幀將不進(jìn)行替換。
當(dāng)前數(shù)據(jù)幀的最后一個(gè)octet,并且是復(fù)幀的最后一個(gè)octet,等于上一次數(shù)據(jù)幀的最后一個(gè)octet,那么當(dāng)前數(shù)據(jù)幀的最后的octet將用/A/=/K28.3/來代替,即使上一次數(shù)據(jù)幀已經(jīng)發(fā)生了對(duì)齊標(biāo)志符,本次數(shù)據(jù)幀也會(huì)進(jìn)行替代
在接收器中,在接收到對(duì)齊標(biāo)志符/F/或者/A/時(shí),接收器需要用上一數(shù)據(jù)幀中位置相同的數(shù)據(jù)進(jìn)行替代。
如果接收和發(fā)送器中,有某一個(gè)器件不支持通道同步,對(duì)齊標(biāo)志符的替換將遵循如下的原則:
當(dāng)前數(shù)字幀的最后一個(gè)octet,當(dāng)前復(fù)幀的最后一個(gè)octe除外,等于上一次數(shù)據(jù)幀的最后一個(gè)octet,那么當(dāng)前數(shù)據(jù)幀的最后的octet將用/F/=/K28.7/來代替,但是如果上數(shù)據(jù)幀已經(jīng)發(fā)生了對(duì)齊標(biāo)志符,本次數(shù)據(jù)幀將不進(jìn)行替換。
在接收器中,在接收到對(duì)齊標(biāo)志符/F/時(shí),接收器需要用上一數(shù)據(jù)幀中位置相同的數(shù)據(jù)進(jìn)行替代。
1.3.1.3 Character replacement withscrambling
在接收器和發(fā)送器都支持通道同步的情況下,對(duì)齊標(biāo)志符的在發(fā)送器內(nèi)的替換和在接收器中的還原需要遵循如下的操作:
當(dāng)前數(shù)字幀的最后一個(gè)octet,當(dāng)前復(fù)幀的最后一個(gè)octe除外,等于0xFC時(shí),那么當(dāng)前數(shù)據(jù)幀的最后的octet將用/F/=/K28.7/來代替。
當(dāng)前數(shù)據(jù)幀的最后一個(gè)octet,并且是復(fù)幀的最后一個(gè)octet,等于0x7C時(shí),那么當(dāng)前數(shù)據(jù)幀的最后的octet將用/F/=/K28.3/來代替。
在接收器中,在接收到對(duì)齊標(biāo)志符/F/或者/A/時(shí),接收器需要用0xFC或者0x7C替代。
如果接收和發(fā)送器中,有某一個(gè)器件不支持通道同步,對(duì)齊標(biāo)志符的替換將遵循如下的原則:
當(dāng)前數(shù)字幀的最后一個(gè)octet,當(dāng)前復(fù)幀的最后一個(gè)octe除外,等于0xFC時(shí),那么當(dāng)前數(shù)據(jù)幀的最后的octet將用/F/=/K28.7/來代替。
在接收器中,在接收到對(duì)齊標(biāo)志符/F/時(shí),接收器需要用0xFC替代。
1.3.1.4 Frame alignment character generator
對(duì)齊標(biāo)志符的檢測(cè)與校準(zhǔn)的處理過程如圖24所示,具體的變量信息解釋如表4所示,當(dāng)數(shù)據(jù)流中沒有提供足夠的機(jī)會(huì)產(chǎn)生數(shù)據(jù)對(duì)齊標(biāo)志符時(shí),數(shù)據(jù)幀的對(duì)齊的校準(zhǔn)的功能可以通過控制接口屏蔽。
圖24:Frame alignmentcharacter generator
?
Variable
?
Meaning
?
7C_octet
?
Asserted when the scrambler outputs a 0x7C (28.3) octet
?
alignment_sent
?
Used to indicate a /K28.3/ or /K28.7/ has been sent in the previous frame.
?
FC_octet
?
Asserted when the scrambler outputs a 0xFC (28.7) octet
?
frame_end
?
Asserted by transmitter to indicate end of frame.
?
(multi)frame_start
?
Asserted by transmitter to indicate start of frame for devices belonging to the NMCDA-SL device class, or start of multiframe for devices belonging to other device classes. (See clause 9).
?
lane_seq_end
?
Asserted by transmitter to indicate end of initial lane alignment sequence
?
multiframe_end
?
Asserted by transmitter to indicate end of multiframe. Only to be asserted if both sides of the lane support lane synchronization.
?
NewOvalue
?
Value of last octet in current frame
?
OldOvalue
?
Used for storage of last octet in frame
?
SEND_A
?
Send /K28.3/ symbol
?
SEND_DATA
?
Send code group belonging to current data octet
?
SEND_F
?
Send /K28.7/ symbol
?
SEND_K
?
Send /K28.5/ symbol
?
SEND_LANE_SEQ
?
Send initial lane alignment sequence
?
sync_request_tx
?
asserted when transmitter detects a synchronization request
?
1.3.1.5 Frame alignment monitoring andcorrection
對(duì)齊標(biāo)志符的檢測(cè)與校準(zhǔn)的處理過程如圖25所示,具體的變量信息解釋如表5所示,當(dāng)數(shù)據(jù)流中沒有提供足夠的機(jī)會(huì)產(chǎn)生數(shù)據(jù)對(duì)齊標(biāo)志符時(shí),數(shù)據(jù)幀的對(duì)齊的校準(zhǔn)的功能可以通過控制接口屏蔽。
圖25:Frame alignmentmonitoring and correction
?
Variable
?
Meaning
?
A_received
?
Asserted when the current symbol, before possible substitution in lane alignment monitoring, corresponds to control character K28.3 Note: detection of K28.3 is not required in NMCDA-SL DACs.
?
CROSS_COUPLING
?
Frame misalignment expected because of cross coupling between lane and frame alignment
?
F
?
Number of octets per frame
?
F_received
?
Asserted when the current symbol corresponds to control character K28.7
?
Ocounter
?
Counter used to mark the position of the current octet in the frame. Octet indexing starts from 0.
?
previous_AF_position
?
Variable into which to store the position in the frame of a K28.3 or K28.7 symbol
?
REPLACE_ALIGNMENT_CHARACTER
?
Replace the alignment character at the decoder output by:
? The data character decoded or used at the same position in the previous frame when scrambling is disabled
? The data character with the same value when scrambling is enabled
?
Mark the possition of a K28.3 character if needed in subsequent lane synchronization or lane alignment monitoring.
?
RESET_OCTET_COUNTER
?
Reset octet counter to zero at reception of next octet
?
VALID
?
Asserted by receiver to indicate that the current symbol is a valid symbol given the current running disparity.
?
1.4 Initial lane synchronization
在正常數(shù)據(jù)的發(fā)送與接收前,需要對(duì)系統(tǒng)進(jìn)行通道間的同步,以保證不同通道數(shù)據(jù)在接收輸出是同步的,在一個(gè)合適的時(shí)間點(diǎn)上,所以的發(fā)送器將同時(shí)發(fā)送字節(jié)對(duì)齊標(biāo)志位/A/=/28.3,但是由于不同通道間的延時(shí)不同,會(huì)導(dǎo)致接收器接收到標(biāo)志字符的時(shí)間是不同的。所以當(dāng)接收器接收到標(biāo)志字符/A/時(shí),每一個(gè)接收器都將從A以后的序列存儲(chǔ)起來,并通過ready標(biāo)準(zhǔn)位通知其他通道,該通道已經(jīng)接收到有效的對(duì)齊字符,當(dāng)系統(tǒng)中的所有通道都已經(jīng)接收到有效的對(duì)齊字符時(shí),系統(tǒng)將在一個(gè)同一時(shí)間點(diǎn)將緩存的數(shù)據(jù)進(jìn)行釋放,這樣便保證了系統(tǒng)中所有通道數(shù)據(jù)的同步輸出。
支持JESD204B的器件是可以讓發(fā)送與接收之間保持固定延遲的,對(duì)于系統(tǒng)中的某一個(gè)接收器件沒有接收到有效的對(duì)齊字符而其他器件正常接收時(shí),JESD204B定義了具體的出錯(cuò)處理機(jī)制。
不同通道間的同步是通過通道同步序列(initial lane alignment sequence)來完成的,通道同步的序列將在code group synchronization完成后立即發(fā)送,initial lane alignment sequence是不經(jīng)過加擾的,對(duì)于ADC器件來說initiallane alignment sequence的長度固定為4個(gè)multiframe,對(duì)于DAC器件來說,在Subclass 1和Subclass 2中,initial lane alignment sequence的要求長度也是4個(gè)multiframe,所以,對(duì)于FPGA來說,initial lane alignment sequence的長度必須可以編程,長度范圍是4-256,其中multiframe的長度是K個(gè)frame,K的取值范圍為:1-32,而multiframe中octet的個(gè)數(shù)范圍為:17-1024。
對(duì)于JESD204B的發(fā)送器來說,K的值必須是可編程的,而JESD204B的接收器中,K的值是建議可編程,JESD204的接收器必須明確定義對(duì)于K值的處理是是要求還是建議,而在本次的建模中,K值都是可編程的。
initial lanealignment sequence的結(jié)構(gòu)如圖26所示,每復(fù)幀開始標(biāo)志位為/R/=/28.0/,結(jié)束標(biāo)準(zhǔn)位為/A/=/28.3/,R標(biāo)志著initial lane alignment sequence的開始,A標(biāo)志著initiallane alignment sequence每一復(fù)幀的結(jié)束。標(biāo)志位A表示每一復(fù)幀的結(jié)束并不僅僅用于initial lane alignment sequence,在正常的數(shù)據(jù)發(fā)送中也會(huì)用到,在initial lane alignment sequence的第二個(gè)復(fù)幀中,包含了系統(tǒng)配置的參數(shù),從復(fù)幀的第三個(gè)字節(jié)開始,K28.4作為第二個(gè)標(biāo)志字符,標(biāo)志著配置字節(jié)的開始。
圖26:initial lane alignmentsequence的結(jié)構(gòu)
?
圖27:initiallane alignment sequence生成的流程圖內(nèi)容
initial lane alignment sequence的生成流程圖如上圖所示,數(shù)據(jù)復(fù)幀的第一個(gè)字節(jié)為0x1c/28.0/,結(jié)束字節(jié)為/28.3/,在第二復(fù)幀的第二個(gè)字節(jié)為0x9c/28.4/,配置字符是從第二復(fù)幀的第3字節(jié)開始。
1.4.2 Link configuration data andencoding
下表為系統(tǒng)中配置參數(shù)的具體解釋和參考圖。
?
Parameter
?
Description
?
Parameter Range
?
Field
?
Encoding
?
ADJCNT
?
Number of adjustment resolution steps to adjust DAC LMFC.
Applies to Subclass 2 operation only.
?
0 … 15
?
ADJCNT<3:0>
?
Binary value
?
ADJDIR
?
Direction to adjust DAC LMFC 0 – Advance 1 – Delay
Applies to Subclass 2 operation only
?
0 … 1
?
ADJDIR<0>
?
Binary value
?
BID
?
Bank ID – Extension to DID
?
0 ... 15
?
BID<3:0>
?
Binary value
?
CF
?
No. of control words per frame clock period per link
?
0 ... 32
?
CF<4:0>
?
Binary value*
?
CS
?
No. of control bits per sample
?
0 ... 3
?
CS<1:0>
?
Binary value
?
DID
?
Device (= link) identification no.
?
0 ... 255
?
DID<7:0>
?
Binary value
?
F
?
No. of octets per frame
?
1 ... 256
?
F<7:0>
?
Binary value minus 1
?
HD
?
High Density format
?
0 ... 1
?
HD<0>
?
Binary value
?
JESDV
?
JESD204 version 000 – JESD204A 001 – JESD204B
?
0 … 7
?
JESDV<2:0>
?
Binary Value
?
K
?
No. of frames per multiframe
?
1 ... 32
?
K<4:0>
?
Binary value minus 1
?
L
?
No. of lanes per converter device (link)
?
1 ... 32
?
L<4:0>
?
Binary value minus 1
?
LID
?
Lane identification no. (within link)
?
0 ... 31
?
LID<4:0>
?
Binary value
?
M
?
No. of converters per device
?
1 ... 256
?
M<7:0>
?
Binary value minus 1
?
N
?
Converter resolution
?
1 ... 32
?
N<4:0>
?
Binary value minus 1
?
N’
?
Total no. of bits per sample
?
1 ... 32
?
N'<4:0>
?
Binary value minus 1
?
PHADJ
?
Phase adjustment request to DAC Subclass 2 only.
?
0 … 1
?
PHADJ<0>
?
Binary value
?
S
?
No. of samples per converter per frame cycle
?
1 ... 32
?
S<4:0>
?
Binary value minus 1
?
SCR
?
Scrambling enabled
?
0 ... 1
?
SCR<0>
?
Binary value
?
SUBCLASSV
?
Device Subclass Version 000 – Subclass 0 001 – Subclass 1 010 – Subclass 2
?
0 … 7
?
SUBCLASSV
<2:0>
?
Binary Value
?
RES1
?
Reserved field 1
?
0 ... 255
?
RES1<7:0>
?
Binary value
?
RES2
?
Reserved field 2
?
0 ... 255
?
RES2<7:0>
?
Binary value
?
CHKSUM
?
Checksum Σ(all above fields)mod 256
?
0 ... 255
?
FCHK<7:0>
?
Binary value
?
*?CF==L?shall always be encoded as 31: control words on all lanes.?CF==31 can only occur when?L==31, see 5.1.3.
?
Configuration octet no.
?
Bits
?
MSB
?
6
?
5
?
4
?
3
?
2
?
1
?
LSB
?
0
?
DID<7:0>
?
1
?
ADJCNT<3:0>
?
BID<3:0>
?
2
?
X
?
ADJDIR<0>
?
PHADJ<0>
?
LID<4:0>
?
3
?
SCR<0>
?
X
?
X
?
L<4:0>
?
4
?
F<7:0>
?
5
?
X
?
X
?
X
?
K<4:0>
?
6
?
M<7:0>
?
7
?
CS<1:0>
?
X
?
N<4:0>
?
8
?
SUBCLASSV<2:0>
?
N’<4:0>
?
9
?
JESDV<2:0>
?
S<4:0>
?
10
?
HD<0>
?
X
?
X
?
CF<4:0>
?
11
?
RES1<7:0> - Set to all X
?
12
?
RES2<7:0> - Set to all X
?
13
?
FCHK<7:0>
?
1.4.3 Lane alignment buffering /detection and monitoring
在開始數(shù)據(jù)幀和通道對(duì)齊后,通道將會(huì)進(jìn)入對(duì)齊字節(jié)檢測(cè)狀態(tài),通道的對(duì)齊是通過對(duì)齊標(biāo)志符/A/=/28.3/來決定的,該對(duì)齊標(biāo)志符在復(fù)幀的結(jié)尾,對(duì)于對(duì)齊標(biāo)識(shí)符A的插入,可以參考frame alignmentmonitoring。
在一般的情況下,不是所有的通道都會(huì)發(fā)生同時(shí)發(fā)生對(duì)齊標(biāo)識(shí)符A,但是通道可以通過A在復(fù)幀中的位置來檢測(cè)數(shù)據(jù)通道的數(shù)據(jù)是否同步上。
在多個(gè)接收通道的情況下,每一個(gè)接收器都應(yīng)該可以從更高層的應(yīng)用中授權(quán)數(shù)據(jù)鏈路層對(duì)鏈路中的數(shù)據(jù)進(jìn)行從新的動(dòng)態(tài)調(diào)整,已完成不同數(shù)據(jù)通道間的對(duì)齊。
?數(shù)據(jù)通道中發(fā)現(xiàn)未對(duì)齊
?發(fā)現(xiàn)新的對(duì)齊字符,但是不在數(shù)據(jù)復(fù)幀的幀尾
?根據(jù)對(duì)齊字符緩存區(qū)中的數(shù)據(jù)進(jìn)行從新對(duì)齊
?如果連續(xù)接在同一個(gè)位置上接收到兩個(gè)有效的A,并且不在數(shù)據(jù)復(fù)幀的結(jié)束,并且在兩個(gè)A之間沒有接收到有效或者無效A標(biāo)識(shí)符,通道需要從新的將通道中的數(shù)據(jù)進(jìn)行對(duì)齊。
?如果在最近的數(shù)據(jù)幀出現(xiàn)通道間不對(duì)齊的可能性很大時(shí),接收器需要將第一個(gè)接收到A的位置作為對(duì)齊的標(biāo)準(zhǔn)。
1.4.4 Lane alignment detection andmonitoring
通道間的數(shù)據(jù)檢測(cè)和對(duì)齊處理過程如圖27所示,圖中變量的具體意思參照表8,具體的操作流程如下:
?
Variable
?
Meaning
?
A_received
?
Asserted when the current symbol, before possible substitution in frame alignment monitoring, corresponds to control character K28.3
?
CROSS_COUPLING
?
Lane misalignment expected because of cross coupling between frame and lane alignment
?
Fcounter
?
Counter used to mark the position of the current frame in the multiframe. Frame indexing starts from 0.
?
K
?
Number of frames in multiframe.
?
previous_A_position
?
Variable into which to store the position in the multiframe of a K28.3 symbol
?
REPLACE_A
?
Replace the K28.3 at the decoder output by:
? The data character decoded or used at the same position in the previous frame when scrambling is disabled
? D28.3 when scrambling is enabled
?
However, if the position of the K28.3 is required in subsequent frame alignment monitoring, the K28.3 shall not be replaced or it shall be marked.
?
RESET_FRAME_COUNTER
?
Reset frame counter to zero at reception of next frame
?
INITIATE_SYNC_CHECK
?
In receivers belonging to a MCDA device class (see clause 9), if authorized via the control interface, initiate a synchronization check between the LMFCs via one of the methods supported by the device class and subclass.
?
VALID
?
Asserted by receiver to indicate that the current symbol is a valid symbol given the current running disparity.
?
1.5 Scrambler and Descrambler
加擾編碼和解擾編碼存在JESD204 TX和RX的模塊中,并可以通過控制字使能是否對(duì)數(shù)據(jù)流進(jìn)行加擾。
加擾模塊都是針對(duì)單獨(dú)的數(shù)據(jù)通道,不會(huì)出現(xiàn)不同數(shù)據(jù)通道的數(shù)據(jù)混合加擾的情況,也就是說每一個(gè)數(shù)據(jù)通道有自己獨(dú)立的加擾通道。
加擾編碼模塊的功能是為了增加數(shù)據(jù)流中的高頻分量,減小數(shù)據(jù)流中連續(xù)0和1的個(gè)數(shù)。如果出現(xiàn)長時(shí)間的連續(xù)“1”或連續(xù)“0”,會(huì)影響接收端從數(shù)字信號(hào)中提取時(shí)鐘。
圖28: Functional location of scrambler and descrambler
1.5.1 加擾公式
1+x[14]+x[15]
該公式的作用周期可以長達(dá)32767bit,非常適合對(duì)頻譜敏感的收發(fā)應(yīng)用,而解擾器只需要2個(gè)字節(jié)緩存就能解擾。
1.5.2 加擾的流程
加擾器解擾器都是通過數(shù)據(jù)流串行輸入實(shí)現(xiàn)的,最小的處理單位為幀,加擾與解擾的順序是由高位到低位。具體的流程如下圖所示:
圖29:Serial scrambling
1.5.3 加擾的方式
加擾的實(shí)現(xiàn)方式可以分為兩種,串行加擾和并行加擾,串行加擾的時(shí)鐘域?yàn)榘l(fā)送接口的串行時(shí)鐘速率,雖然串行的加擾方式實(shí)現(xiàn)簡單,但是工作的頻率很高,RTL的實(shí)現(xiàn)難度要大于并行加擾模式,因此設(shè)計(jì)中采用并行加擾模式。
串行加擾和并行加擾的流程圖如下圖所示:
圖30:Serial scrambler anddescrambler implementation
scrambler模塊加入了使能信號(hào),其結(jié)構(gòu)如下圖所示,當(dāng)en信號(hào)無效時(shí),scrambler模塊將會(huì)被bypass,同時(shí)在code group synchronization sequence和transmission of an initial lane alignment sequence發(fā)送時(shí),scrambler也是bypass的。在使能scrambler后,scrambler和descramber模塊將會(huì)有兩個(gè)octet的數(shù)據(jù)延遲。
1.6 8b/10 Encoder andDecoder/monitoring
8b/10b編碼的原理是將一組連續(xù)的8位數(shù)據(jù)分解成兩組數(shù)據(jù),一組3位,一組5位,經(jīng)過編碼后分別成為一組4位的代碼和一組6位的代碼,從而組成一組10位的數(shù)據(jù)發(fā)送出去。相反,解碼是將一組10位的輸入數(shù)據(jù)經(jīng)過變換得到8位數(shù)據(jù)位。數(shù)據(jù)值可以統(tǒng)一的表示為DX.Y或KX.Y,其中D表示為數(shù)據(jù)代碼,K表示為特殊的命令代碼。X表示輸入的原始數(shù)據(jù)的低5位EDCBA,Y表示輸入的原始數(shù)據(jù)的高3位HGF。因此8b/10b編碼邏輯可分解為兩個(gè)子邏輯塊,一個(gè)5b/6b編碼器(EDCBA<—>iedcba)和一個(gè)3b/4b編碼器(HGF<—>jhgf)。編碼原理圖如下圖所示。
圖30:8b/10 Encoder and Decoder
在8b/10b編碼過程中,會(huì)出現(xiàn)字符不一致的情況,即一組字符中“1”和“0”的個(gè)數(shù)不一致的情況,這種情況稱作差異度。當(dāng)字符中的“0”比“1”多時(shí),稱作負(fù)極性;“1”比“0”多時(shí),稱作正極性;“0”和“1”相等時(shí),為零極性。編碼規(guī)則規(guī)定,非零極性的編碼結(jié)果(包括4位結(jié)果,6位結(jié)果和組合的10位結(jié)果)的極性必須依次翻轉(zhuǎn)[1]。比如,如果6位編碼結(jié)果具有正的極性,則接下來的4位結(jié)果應(yīng)該具有負(fù)的極性,如果接下來的4位結(jié)果具有零極性,則繼續(xù)要求4位結(jié)果后面6位結(jié)果具有負(fù)的極性,以此類推。
1.6.1 K_encode模塊設(shè)計(jì)
控制字在 8b/10b 編碼中只有 12 組,可以整體查表的方法實(shí)現(xiàn):
表10:8b/10b 編碼K碼
1.6.2 D_encode 模塊設(shè)計(jì)
數(shù)據(jù)字編碼共有 256 組,通常將其劃分為 3b/4b 編碼和 5b/6b 編碼分別進(jìn)行編碼,5b/6b 和 3b/4b 編碼表如表 4-2 和 4-3 所示。編碼結(jié)果欄目下,編碼結(jié)果為中性的只有 1 列,編碼結(jié)果極性不平衡的,分成了兩列,左邊一列的編碼結(jié)果具有正極性,右邊一列的編碼結(jié)果具有負(fù)極性。
表11:8b/10b 編碼D碼表
編碼表中有兩點(diǎn)需要注意:
1、表 4-2 中的 D.7 和表 4-3 中 D.x.3 的編碼結(jié)果,其編碼結(jié)果中“1”與“0”的個(gè)數(shù)相等,它本身是零極性的,但是其編碼結(jié)果卻有兩種可能;
2、表 4-3 中輸入為 D.x.7 的編碼結(jié)果可能四種:1110、0001、0111 和 1000,
做出這樣規(guī)定的目的是為了消除編碼結(jié)果 eifgh 出現(xiàn) 5 個(gè)連續(xù)“1”或者“0”的情況。
表12:8b/10b 編碼D碼表
1.6.3 Comma 檢測(cè)原理
SerDes 接口在發(fā)送端將字節(jié)信息經(jīng)過編碼和串并轉(zhuǎn)換后,經(jīng)過信道傳輸?shù)浇邮諜C(jī)上,接收機(jī)對(duì)收到的串行碼流進(jìn)行重定時(shí),并把它們重新恢復(fù)成并行的字節(jié)數(shù)據(jù)。Comma 信號(hào)就是用來指示字節(jié)邊界,獲取和驗(yàn)證字節(jié)同步(ByteSynchronization)的。為了有效達(dá)到這個(gè)目的,Comma 信號(hào)必須具有以下兩個(gè)特性:它必須是獨(dú)一無二的,2、相對(duì)于字節(jié)邊界,它能產(chǎn)生一個(gè)統(tǒng)一的對(duì)齊。在不考慮錯(cuò)誤的情況下,Comma 信息不能出現(xiàn)在其他 bit 位上,既不能出現(xiàn)在其他字符中,也不能出現(xiàn)在兩個(gè)字符之間。符合這兩個(gè)條件的0011111 和 0011111 被選作是 Comma 信號(hào),包含有 Comma 信號(hào)的 K.28.1(001111 1001 或 110000 0110),K.28.5(001111 1010 或 110000 0101),K.28.7(001111 1000 或 110000 0111)被稱為 Comma 字符。如果碼流中出現(xiàn)兩個(gè)或者 3 個(gè)交疊的 Comma 信號(hào),只有第一個(gè)和第三個(gè) Comma 信息會(huì)被檢測(cè)出來。比如出現(xiàn)兩個(gè) K.28.7,碼流00111110000011111000 中會(huì)出現(xiàn)三個(gè) Comma 信號(hào):0011111,1100000 和 0011111,這樣只有第一個(gè)和第三個(gè) Comma 會(huì)被認(rèn)為是合法的,這符合碼流中實(shí)際上只有兩個(gè) K.28.7 的情況。雖然 K.28.7 不容易出現(xiàn)錯(cuò)碼(其他碼要錯(cuò)兩位才可能變?yōu)镵.28.7),但是它的跳變密度比較低,不利于時(shí)鐘數(shù)據(jù)恢復(fù)。所以在實(shí)際應(yīng)用中,一般只使用 K.28.1、K.28.5 作為 Comma 字符,而不使用 K.28.7。
Comma 檢測(cè)就是檢測(cè)串行碼流中的 Comma 信息,然后把字節(jié)邊界調(diào)整到Comma 信號(hào)之前,實(shí)現(xiàn)字節(jié)邊界的對(duì)準(zhǔn),為 8b/10b 解碼器提供正確的并行輸入信號(hào),其功能如圖31所示。
圖31:comma檢測(cè)器
1.7 數(shù)據(jù)鏈路層的SystemC仿真
發(fā)送器數(shù)據(jù)鏈路層的仿真包括數(shù)據(jù)進(jìn)入數(shù)據(jù)鏈路層后先進(jìn)行scrambler、然后通過同步字替換模塊、再通過8b/10b編碼輸出,輸出的并行數(shù)據(jù)進(jìn)入到物理層的SerDes模塊,最終輸出1bit位寬的數(shù)據(jù)流。
接收器通過物理層的SerDes模塊將輸入的1bit數(shù)據(jù)流數(shù)據(jù)轉(zhuǎn)為10bit并行的數(shù)據(jù),CDR模塊將對(duì)數(shù)據(jù)進(jìn)行恢復(fù),并通過comma碼K28.5對(duì)輸入的數(shù)據(jù)完成邊界的對(duì)齊,數(shù)據(jù)經(jīng)過8b/10b解碼模塊后,最終輸出到數(shù)據(jù)通道同步檢測(cè)模塊和幀同步檢測(cè)模塊,通道同步檢測(cè)模塊完成不同數(shù)據(jù)通道間數(shù)據(jù)的同步與檢測(cè),而幀同步檢測(cè)模塊完成數(shù)據(jù)幀幀頭的識(shí)別,同步后的數(shù)據(jù)將通過descramber模塊完成數(shù)據(jù)的解擾工作,并最終將數(shù)據(jù)輸出到數(shù)據(jù)傳輸層,以下是SystemC的仿真圖:
上圖中,模擬了AD9250的兩個(gè)AD轉(zhuǎn)換通道,一個(gè)通道采樣的為數(shù)據(jù)三角波,一個(gè)通道采樣的正弦波,而下面的是接收器接收到的數(shù)據(jù),該數(shù)據(jù)的前半段的毛刺是由于系統(tǒng)同步而導(dǎo)致的。
評(píng)論