Summary of the invention
The technical problem to be solved in the present invention is to provide a kind ofly can realize PCI Express interface chip frequency reducing hardware verification, compatible existing test code, realize the PCIe interface chip hardware verification method based on asynchronous physical layer interface simple and convenient, versatility good, resources occupation rate is low.
In order to solve the problems of the technologies described above, the technical solution used in the present invention is:
A PCIe interface chip hardware verification method for asynchronous physical layer interface, implementation step is as follows:
1) build the FPGA hardware platform with Standard PC I Express interface, described FPGA hardware platform is connected with the main frame with PCI Express root node equipment by Standard PC I Express interface;
2) between the soft core of PCI Express in PCI Express interface chip ASIC code to be verified and Physical layer, insert for the poor asynchronous physical layer interface of matching frequency, described asynchronous physical layer interface comprises transmission buffer zone, reception buffer zone, frequency reducing PIPE interface and standard P IPE interface, and described asynchronous physical layer interface is connected with FPGA hardware platform, by standard P IPE interface, is connected with Physical layer by frequency reducing PIPE interface;
3) described PCI Express interface chip ASIC code to be verified is moved to described FPGA hardware platform and comprehensively realize, and according to PCI Express interface chip, the frequency of operation of frequency reducing PIPE interface is set by comprehensive highest frequency;
4) use test program is carried out functional test by described FPGA hardware platform to the soft core of PCI Express and the user logic of PCI Express interface chip, when the soft core of PCI Express sends PCI Express message by asynchronous physical layer interface to Physical layer, the soft core of PCI Express writes PCI Express message by frequency reducing PIPE interface the transmission buffer zone of asynchronous physical layer interface, asynchronous physical layer interface sends to Physical layer by transmission buffer cache PCI Express message by standard P IPE interface, simultaneously when the transmission buffer zone of asynchronous physical layer interface is sky, asynchronous physical layer interface detects the state of shaking hands of link, unsuccessful if shaken hands, on standard P IPE interface, insert SKP ordered set message and compensate the difference on the frequency between the soft core of PCI Express and Physical layer, if shake hands success, on standard P IPE interface, insert the empty message of LIDLE logic and compensate the difference on the frequency between the soft core of PCIExpress and Physical layer, when Physical layer sends PCI Express message by asynchronous physical layer interface to the soft core of PCI Express, asynchronous physical layer interface detects the state of shaking hands of link, unsuccessful if shaken hands, the PCIExpress message receiving is abandoned according to the ratio between the frequency of operation of frequency reducing PIPE interface and the frequency of operation of standard P IPE interface, and the PCI Express message not abandoning is write to the reception buffer zone of asynchronous physical layer interface, if shake hands success, the type of the PCI Express message that judgement receives, when being link layer message or transaction layer message, PCI Express message writes the reception buffer zone of asynchronous physical layer interface, when being the empty message of logic, PCI Express message all abandons, asynchronous physical layer interface sends to Physical layer by reception buffer zone buffer memory PCI Express message by frequency reducing PIPE interface.
Further improvement as technique scheme of the present invention:
While the frequency of operation of frequency reducing PIPE interface being set according to PCI Express interface chip by comprehensive highest frequency described step 3), the frequency of operation value rule of frequency reducing PIPE interface is suc as formula shown in (1);
fl/fs=1,4/5,3/4,7/10,2/3,3/5,1/2,2/5 (1)
In formula (1), flfor the frequency of operation of frequency reducing PIPE interface, fsfrequency of operation for standard P IPE interface.
The reception buffer zone capacity of described asynchronous physical layer interface meets the funtcional relationship of formula (2);
Cfifo>Ctlp*(1-(fl-fdllp)/fs) (2)
In formula (2), Cfifofor the capacity of reception buffer zone, Ctlpfor the transaction layer message reception buffer zone capacity (concrete numerical value and soft caryogamy are equipped with pass, are generally no more than 32KB) of the soft core of PCI Express, fdllpfor the maximum renewal frequency (concrete numerical value and soft caryogamy are equipped with pass, are generally no more than 1MHz) of data link layer message, flfor the frequency of operation of frequency reducing PIPE interface, fsfrequency of operation for standard P IPE interface.
When the PCI Express message receiving is abandoned according to the ratio between the frequency of operation of frequency reducing PIPE interface and the frequency of operation of standard P IPE interface described step 4), the ratio of abandoning meets the funtcional relationship of formula (3);
M/(M+N)=fl/fs (3)
In formula (3), M is the message number receiving continuously, the message number of N for abandoning continuously, flfor the frequency of operation of frequency reducing PIPE interface, fsfrequency of operation for standard P IPE interface;
Simultaneously, abandon the funtcional relationship that ratio also meets formula (4) and (5):
fl/fs=M/(M+N)>8/(delaytx+delaylink+delayrx+16) (4)
fl/fs>1/3 (5)
In formula (4), delaytxdelay, the delay of transmit leglinkdelay, the delay of physical linkrxtake over party's delay, delaytx, delaylink, delayrxbe all using on standard P IPE interface, send an ordered set message time as the unit interval.
The PCI Express interface chip verification method that the present invention is based on asynchronous physical layer interface has following advantage:
(1) the present invention can realize and the communicating by letter of Standard PC I Express equipment, the soft core of PCIExpress of realizing by asynchronous physical layer interface mates with the difference on the frequency between Physical layer, after employing the present invention, the transmission receiving velocity of serial link does not all change, asynchronous physical layer interface has guaranteed the compatibility with PCI Express agreement to the deletion insertion process of data, therefore can with the proper communication of PCIExpress equipment, can realize PCI Express interface chip frequency reducing hardware verification.
(2) the present invention is based on standard P IPE interface, do not increase or reduce any signal, FPGA code to be verified can directly be connected with it, do not need to do any change, therefore the soft core of PCI Express and user logic code to be verified do not need to make any modification, has advantages of and realizes simple and convenient, compatible existing test code.
(3) the present invention does not need the support of special hardware, can directly comprehensively be implemented in general FPGA verification platform with code to be verified as a module, has advantages of that versatility is good, it is simple to realize, resources occupation rate is low.
Embodiment
As shown in Figures 2 and 3, the implementation step of the PCIe interface chip hardware verification method of the present embodiment based on asynchronous physical layer interface is as follows:
1) build the FPGA hardware platform with Standard PC I Express interface, PGA hardware platform is connected with the main frame with PCI Express root node equipment by Standard PC IExpress interface;
2) between the soft core of PCI Express in PCI Express interface chip ASIC code to be verified and Physical layer, insert for the poor asynchronous physical layer interface (as shown in Figure 3) of matching frequency, asynchronous physical layer interface comprises transmission buffer zone, reception buffer zone, frequency reducing PIPE interface and standard P IPE interface, and asynchronous physical layer interface is connected with FPGA hardware platform, by standard P IPE interface, is connected with Physical layer by frequency reducing PIPE interface;
3) PCI Express interface chip ASIC code to be verified is moved to FPGA hardware platform and comprehensively realize, and according to PCI Express interface chip, the frequency of operation of frequency reducing PIPE interface is set by comprehensive highest frequency;
4) use test program is carried out functional test by FPGA hardware platform to the soft core of PCI Express and the user logic of PCI Express interface chip, when the soft core of PCI Express sends PCI Express message by asynchronous physical layer interface to Physical layer, the soft core of PCI Express writes PCI Express message by frequency reducing PIPE interface the transmission buffer zone of asynchronous physical layer interface, asynchronous physical layer interface sends to Physical layer by transmission buffer cache PCI Express message by standard P IPE interface, simultaneously when the transmission buffer zone of asynchronous physical layer interface is sky, asynchronous physical layer interface detects the state of shaking hands of link, unsuccessful if shaken hands, on standard P IPE interface, insert SKP ordered set message and compensate the difference on the frequency between the soft core of PCI Express and Physical layer, if shake hands success, on standard P IPE interface, insert the empty message of LIDLE logic and compensate the difference on the frequency between the soft core of PCI Express and Physical layer, when Physical layer sends PCIExpress message by asynchronous physical layer interface to the soft core of PCI Express, asynchronous physical layer interface detects the state of shaking hands of link, unsuccessful if shaken hands, the PCIExpress message receiving is abandoned according to the ratio between the frequency of operation of frequency reducing PIPE interface and the frequency of operation of standard P IPE interface, and the PCI Express message not abandoning is write to the reception buffer zone of asynchronous physical layer interface, if shake hands success, the type of the PCI Express message that judgement receives, when being link layer message or transaction layer message, PCI Express message writes the reception buffer zone of asynchronous physical layer interface, when being the empty message of logic, PCI Express message all abandons, asynchronous physical layer interface sends to Physical layer by reception buffer zone buffer memory PCI Express message by frequency reducing PIPE interface.
The present embodiment is (PHY Interface of PCI Express on PCI Express physical layer interface, abbreviation PIPE interface) realize frequency-dropping function, do not need to revise the soft core of PCI Express and user logic code, PCI Express after frequency reducing end equipment can and PCI Express root device between proper communication, adopt the mode of soft core to realize, resources occupation rate is low, can directly comprehensively to FPGA verification platform, realize with code to be verified.
As shown in Figure 4, the FPGA hardware platform with Standard PC I Express interface in the present embodiment is FPGA card authentication, FPGA card authentication is inserted on the PCI Express slot of server, thereby be connected with the Standard PC I Express equipment on server (with the main frame of PCI Express root node equipment) mainboard, form the FPGA hardware platform of a PCI Express interface chip FPGA verification system, so that the function of checking PCIExpress interface chip.
While the frequency of operation of frequency reducing PIPE interface being set according to PCI Express interface chip by comprehensive highest frequency in the present embodiment, step 3), the frequency of operation value rule of frequency reducing PIPE interface is suc as formula shown in (1);
fl/fs=1,4/5,3/4,7/10,2/3,3/5,1/2,2/5 (1)
In formula (1), flfor the frequency of operation of frequency reducing PIPE interface, fsfrequency of operation for standard P IPE interface.In the present embodiment, the frequency of operation f of standard P IPE interfacesfor 125MHz, fl/ fsvalue be 3/5,1/2,2/5 o'clock respectively the frequency of corresponding frequency reducing PIPE interface be 75MHz, 62.5MHz, 50MHz, can meet the soft core of PCI Express and use FPGA to carry out the frequency requirement of hardware verification.PCI Express interface chip ASIC code to be verified is moved to FPGA hardware platform while comprehensively realizing, can adopt synthesis tool comprehensively to realize, the highest frequency that can be aggregated into according to PCI Express arranges the frequency of operation of frequency reducing PIPE interface.
In the present embodiment, the reception buffer zone capacity of asynchronous physical layer interface meets the funtcional relationship of formula (2);
Cfifo>Ctlp*(1-(fl-fdllp)/fs) (2)
In formula (2), Cfifofor the capacity of reception buffer zone, Ctlpfor the transaction layer message reception buffer zone capacity (concrete numerical value and soft caryogamy are equipped with pass, are generally no more than 32KB) of the soft core of PCI Express, fdllpfor the maximum renewal frequency (concrete numerical value and soft caryogamy are equipped with pass, are generally no more than 1MHz) of data link layer message, flfor the frequency of operation of frequency reducing PIPE interface, fsfrequency of operation for standard P IPE interface.After the success of PCIe link handshake, on PIPE interface, only send the message of two types: transaction layer message (Transaction Layer Packet, be called for short TLP) and data link layer message (Data Link Layer Packet, be called for short DLLP), these two kinds of messages all write reception buffer zone as valid data, and the frequency writing is fs, by the soft core of the PCIe of frequency reducing, to be read again simultaneously, the frequency of reading is fl, because the speed that the velocity ratio of reading writes is slow, therefore have part message buffering in asynchronous PIPE interface.Data link layer message is periodically to send, and maximum renewal frequency is fdllp, therefore the speed for actual treatment TLP message is (fl-fdllp), and the transaction layer message total volume that the soft core of PCI Express can receive is received buffer capacity Ctlpas long as restriction, therefore the capacity C of reception buffer zonefifo> Ctlp* (1-(fl-fdllp)/fs), just can prevent that reception buffer zone from overflowing.
When the PCI Express message receiving is abandoned according to the ratio between the frequency of operation of frequency reducing PIPE interface and the frequency of operation of standard P IPE interface in the present embodiment, step 4), the ratio of abandoning meets the funtcional relationship of formula (3);
M/(M+N)=fl/fs (3)
In formula (3), M is the message number receiving continuously, the message number of N for abandoning continuously, flfor the frequency of operation of frequency reducing PIPE interface, fsfrequency of operation for standard P IPE interface;
The ratio that simultaneously abandons also meets the funtcional relationship of formula (4) and (5):
fl/fs=M/(M+N)>8/(delaytx+delaylink+delayrx+16) (4)
fl/fs>1/3 (5)
In formula (4), delaytxdelay, the delay of transmit leglinkdelay, the delay of physical linkrxtake over party's delay, delaytx, delaylink, delayrxbe all using on standard P IPE interface, send an ordered set message time as the unit interval.
In the present embodiment, when transmission buffer zone is sky, asynchronous physical layer interface can insert the idle message of some PCIExpress normalized definitions on standard P IPE interface: asynchronous physical layer interface is at link handshake unsuccessful front insertion SKP ordered set message also, after link handshake success, insert the empty message of LIDLE logic, with this, compensate the difference on the frequency on asynchronous physical layer interface both sides, guarantee that the data on standard asynchronous physical layer interface are not interrupted; According to PCI Express protocol specification, Standard PC I Express equipment can be abandoned after receiving idle message, and therefore inserting these messages can not affect the normal operation of Standard PC I Express equipment.Asynchronous physical layer interface writes asynchronous physical layer interface reception buffer zone by the PCI Express message receiving by standard P IPE interface.According to PCI Express standard, the PCI Express message of receiving before link handshake success is all ordered set message, in order to mate the difference on the frequency on asynchronous PIPE interface both sides, need to according to the ratio between the frequency of frequency reducing PIPE interface and the frequency of standard P IPE interface, abandon the ordered set message receiving, the ratio of abandoning meets the funtcional relationship of formula (3).Abandon the handshake procedure that part message can have influence on PCI Express agreement, according to PCI Express protocol specification, in link handshake process, state transitions need to meet two conditions: (1) receives 8 continuous handshake message, and (2) have sent 16 same messages after receiving first handshake message of the other side continuously.In order to make to abandon the handshake procedure that part message does not affect link, the highest ratio that can dropping packets meets the funtcional relationship of formula (4), in formula (4), and delaytx, delaylink, delayrxbeing respectively transmit leg, physical link, take over party's delay, is all to take on standard P IPE interface, to send an ordered set message as unit interval (the standard P IPE interface unit interval for 16bit/125MHz is 64ns).Delaylinkand delayrxbe the receive delay of link delay and Standard PC I Express equipment, conventionally unadjustable, delaytxbe the delay (comprising the delay of asynchronous PIPE module) of transmit leg, therefore by control lag umber of beats, can change lowest operating frequency.Consider the factors such as the overtime and retransmission time out of the credit of PCI Express agreement, fl/ fsminimum value should be greater than 1/3 (the corresponding minimum frequency reducing frequency of standard P IPE interface of 16bit/125MHz is 41.67MHz), has enough met the frequency requirement of the soft veritification card of PCI Express.
After link handshake success, the PCIExpress message that asynchronous physical layer interface receives has three kinds: the empty message of link layer message, transaction layer message and logic, wherein link layer message and transaction layer message are effective PCI Express data, the empty message of logic is just in order to fill the free time on link, the message that guarantees the continuity of data and send, abandoning the empty message of logic can not affect the correctness of PCIExpress data transmission.Asynchronous physical layer interface writes inner reception buffer zone by the link layer message receiving and transaction layer message, the empty message of logic all abandons, the control that the link layer message that can send due to transmit leg and transaction layer message amount are received credit, in order to prevent that receiving FIFO overflows, reception buffer zone capacity meets the funtcional relationship of formula (2).Asynchronous physical layer interface is read link layer message and transaction layer message from reception buffer zone, and sends to the soft core of PCI Experss by frequency reducing PIPE interface, when reception buffer zone is sky, sends the empty message of logic to the soft core of PCI Experss.Regulate in this way the ratio of the empty message of logic of filling between PCI Express link layer and transaction layer message, thus the difference on the frequency on asynchronous physical layer interface both sides when compensation receives.
As shown in Figure 5, in the present embodiment, asynchronous physical layer interface upwards connects the soft core of PCIExpress by frequency reducing PIPE interface, connects physical layer block downwards by standard P IPE interface, and asynchronous PLIM consists of four parts.
(1) clock module
Clock module carries out frequency division by the clock of inputting on standard P IPE interface by frequency synthesizer PLL, and the frequency reducing clock obtaining is used to the soft core of PCIExpress to be verified, and asynchronous PIPE both sides clock ratio can be got following value:
Frequency reducing PIPE clock fl/ standard P IPE clock fs=Isosorbide-5-Nitrae/5,3/4,7/10,2/3,3/5,1/2,2/5
The selection of these values is can to insert uniformly and delete message according to ratio of integers in PCI Express handshake procedure in order to guarantee, prevents that the message amount of insert continually and deletion from too much affecting PCI Express link handshake process.
(2) state and control module
State and control module realize the collection to the control of physical layer block and status signal, in PIPE interface standard, defined signal is except PHYSTATUS and RXSTATUS signal, to following signal (TXDETECTRX, POWERDOWN, TXELECIDLE, RXELECIDLE, RXPOLARITY, TXCOMPLIANCE, RXVLAID) be left intact, frequency reducing PIPE interface is directly connected with signal corresponding on standard P IPE interface; PHYSTATUS and RXSTATUS signal demand are expanded phystatus and the rxstatus signal of Physical layer output, to guarantee can to adopt this signal at clock zone at a slow speed, after expansion deration of signal ratio after rounding, should meet following relation (by phystatus and rxstatus postpone four clap or together with can meet this condition): [Tl/ Ts] > [fs/ fl], Tlthe cycle of PHYSTATUS and RXSTATUS on expression frequency reducing interface, Tsrepresent the phystatus of physical layer interface output and the cycle of rxstatus.
(3) sending module
Sending module sends to quick clock territory by the soft caryogenic data of PCI Express from clock zone at a slow speed, and sending module is divided into again following three submodules:
A) FIFO writing module: for input data being write to transmission fifo module when the TXELECIDLE invalidating signal, the distinguishing mark of input data and PCI Express type of message is compared to (ordered set is designated COM symbol simultaneously, data link layer message be designated SDP/ENDB/ENDG symbol, transaction layer message be designated STP/ENDB/ENDG symbol, the empty message of logic is complete zero), obtain the type of message PKT_TYPE of current data, according to PKT_TYPE, can judge beginning and the end of message, while running into message trailer sign, message total counter PKT_NUM adds 1 at every turn, after being converted to gray code (Gray code), PKT_NUM sends to quick clock territory for transmit control device module.
B) send fifo module: send the transmission buffer zone that fifo module is preceding method, for preserving data to be sent, sending fifo module has an empty sign prog_empty, and this empty sign prog_empty is set to 1 when remaining data bulk is less than 16 (maximum lengths of 2 ordered sets) in sending fifo module.First the data that transmit control device module is read from send fifo module also compare with the distinguishing mark of PCI Express type of message, obtain the type of message pkt_type of current data, according to beginning and the end of pkt_type judgement message, while running into message trailer sign, message total counter pkt_num adds 1 at every turn.
C) transmit control device module: for from FIFO sense data and send to Physical layer.
The course of work of transmit control device module is divided into following step:
The first step: will read useful signal and set to 0 (being rd_en=0), message is skipped total counter and set to 0 (skp_num=0);
Second step: when TXELECIDLE invalidating signal and when sending the empty sign of fifo module prog_empty and equaling 0, transmit control device module enables to send reading useful signal (rd_en equals 1) beginning sense data and sending of fifo module, until prog_empty equal 1 and the data of current output be the head (type of message pkt_type equals ordered set sign COM) of an ordered set, will read useful signal and set to 0 (rd_en equals 0) and turn the 3rd step; Or run into LIDL message and forward the 4th step to.
The 3rd step: send continuously SKP ordered set message, until prog_empty equals 0, forward second step to;
The 4th step: (sending fifo module is asynchronous FIFO if pkt_num is less than PKT_NUM, packet counting will be carried out at the end that writes and read of asynchronous FIFO simultaneously, writing end packet counting represents with PKT_NUM, reading end packet counting represents with pkt_num, by comparing the size of these two counters, can know in asynchronous FIFO and whether to also have message, so these two identical names for counter, by capital and small letter, distinguish) rd_en equal 1, sense data send to Physical layer continuously from send FIFO, when pkt_hum equals PKT_NUM, rd_en equals 0 and forwards the 5th step to,
The 5th step: send continuously LIDL message, LIDL message skp_num of every transmission adds 1 is inserted a SKP ordered set message skp_num is clear 0 when skp_num is greater than 1000, until pkt_num turns the 4th step while being less than PKT_NUM;
Once TXELECIDLE signal effectively, is got back to the first step in above-mentioned steps.
(4) receiver module
Receiver module is divided into following three submodules:
A) receive controller module: receive after controller module (RECV_CONTROLLER) filters the data that receive and write reception fifo module.
The course of work that receives controller module is divided into following step:
The first step: the distinguishing mark that receives data and type of message is compared to (ordered set is designated COM symbol, DLLP is designated SDP/ENDB/ENDG symbol, TLP is designated STP/ENDB/ENDG symbol, the empty message of logic is complete zero), thereby obtain the type of message rxpkt_type of current data, according to rxpkt_type, can judge that the current data that receive are start of message (SOM), end or in the middle of message;
Second step: the data of receiving if current are ordered set heading (being rxpkt_type=COM), start to receiving in fifo module, to write M ordered set message (write enable signal wt_en and equal 1) continuously, then abandon N ordered set message (write enable signal wt_en and equal 0), if the data of receiving are logic sky messages, forward the 3rd step to;
The 3rd step: write continuously the empty message (write enable signal wt_en and equal 1) of M logic in reception FIFO, then abandon the empty message (write enable signal wt_en and equal 0) of N logic, until current data is data link layer heading, forward the 4th step to;
The 4th step: if what receive is that ordered set message forwards second step to, if data link layer message or transaction layer message write reception fifo module, if the empty message of logic and current data are not that DLLP or transaction layer message abandon;
Once the rxelecidle of Physical layer output effectively, directly gets back to the first step in above-mentioned steps implementation.
B) receive fifo module: receive the reception buffer zone that fifo module is preceding method, receiving fifo module is the asynchronous FIFO of standard, receive fifo module correspondence and be provided with one for recording the sky sign empty of storage dummy status, after the total data in receiving fifo module is read out, sky is indicated to empty puts 1.
C) FIFO reads module: when sky sign empty equals 0, receive FIFO to read enable signal effective, the data of reading from receive fifo module are directly exported, the empty message LIDL of output logic when sky sign empty equals 1.
The above is only the preferred embodiment of the present invention, and protection scope of the present invention is also not only confined to above-described embodiment, and all technical schemes belonging under thinking of the present invention all belong to protection scope of the present invention.It should be pointed out that for those skilled in the art, some improvements and modifications without departing from the principles of the present invention, these improvements and modifications also should be considered as protection scope of the present invention.