Abstract:
A bit rate converter capable of avoiding slip of data in a memory for use in bit rate adjustment is disclosed. A phase comparator compares a write address and a read address of the memory to produce a phase difference. The write address is ahead of the read address in the memory. A stuffing rate controller selects one of a plurality of preset fixed stuffing rates depending on the phase difference. A stuff pulse inserter inserts a stuff pulse into readout data from the memory at the selected stuffing rate. When normally operating, a normal fixed stuffing rate is selected. When the phase difference is small than a lowest threshold value, a higher fixed stuffing rate is selected. When the phase difference is greater than a highest threshold value, a lower fixed stuffing rate is selected.

Description:
BACKGROUND OF THE INVENTION 
   1. Field of the Invention 
   The present invention relates to a bit rate converter for converting the fixed bit rate of an input signal to a different bit rate. 
   2. Description of the Related Art 
   Bit rate converters have been widely used in transmission systems and digital data processing systems. Consider the case where an input signal of a fixed bit rate is converted to a higher bit rate signal structured in frames and having an overhead (OH) and a redundancy code included therein. The input signal is written on a buffer memory according to a write clock of the fixed bit rate. The written signal is read out in frames from the buffer memory according to a read clock of the higher bit rate while adding an overhead (OH) and a redundancy code thereto. At a receiver end, the overhead and redundancy code are terminated and the high bit rate of the received data is converted to the original fixed bit rate. 
   In addition, there have been known pulse stuffing techniques to insert one or more stuff pulses in the frames based on a phase difference between a write timing and a read timing achieve bit rate adjustment. For example, see U.S. Pat. Nos. 4,920,547 and 5,276,688. 
   In general, the phase difference is monitored by a phase comparator comparing the write address and the read address on the buffer memory. The phase difference varies in a period of the frame. More specifically, when the written data are read out from the buffer memory according to the read clock of the higher bit rate, the phase difference becomes smaller because the frequency of the read clock is higher than that of the write clock. When the read clock stops to insert the overhead and redundancy code, the phase difference increases sharply because the data writing is continuously performed according to the write clock. Accordingly, the phase difference varies in such a manner from frame to frame (see FIG.  5 B). 
     FIG. 5B  shows a time-varying phase difference in the case of n-bit butter memory used for bit rate adjustment. As shown in  FIG. 5B , when the input signal is normally received, a phase difference varies in a period of one frame within a predetermined proper range having a center phase difference of n/2. In such a case, the bit rate adjustment is normally performed without any error or data slipping. 
   In the event that the write clock of the fixed bit rate stops due to some failure, the phase difference reduces sharply because the readout operation is continuously performed according to the read clock of the higher bit rate. Finally, the phase difference becomes zero, resulting in underflow status (see FIG.  6 B). 
   Contrarily, there are cases where the phase difference reaches the depth (n-bit) of the buffer memory due to jitter or wander of the write clock, resulting in overflow status. 
   According to the conventional circuit, however, in a case of such an overflow or underflow status, the phase difference is forced to be reset to the initial value of n/2. Such a reset operation causes the data written in the buffer memory to be cleared. Therefore, some data slips away from the buffer memory, leading to error status. 
   SUMMARY OF THE INVENTION 
   An object of the present invention is to provide a bit rate converter and a control method thereof, which are capable of avoiding slip of data in a memory for use in bit rate adjustment. 
   According to the present invention, a bit rate converter includes: a memory for storing input data of a fixed bit rate; a memory controller for controlling the memory such that the input data are sequentially written into the memory according to a write clock and written data are sequentially read out from the memory according to a read clock having a frequency different from that of the write clock; a phase comparator for comparing a write address and a read address of the memory to produce a phase difference, wherein the write address is ahead of the read address in the memory: a stuffing rate controller for selecting one of a plurality of preset fixed stuffing rates depending on the phase difference; and a stuff pulse inserter for inserting a stuff pulse into readout data from the memory at the selected stuffing rate. 
   The plurality of preset fixed stuffing rates may include a normal fixed stuffing rate, at least one higher fixed stuffing rate, and at least one lower fixed stuffing rate, wherein the stuffing rate controller normally selects the normal fixed stuffing rate, selects a higher fixed stuffing rate when the phase difference is small than a first threshold value, and selects a lower fixed stuffing rate when the phase difference is greater than a second threshold value that is greater than the first threshold value. 
   The stuffing rate controller may be previously provided with a plurality of threshold values including a lowest threshold value and a highest threshold value within a predetermined range of the memory, wherein the plurality of preset fixed stuffing rates consists of a normal fixed stuffing rate, a higher fixed stuffing rate, and a lower fixed stuffing rate, wherein the stuffing rate controller normally selects the normal fixed stuffing rate, selects the higher fixed stuffing rate when the phase difference is small than the lowest threshold value, and selects the lower fixed stuffing rate when the phase difference is greater than the highest threshold value. 
   The stuffing rate controller may be previously provided with a plurality of threshold values including a lowest threshold value and a highest threshold value within a predetermined range of the memory, wherein the stuffing rate controller forcefully resets the memory and the memory controller when the phase difference exceeds one of the lowest and highest threshold values. 
   The plurality of threshold values may further include a lower threshold value and a higher threshold value within the predetermined range of the memory, wherein the plurality of preset fixed stuffing rates consists of a normal fixed stuffing rate, a higher fixed stuffing rate, and a lower fixed stuffing rate, wherein the stuffing rate controller normally selects the normal fixed stuffing rate, selects the higher fixed stuffing rate when the phase difference is small than the lower threshold value, and selects the lower fixed stuffing rate when the phase difference is greater than the higher threshold value. 
   According to an embodiment of the present invention, a bit rate converter includes: a memory for storing input data of a fixed bit rate; a write address counter for counting a write address according to a write clock of the fixed bit rate; a read address counter for counting a read address according to a read clock; a memory controller for controlling the memory such that the input data are sequentially written into the memory according to the write address and written data are sequentially read out from the memory according to the read address; a phase comparator for comparing the write address and the read address of the memory to produce a phase difference, wherein the write address is ahead of the read address in the memory; a stuffing rate controller for selecting one of a plurality of preset fixed stuffing rates depending on the phase difference; a stuff pulse inserter for inserting a stuff pulse into readout data in frames from the memory at the selected stuffing rate; and a read clock generator for generating the read clock by decimating a clock pulse corresponding to the stuff pulse from a clock of a higher bit rate. 
   According to another aspect of the present invention, a control method of a bit rate converter having a memory for storing input data of a fixed bit rate; and a memory controller for controlling the memory such that the input data are sequentially written into the memory according to a write clock and written data are sequentially read out from the memory according to a read clock, the method includes the steps of: a) comparing a write address and a read address of the memory to produce a phase difference, wherein the write address is ahead of the read address in the memory, b) selecting one of a plurality of preset fixed stuffing rates depending on the phase difference; and c) inserting a stuff pulse into readout data from the memory at the selected stuffing rate. 
   The plurality of preset fixed stuffing rates may include a normal fixed stuffing rate, at least one higher fixed stuffing rate, and at least one lower fixed stuffing rate. In this case, the step (b) may include the steps of: when the input data is normally received, selecting the normal fixed stuffing rate; when the phase difference is small than a first threshold value, selecting a higher fixed stuffing rate; and when the phase difference is greater than a second threshold value that is greater than the first threshold value, selecting a lower fixed stuffing rate. 
   The plurality of preset fixed stuffing rates may include a normal fixed stuffing rate, a higher fixed stuffing rate, and a lower fixed stuffing rate, wherein the method further includes the step of: previously storing a plurality of threshold values including a lowest threshold value, a lower threshold value, a higher threshold value, and a highest threshold value within a predetermined range of the memory. The step (b) may include the steps of: b. 1 ) when the input data is normally received, selecting the normal fixed stuffing rate; b. 2 ) when the phase difference is small than the lowest threshold value, selecting the higher fixed stuffing rate; and b. 3 ) when the phase difference is greater than the highest threshold value, selecting the lower fixed stuffing rate. 
   The step (b) may further include the steps of: b. 4 ) when the phase difference exceeds the higher threshold value after the higher fixed stuffing rate is selected at the step (b. 2 ), selecting the normal fixed stuffing rate; and b. 5 ) when the phase difference is lower than the lower threshold value after the lower fixed stuffing rate is selected at the step (b. 3 ), selecting the normal fixed stuffing rate. 
   As described above, a phase difference is monitored at all times and the stuff pulse insertion is normally executed at the normal fixed stuffing rate. When the phase difference is about to underflow, the stuff pulse insertion is executed at the higher fixed stuffing rate. When the phase difference is about to overflow, the stuff pulse insertion is executed at the lower fixed stuffing rate. Accordingly, by controlling the fixed stuffing rate as described above, the phase difference can be continuously restored to a proper range without the need of memory reset. In other words, the data stored in the memory can be prevented from destroying due to memory reset, resulting in improved robustness. 
   Further, in the event that a very large variation in phase difference occurs such that selection of fixed stuffing rates cannot cope with the variation, the phase difference is reset back to proper values immediately. In this case, although data stored in the memory are destroyed, the circuit operation can be restored immediately after such a very large noise causes an unusual change of the phase difference, resulting in enhanced reliability. 

   
     BRIEF DESCRIPTION OF THE DRAWINGS 
       FIG. 1  is a block diagram showing a bit rate converter according to a first embodiment of the present invention; 
       FIG. 2  is a schematic diagram showing insertion of a stuff bit in a higher bit rate signal according to the present invention; 
       FIG. 3  is a diagram showing threshold values used to determine how to change a stuffing rate according to the first embodiment; 
       FIG. 4  is a flow chart showing an operation of hanging a stuffing rate according to the first embodiment; 
       FIG. 5A  is a diagram showing a time-varying phase difference in a normal status when a stuffing rate is set to α=½; 
       FIG. 5B  is a diagram showing a time-varying phase difference in a normal status in a conventional bit rate converter; 
       FIG. 6A  is a diagram showing a time-varying phase difference in the first embodiment in a case where a write clock stops due to external noise when a stuffing rate is set to α=½ or β=1; 
       FIG. 6B  is a diagram showing a time-varying phase difference in a case where a write clock stops in a conventional bit rate converter; 
       FIG. 7A  is a diagram showing a time-varying phase difference in the first embodiment in a case where a write clock increases in frequency due to external noise when a stuffing rate is set to α=½ or β=1; 
       FIG. 7B  is a diagram showing a time-varying phase difference in a case where a write clock increases in frequency in a conventional bit rate converter: 
       FIG. 8  is a block diagram showing a bit rate converter according to a second embodiment of the present invention; 
       FIG. 9  is a diagram showing threshold values used to determine how to change a stuffing rate according to the second embodiment; 
       FIG. 10  is a diagram showing a time-varying phase difference in the second embodiment in a case where a write clock stops due to external noise when a stuffing rate is set to α=½ or β=1; and 
       FIG. 11  is a diagram showing a time-varying phase difference in the second embodiment in a case where a write clock increases in frequency due to external noise when a stuffing rate is set to α=½ or β=1. 
   

   DESCRIPTION OF THE PREFERRED EMBODIMENTS 
   First Embodiment 
   Referring to  FIG. 1 , a bit rate converter according to a first embodiment is provided with a memory  1 , a write address counter  2 , a read address counter  3 , a phase comparator  4 , a frame insertion circuit  5 , and a frame timing generator  6 . 
   The memory  1  is a n-bit buffer memory such as a shift register for temporarily storing a lower bit rate signal so as to perform bit rate conversion. The lower bit rate signal is written on the memory  1  according to a write address that is generated by the write address counter  2  using a clock CLK L  of the lower bit rate signal. The written signal is read out from the memory  1  according to a read address that is generated by the read address counter  3  using a decimated clock received from the frame timing generator  6 . 
   The readout signal is output to the frame insertion circuit  5 , by which necessary information such as overhead, redundancy code, and stuff pulses are inserted according to a frame timing to produce a higher bit rate signal. The frame timing generator  6  generates the decimated clock and the frame timing based on a clock CLK R  of the higher bit rate signal and a fixed stuff insertion instruction as described later. 
   The write address and the read address are also output to the phase comparator  4 . The phase comparator  4  compares the write address and the read address to produce a phase difference M on the memory  1 . Since the write address is normally ahead of the read address, a phase difference M is obtained by subtracting the read address from the write address. 
   Fixed Stuffing Rate Control 
   The bit rate converter is further provided with a fixed stuffing rate controller  7  and a fixed stuff insertion circuit  8 . The fixed stuffing rate controller  7  selects one of a plurality of predetermined fixed stuffing rates depending on a phase difference M received from the phase comparator  4 . More specifically, a plurality of threshold values are previously set in the fixed stuffing rate controller  7 . The fixed stuffing rate controller  7  selects one of the predetermined fixed stuffing rates depending on a comparison result between each of the threshold values and the phase difference M. In this embodiment, four threshold values TH 1   a , TH 2   a , TH 2   b , and TH 1   b  are previously set (see FIG.  3 ). 
   As described later, the predetermined fixed stuffing rates are here three different fixed stuffing rates: α, β, and γ (γ&lt;α&lt;β). If a normal fixed stuffing rate α is selected, the cycle of stuff pulse insertion is set to a proper interval and thereby the phase difference M falls Into a proper range because the read clock stops with normal frequency. If a large fixed stuffing rate β is selected, the cycle of stuff pulse insertion is shortened and thereby the phase difference M starts increasing on average because the read clock stops more frequently. Contrarily, if a small fixed stuffing rate γ is selected, the cycle of stuff pulse insertion elongates and thereby the phase difference M starts decreasing on average because the read clock stops less frequently. 
   The fixed stuff insertion circuit  8  outputs a fixed stuff insertion instruction corresponding to the selected fixed stuffing rate to the frame insertion circuit  5  and the frame timing generator  6 . 
   The frame timing generator  6  receives the fixed stuff insertion instruction and the clock CLK K  of the high bit rate signal to output a decimated clock to the read address counter  3  and an insertion timing clock to the frame insertion circuit  5 . The decimated clock is obtained by removing clock pulses corresponding to the inserted information including the overhead, redundancy code and stuff pulses from the higher bit rate clock CLK B  of a frame. Accordingly, the frame insertion circuit  5  inserts the overhead and the redundancy code into the readout signal and further stuff pulses into the readout signal according to the insertion timing clock. 
   As shown in  FIG. 2 , the overhead and the redundancy code are inserted into predetermined positions in each frame of the higher bit rate signal, respectively. In addition, a stuff pulse is also inserted into the readout signal in a controlled cycle determined by the selected fixed stuffing rate. 
   Referring to  FIG. 3 , four threshold values TH 1   a , TH 2   a , TH 2   b , and TH 1   b  are previously set such that TH 1   a &lt;TH 2   a &lt;TH 2   b &lt;TH 1   b . A range from TH 2   a  to TH 2   b  is set to a proper range having a center phase difference of n/2, A range from TH 1   a  to TH 2   a  is set to an acceptable range and a range from 0 to TH 1   a  is set to a critical range. A range from TH 2   b  to TH 1   b  is set to an acceptable range and a range from TH 1   b  to n is set to a critical range. The fixed stuffing rate controller  7  controls a fixed stuffing rate depending on which of the allocated ranges a current phase difference falls into. The details of the fixed stuffing rate control operation will be described hereafter with reference to  FIGS. 4-7 . 
   Referring to  FIG. 4 , when a phase difference M falls into one of the acceptable or proper ranges, that is, TH 1   a &lt;M&lt;TH 1   b , the fixed stuffing rate controller  7  selects the normal fixed stuffing rate α (step S 1 ). In the case where no external noise occurs, the phase difference M periodically varies within the depth (n) of the memory  1  having a center of n/2 as shown in FIG.  5 A. Accordingly, no data slips away. In the normal status as shown in  FIG. 5A , since the fixed stuffing rate is set to α=½, the stuff pulse insertion is performed every two frames. In other words, the normal fixed stuffing rate α is kept as long as TH 1   a &lt;M&lt;TH 1   b  (step S 2 ). 
   When a phase difference M shifts toward underflow to enter a critical region (M&lt;TH 1   a  in step S 2 ) due to occurrence of external noise such as jitter, wander, or phase jump as shown in  FIG. 6A , the fixed stuffing rate controller  7  changes the normal fixed stuffing rate from α to β (step S 3 ). 
   As shown in  FIG. 6A , since the selected normal fixed stuffing rate β is greater than the previous fixed stuffing rate α, the cycle of stuff pulse insertion is shortened and thereby the phase difference M gradually increases toward the center value of n/2 on average because the read clock stops more frequently. Here, since the fixed stuffing rate is set to β=1, the stuff pulse insertion is executed every frame. Thereafter, when the phase difference M exceeds the threshold TH 2   b  (TH 2   b &lt;M in step S 4 ), the fixed stuffing rate controller  7  sets the fixed stuffing rate back to α=½ (step S 1 ). Unless the phase difference M exceeds the threshold TH 2   b  (TH 2   b &gt;M in step S 4 ), the selected normal fixed stuffing rate β is maintained. 
   When a phase difference M shifts toward overflow to enter a critical region (M&gt;TH 1   b  in step S 2 ) due to occurrence of external noise as shown in  FIG. 7A , the fixed stuffing rate controller  7  changes the normal fixed stuffing rate from α to γ (step S 5 ). 
   As shown in  FIG. 7A , since the selected normal fixed stuffing rate γ is smaller than the previous fixed stuffing rate α, the cycle of stuff pulse insertion is elongated and thereby the phase difference M gradually decreases toward the center value of n/2 on average because the read clock stops less frequently. Here, since the fixed stuffing rate is set to γ=0, the stuff pulse insertion is not executed. Thereafter, when the phase difference M becomes smaller than the threshold TH 2   a  (TH 2   a &gt;M in step S 6 ), the fixed stuffing rate controller  7  sets the fixed stuffing rate back to α (step S 1 ). When the phase difference M is not smaller than the threshold TH 2   a  (TH 2   a &lt;M in step S 6 ), the selected normal fixed stuffing rate γ is maintained. 
   In this manner, a phase difference M is monitored at all times and the stuff pulse insertion is normally executed at the fixed stuffing rate α. When the phase difference M is about to underflow, the stuff pulse insertion is executed at the larger fixed stuffing rate β. When the phase difference M is about to overflow, the stuff pulse insertion is executed at the smaller fixed stuffing rate γ. Accordingly, by controlling the fixed stuffing rate, the phase difference M can be continuously restored to the vicinity of the center of n/2 without the need of memory reset. In other words, the data stored in the memory  1  can be prevented from destroying due to memory reset, resulting in improved robustness. 
   Second Embodiment 
   Referring to  FIG. 8 , the circuit configuration of a bit rate converter according to a second embodiment is the same as that of the first embodiment as shown in  FIG. 1  except that a fixed stuffing rate controller  7 A can forcefully reset the memory  1 , the write address counter  2 , and the read address counter  3 . Therefore, circuit blocks similar to those previously described with reference to  FIG. 1  are denoted by the same reference numerals and their descriptions are omitted. 
   Referring to  FIG. 9 , six threshold values THRa, TH 1   a , TH 2   a , TH 2   b , TH 1   b , and THRb are previously set such that THRa&lt;TH 1   a &lt;TH 2   a &lt;TH 2   b &lt;TH 1   b &lt;THRb. A range from TH 2   a  to TH 2   b  is set to a proper range having a center phase difference of n/2. A range from TH 1   a  to TH 2   a  is set to an acceptable range, a range from THRa to TH 1   a  is set to a critical range, and a range from 0 to THRa is set to a reset trigger range. Similarly, a range from TH 2   b  to TH 1   b  is set to an acceptable range, a range from TH 1   b  to THRb is set to a critical range, and a range from THRb to n is set to a reset trigger range. The fixed stuffing rate controller  7  controls a fixed stuffing rate depending on which of the allocated ranges a current phase difference falls into. 
   When a phase difference M falls into the range from THRa to THRb, the fixed stuffing rate controller  7 A performs the same control as in the first embodiment. If the phase difference M shifts into the reset trigger range due to the occurrence of a high-level noise, then the fixed stuffing rate controller  7 A does not execute selection of fixed stuffing rates but trigger a reset of the memory  1 , the write address counter  2 , and the read address counter  3  so as to reset the phase difference to the center value of n/2. 
   As shown in  FIG. 10 , when a phase difference M shifts toward underflow to enter the reset trigger region (M&lt;THRa). the fixed stuffing rate controller  7 A forcefully resets the memory  1 , the write address counter  2 , and the read address counter  3  so as to reset the phase difference M back to the center value of n/2. 
   As shown in  FIG. 11 , when a phase difference M shifts toward overflow to enter the reset trigger region (M&gt;THRb), the fixed stuffing rate controller  7 A forcefully resets the memory  1 , the write address counter  2 , and the read address counter  3  so as to reset the phase difference M back to the center value of n/2. 
   In the event that a very large variation in phase difference occurs such that selection of fixed stuffing rates cannot cope with the variation, the phase difference M can go back to proper values immediately. In this case, although data stored in the memory  1  are destroyed, the circuit operation can be restored Immediately after such a very large noise causes an unusual change of the phase difference, resulting in enhanced reliability.