A kind of method being applicable to DS-1 frame receiver side and resolving
Technical field
The invention belongs to the PDH communications field, be specifically related to DS-1 frame receiver side analytic method, and realize the chip, UE, instrument etc. of said function.
Background technology
DS-1 transmission system is early stage PDH communication system, and it is compounded in 24 railway digital voice channels in the IA High Speed Channel of a 1.544Mb/s by the principle of time-division multiplex.The frame format of compound is by ITU-T G.704 standard definition.It comprises 24 DS0 (64kbps) time slots, numbers from 1 to 24, each time slot 8bit, altogether 192bit position.The basic frame of DS-1 frame also comprises a F bit (framing bit), as frame lock bit, represents that present frame terminates the beginning with next frame.Therefore a complete DS-1 frame comprises 1 frame lock bit and 24 time slots totally 193 bits, and this code stream is serial code stream, and previous frame and next frame are closely connected does not have space, as shown in Figure 4.DS-1 frame is resolved and is relied on DS multi-frame to parse frame synchronization sequence, thus orients frame lock bit.
ITU-T is standard definition two kinds of DS-1 frame multiple connection modes G.704, are respectively SF frame and ESF frame.
SF frame format is as table one:
Table one
ESF frame format is as table two:
Table two
DS-1 receiver side analytic method is namely in one group of serial sequence, and the multi-frame form G.704 specified according to ITU-T extracts F bit sequence, thus location DS-1 frame.In brief, if 24 F bits that can extract wherein meet the multi-frame sequence that G.704 ITU-T specifies, then think and can locate DS-1 frame.According to ITU-T G.704,24 F bit sequences of SF frame are: 1000_1101_1100_1000_1101_1100, ESF frame 24 bit sequences are: xxx0_xxx0_xxx1_xxx0_xxx1_xxx1, wherein x represents arbitrary value.
Because DS-1 frame only relies on this 1 bit to be used as frame alignment, current existing scheme major part is based on traversal search, consuming time longer.
Summary of the invention
The object of the invention is to solve problem longer due to the parsing time adopting tradition solution frame method to bring in DS-1 receiver, the invention provides a kind of method of fast resolving DS-1 frame.
Provided by the inventionly be applicable to DS-1 frame receiver side fast resolving method, comprise following steps:
1st, the signal of telecommunication in line side is converted to the serial digital sequence of logic side after the PHY process of line side, and transfers to programmable logic array (FPGA).By programmable logic array (FPGA), the Serial No. obtained being stored in RAM, in order to reach the object of quick-searching DS-1 frame, following process being done to RAM:
1.1st, to arrange RAM be address bus bit wide is 13 bits.
1.2nd, high 5 bits are as the base address of each basic Frame storage, and according to ITU-T standard regulation, DS-1 multi-frame is up to 24 frames, therefore chooses the base address of 5 bits as basic frame, meets:
2
5>24。
1.3rd, low 8 bits are as the memory address of basic each bit of frame, and according to ITU-T standard regulation, the basic frame of DS-1 is 193 bits, meets:
2
8>193。
Mode of operation is as follows, arranges a counter, and low 8 bit each clock cycle of address, from adding, make zero during counter counts to 193, namely makes zero during a complete DS-1 frame.And high 5 bits add 1 simultaneously, by that analogy.Rely on such storage mode, obtain the storage array that is similar to matrix.Each row of matrix are a basic frame of DS-1, and every a line of matrix is then the combination of the bit of different DS-1 frame same positions.By the control to address ram, read RAM according to the row of matrix.Mode of operation is as follows: arrange a counter, and when reading RAM, from adding, least-significant byte remains unchanged high 5 of address, when counter counts to 24, then represents and have read a line.If read the next line of matrix, then the least-significant byte controlling address ram adds 1.
2nd, by carrying out parallel traversal search to RAM, obtain the X of DS-1 frame, Y-coordinate;
Parallel traversal search method is that the RAM of 193 row obtained by the 1st step is divided into 5 intervals, by the characteristic sequence of 5 search engine parallel search compound DS-1 frames, to reach the object shortening search time, and finally finds the sequence of compound standard in a matrix.
Build sequence search circuit by FPGA, searching method is as follows:
2.1st, read RAM by row, if the sequences match of 24 bit values obtained and ITU-T standard definition, then retain current location; If do not mated with the sequence of ITU-T standard definition, then shifting function is carried out to 24 bit values read.Still there is no after 24 times if be shifted that the match is successful, then read next line data, so repeatedly, until travel through whole 193 row data.
2.2nd, in order to acceleration detection process, adopt parallel search mode.According to above-mentioned Cleaning Principle, coupling 193x24=4632 time is needed under limiting case, in order to the match is successful at short notice, 193 row data are divided into 5 regions of search, each interval parallel search, if the match is successful in search, then retain current line position (Y-axis position), column position (X-axis position), carries out duplicate acknowledgment operation to follow-up DS-1 multi-frame, to prevent random bearer service data by chance identical with the sequence of standard definition.If follow-up multi-frame is at same position, still the match is successful, then think that DS-1 multi-frame detects successfully.The number of times of duplicate acknowledgment can carry out different settings according to different load patterns, until find line position and a column position accurately.
3rd, utilize the X obtained, Y-coordinate extracts DS-1 frame sequence.Transmission form due to DS-1 frame is continuous and end to end, and the starting point therefore writing RAM in the 1st step is random selecting, and system does not also know the starting point of random selecting and the side-play amount of DS-1 frame multi-frame head.So namely the object of this step utilizes the X obtained in the 2nd step, Y-coordinate value obtains the write starting point of RAM and the side-play amount of DS-1 frame multi-frame head.Specific operation process is:
3.1 arrange a counter in FPGA, and this counter clear when first time write RAM time, then often writes this counter of 1 bit and add 1, until write 193 bits, namely this counter O reset during a DS-1 frame frame length, and so forth.The object of this counter is the relative position of the starting point of record random selecting.
3.2 obtain matrix X, the coordinate figure of Y in the 2nd step.By the definition before us, the line number of X representing matrix, the distance of this line number and the first row represents the starting point of random selecting and the side-play amount of the starting point of multi-frame in a DS-1 frame, and this value is less than 193; The columns of Y representing matrix, the distance of this columns and first row represents the number of the starting point of random selecting and the starting point DS-1 frame apart of multi-frame, and this value is less than 24; As from the foregoing: the position D of the starting point of the original position distance write RAM of DS-1 multi-frame is:
D=Y×193+X。
Advantage of the present invention and beneficial effect:
The present invention passes through matrix form storage mode by data stored in RAM in programmable logic array (FPGA), and employing parallel search method accelerates DS-1 frame testing process.
Accompanying drawing illustrates:
Fig. 1 is DS-1 frame detection system block schematic illustration;
Fig. 2 is the signal flow graph that DS-1 frame detects;
Fig. 3 is that RAM matrix form stores schematic diagram;
Fig. 4 is DS-1 frame code stream schematic diagram;
Fig. 5 is search routine schematic diagram;
Fig. 6 demarcates DS-1 multi-frame starting point schematic diagram by matrix coordinate point;
Fig. 7 writes RAM and emulates schematic diagram;
Fig. 8 reads RAM and emulates schematic diagram;
Fig. 9 is shifted and mates emulation schematic diagram;
Figure 10 coordinate extracts frame head emulation schematic diagram.
Embodiment
Below in conjunction with accompanying drawing and example, describe technical scheme of the present invention in detail.All the elements of the present invention realize all in FPGA, and FPGA model is the XC6SLX45 of the Spartan6 series of Xilinx.In order to realize all details of the present invention in limited resource, on algorithm of the present invention under the prerequisite not affecting performance, carry out there is suitable simplification.
1st, obtain DS-1 frame code stream through PHY, stream rate is 1.544Mhz.FPGA inside adopts and is stored in RAM by the code stream obtained according to matrix form storage means with road clock, and under the consideration of comprehensive resources and performance, this programme adopts width to be 1, and the degree of depth is that the block RAM of 8192 is as storage medium.Clock is write using this line clock and 1.544Mhz clock as RAM.A DS-1 multi-frame is made up of 24 DS-1 frames, and each DS-1 frame is made up of 193bit, therefore arranges two counters at FPGA, and counter 1 calculates the number of each bit in DS-1 single frames, and counter 2 calculates the number of DS-1 frame.Counter 1 is zero after meter to 193, and represent and be filled with a DS-1 frame, unison counter 2 adds 1, so repeatedly until be filled with 24 DS-1 frames.The simulation waveform of FPGA is shown in Fig. 7, and writing clock is line clock, and when writing the first frame, a write address high position is 0, and low level adds 1, and when writing the second frame, high 5 add 1, and low level zero is again from adding, and in figure, address is that 16 systems represent.Finally can obtain storage array as shown in Figure 3.This matrix column is determined by the least-significant byte of address ram, and the row of this matrix is determined by high 5 of address ram.Citing, A1 in figure, 1 is first row the first row, and address is 13 ' b0_0000_0000_0000 (FPGA counts from 0), A2,1 is the second row first row, address is 13 ' b0_0000_0000_0001, A3, and 2 is the third line secondary series, address is 13 ' b0_0010_0000_0001, by that analogy.
In write operation process, the position of first point in whole DS-1 multi-frame of write is random, and namely we do not know this which frame in multi-frame, do not know that this point is which bit of 193 bits in DS-1 frame yet.Although this position in frame is random, in FPGA, need the position of this point to record.Method is for arranging a counter, and with this point for starting point, counter is 0, and whenever this counter of data of coming in is from adding 1, when filling it up with a DS-1 multi-frame, namely after 193x24 bit, this counter clear does from adding again, and so forth.With this counter coordinate the most, its objective is the position of the point of record first write RAM, as the reference coordinate calculating frame head.How operation below finds the start position of DS-1 multi-frame from sequence by explaining, the coordinate that subsequent operation obtains is the relative displacement of this coordinate.
Have an other road clock in this programme FPGA as system clock, clock frequency is 60Mhz, and this programme reads clock using this clock as RAM.According to matrix form storage means, the data in RAM are read by row, and deliver to match search circuit.The process read is as follows, and arrange a counter, a line due to matrix has 24, therefore resets after this counter counts to 24, represents a line that have read matrix.Mention in previous step, this matrix column is determined by the least-significant byte of address ram, and the row of this matrix is determined by high 5 of address ram.Therefore address control method is, keep the least-significant byte of address constant, namely row remain unchanged, and high 5 are carried out from add operation, count and reset after 24, represent and have read a line 24 bits.If read next line, then the least-significant byte of address adds 1.For reading the emulation schematic diagram of the first row in Fig. 8, wherein reading clock is system clock, reads address least-significant byte constant, and high 5 add certainly, and in figure, address is that 16 systems represent.
The bit of the same position of 24 DS-1 frames that what a line 24bit 2nd, read in previous step represented is.So-called same position refers to and to offset relative to the position of frame lock bit (F bit).Therefore 24 bits obtained can be compared with the DS-1 sequence head that ITU-TG.704 defines.Owing to can not determine which DS-1 frame is first frame in multi-frame, need to carry out shifting function in comparison procedure.Identifying code is:
assign a[23:0]={b[22:0],b[23]};
Wherein b is the sequence before displacement, and a is the sequence after displacement.If the sequence read from RAM is not mated with the sequence of standard definition, then need to carry out shifting function, comparison again after displacement.If be shifted after 24 times still cannot with the sequences match of standard definition, then illustrate and do not comprise DS-1 frame head in this line, need the next line reading RAM to compare.
If at multi-shift, repeatedly obtain matching sequence after line feed operation, then the line number of current reading is the Y value of matrix, and the number of times of displacement is the X value of matrix, and the coordinate of this matching sequence is: (X, Y).In fig .9, S_shift_line_data is the data read from RAM, and these data carry out a shifting function in each clock cycle, if the sequence that G.704 sequence obtained and ITU-T define is identical, then by correlating markings position 1.In figure, when
S_shift_line_data==24’b000110111001_000110111001
Time, S_head_flag_sf puts 1, shows SF frame sequence head to be detected.Obtain the coordinate of current location, S_sync_pos_x, S_sync_pos_y show X-coordinate and the Y-coordinate of current location respectively simultaneously, and the coordinate of X is the coordinate of 90, Y is here 1.
Still need to carry out duplicate acknowledgment operation after obtaining the DS-1 sequence head that G.704 ITU-T define.Because the business code flow of DS-1 frame carrying is random, the situation that may run into is that the sequence that random code stream forms is by chance identical with the sequence of standard definition, so then can cause erroneous judgement.Therefore need record matching coordinate after coupling, carry out repeated matching by after storage RAM refresh at same position.Still can successful match if repeatedly to repeat relatively, then can think and find DS-1 multi-frame head.The number of times of repeated matching the random degree of reference code shape can carry out different settings.Overall search routine figure as shown in Figure 5.In brief, utilize matrix form storage mode, by row write RAM, read RAM by row, often read and once carry out matching ratio comparatively, if mate unsuccessful, carry out shifting function, and then carry out matching ratio comparatively.If be shifted, 24 rear discoveries still can not the match is successful, then read the next line data in RAM, so repeatedly.If the match is successful, then record current (X, Y) coordinate figure, carry out duplicate acknowledgment operation.
Parallel search circuit is more, and the speed of search is faster, but the resource taken is also more, and this programme comprehensive resources considers employing five groups of match search circuit parallel search.Five groups of match search circuit difference searching matrix formulas store 0th ~ 39 row, 40 ~ 79 row, 80 ~ 119 row, 120 ~ 159 row, 160 ~ 193 row of RAM.If search out the DS-1 sequence head that G.704 ITU-T defines, carry out duplicate acknowledgment operation.If confirm successfully, then preserve current X, Y-coordinate value stops other match search circuit workings simultaneously.After adopting five groups of parallel search circuit, every group searching circuit searches at most 40 row data, can accelerate the process of match search, complete coupling at short notice.In the limiting case, namely find matching sequence when reading 193 row, then the method for this parallel search will than fast 5 times of traversal search line by line.
3rd, by the X that match search electric circuit inspection arrives, Y-coordinate value is demarcated as the original position of DS-1 multi-frame.Scaling method is as follows, in figure 6, supposes that (3, the 4) position shown in figure is the matching sequence coordinate figure obtained, namely
X=3,
Y=4,
Owing to have recorded the position of write starting point in step one, then in the serial sequence of whole DS-1 multi-frame, the position D of the starting point of the original position distance write RAM of DS-1 multi-frame is:
D=Y×193+X。
The method of such acquisition DS-1 multi-frame initial point position is as follows: in FPGA, arrange a counter, when the position of first step write starting point, this counter is 0, do from add operation whenever FPGA receives this counter of bit, when the value of this counter equals the moment of D, the bit that FPGA receives is then the starting point of whole DS-1 multi-frame.In the simulation waveform of Figure 10, S_frame_cnt is frame count, and from 0 to 192, altogether 193bit, i.e. a complete DS-1 frame, S_frame_num is a frame counting number, and sign has how many DS-1 frames.Work as S_frame_num=0, be first data of write RAM during S_frame_cnt=0, the counter of S_frame_cnt and S_frame_num composition is above-mentioned reference coordinate simultaneously.We have known that in previous step the coordinate of X-axis is 90, and Y-axis coordinate is 1, and namely the position of distance first write point distance 1 DS-1 frame 90 bit is DS-1 multi-frame head, and O_t1_data_pulse is the mark of this position.
Because the frame length of each DS-1 frame is fixed as 193 bits, therefore with this multi-frame original position for basic point, every the starting point that 193 bits are next DS-1 frame, and so forth, the F bit in DS-1 frame can be located from the DS-1 code stream of input, and the position of multi-frame head, thus reach the object of resolving each time slot.