This invention relates to the field of digital sample rate converters.
Sampling-rate conversion is the process of converting a discrete-time signal x[n] sampled at a rate FSin to another signal y[m] sampled at a rate FSout. If the ratio FSout/FSin is a constant then “synchronous” sampling-rate conversion may be used. A common example of sampling-rate conversion is when a portable audio player is required to accept content at a variety of input sampling-rates, FSin={32 kHz, 44.1 kHz, 48 kHz} and then must convert the stream to a fixed output rate of FSout=48 kHz. Mechanisms for the conversion of the sample rate of a digital signal to a different sample rate can be found in many modern digital signal processing implementations such as audio processors and digital modems. The mechanism can be implemented using a dedicated digital hardware module or as a software implementation, for example, using a digital signal processor.
A Synchronous Sample Rate Converter (SSRC) is used when the ratio, R, between the input sample rate FSin and the output sample rate FSout is fixed and known in advance. The SSRC is given this ratio, R, as a configuration parameter. Using this parameter, R, the SSRC processes the input signal and changes its sample rate from FSin to FSout
In the
The input signal 1015 is at the sample rate of FSin, the input clock frequency of the input clock signal 1015 is at FSin and the output clock signal 1030 is at a frequency of FSout. The Rate Ratio, R 1050 is a fixed configuration parameter that is programmed to the interpolator. Ideally R=2b×FSout/FSin, where b is the number of bits used to represent the fixed point number for R. The output signal 1025 y, is at the sampling rate of FSout. The output valid signal indicates a valid output signal, y. For example, a low to high transition of the valid output signal would indicate a valid output signal, y, and the rate of low to high transitions of this signal, would therefore be equal to FSout. The valid output signal may be a delayed version of the output clock.
A brief explanation of the operation, referring to
It is desirable that the sample rate ratio, R=FSin/FSout is represented as a fixed point number however, if the number of bits used to represent the ratio are limited, this sample rate ratio R cannot be presented as a fixed point number without some loss of accuracy. For example, if FSin=44.1 kHz and FSout=48 kHz, the ratio R=0.91875. Representing this ratio R accurately as a fixed point number with 32 bits or less is not possible. If using b bits, the desired fixed point value for R is (2^b×R). So, for example, if b=26, then R=61656268.80. Therefore, if the number of bits is not sufficient, then some form of quantization must be introduced. The introduction of quantization to the sample rate ratio results in a phase that drifts away from the desired sample phase. As a result, if no special mechanism is implemented, this drift eventually will result in the SSRC sample's buffer overrunning or under-running.
To explain this problem we will first analyze a scenario where the ratio R is accurate and no drift is present in the system. Assume the elastic buffer depth is C samples/entries. Although there is no drift the phase will wander around its nominal value due to jitter that is present in the system. This jitter is mostly comprised of low frequencies and hence C should be made large enough so that the likelihood of the buffer pointer wandering more than C/2 buffer entries is negligible. Hence, having a “guard band” of C/2 entries for the buffer pointer to wander to the left or to the right side ensures that a buffer overrun or under-run is highly improbable. The actual value of C is determined by the statistical properties of the jitter of the particular use case and is beyond the scope of this discussion. The above mechanism has no direct effect on SNR.
A second analysis is provided for a scenario where the value of R is not accurate, and the buffer pointer drifts.
Let the ideal ratio,
Ri=2b×FSin/FSout (1)
And let the actual ratio
R=Ri(1+α) (2)
where α is the frequency offset
Hence,
α=(R−Ri)/Ri (3)
The buffer write operation is at the input sample rate, FSin and the read operation from the buffer is R/2b×FSout
Now, from (2), and (1)
R/2b×FSout=Ri(1+α)/2b×FSout=(1+α)FSin (4)
The period between two consecutive buffer write operations, Tin, is
Tin=1/FSin
So hence, the average period, Pave, between two consecutive buffer read operations is:
Pave=1/[FSin(1+α)]=Tin(1+α)−1
As α is very small,
Pave=Tin(1−α)
The drift per input sample time, D, is the difference between the write period and the read period,
D=Tin−Tin(1−α)=αTin
Hence, the time until the buffer pointer drifts one buffer entry from its nominal position (the middle of the buffer), is
Tin/|α|
Using the example of FSin=44.1 kHz and FSout=48 kHz, the ideal ratio is 0.91875. Representing this ratio as a fixed point number with 26 bits,
Ri=226×0.91875=61656268.80
Thus,
R=61656269
and
α=(R−Ri)/Ri=0.003 ppm
Hence, the time until the buffer pointer drifts one buffer entry from its nominal position,
Tin/|α|=1/(FSin|α|)=116 minutes
An Asynchronous Sample Rate Converter (ASRC) is used when the ratio, R, between the input sample rate FSin and the output sample rate FSout is not fixed and not known in advance. In this case it is likely that the sample rate ratio will vary over and be subject to change. FSin and FSout may be derived from difference clock sources and hence are asynchronous.
As shown in
The phase tracking unit processes the two clock signals, clock_in and clock_out, and calculates an accurate estimate of a frequency ratio Rc. The interpolator then uses this frequency ratio, Rc, to perform the actual sample rate conversion.
Referring to
clock_in is a clock signal at a frequency fclock
clock_out is a clock signal at a frequency fclock
FSin is the sample rate of the input signal
FSout is the sample rate of the output signal
The sample rate ratio, R=FSin/FSout
Rc is the clock frequency ratio where Rc=fclock
In the general case,
fclock
where Nin, S1,in, and S2,in are integers.
fclock
where Nout, S1,out, and S2,out are integers.
In practice therefore, the output, Rc of the phase tracking unit is:
where N, S1 and S2 are integers.
Hence,
Rc=2N·S1/S2·R
and
R=2−N·S2/S1·Rc
Therefore, in order to scale Rc a direct solution would be to multiply the value of Rc by 2−N·S2/S1. Whereas scaling by 2−N is straightforward, a simple shift operation, scaling by S2/S1 involves an integer ratio. It is desirable that the scaling factor, S2/S1, is represented as a fixed point number, however, if the number of bits used to represent the scaling factor are limited, this scaling factor S2/S1 cannot be presented as a fixed point number without some loss of accuracy. As a result, the calculated R is also inaccurate.
Yet for another example—referring to FIG. 1C—an application processor transfers an audio stream at 44.1 ksps to the interface IC which contains an asynchronous sample rate converter (ASRC). This 44.1 ksps stream is transferred over the SlimBus which uses a basic clock of 24,576 kHz. The SlimBus scheme allocates certain slots of its bus bandwidth in order to transfer the 44.1 ksps stream, but the clock is at 24,576 kHz. The ASRC inside the interface IC converts the 44.1 ksps stream to a 48 ksps stream which is sent over the I2C bus to the audio codec.
As shown in
R=FSin/FSout=44100/48000=0.91875
fclock
fclock
Hence,
Rc=fclock
The relationship between the available 24576 kHz clock and the desired 44.1 kHz clock is:
Hence,
Rc=2N·S1/S2·R
As a result, in this example, scaling by a factor of 2−9·147/160 is required in order to use the correct rate ratio by the interpolator.
i.e.
FSin=fclock
44100=24576000·2−9·147/160
As pointed out previously, scaling by 2−N is simple but to make a fixed point binary representation of a value Sf=S2,in/S1,in such as 147/160 without loss of accuracy requires an infinite number of bits. Note that for this specific example S2,in/S1,in=147/160 equals the fractional representation of the ideal ratio for R, i.e. 147/160=0.91875.
Representing this ratio accurately as a fixed point number without introducing a loss of accuracy would require an infinite number of bits and hence to make the fixed point presentation feasible, quantization must be introduced. As a result, the calculate sample rate ratio, R is also inaccurate. The introduction of inaccuracy to the sample rate ratio results in a difference between the desired phase and the actual phase and unless special mechanisms are introduced the phase drift will eventually produce an overrun or an under-run in the interpolator input buffer.
When the value of R is not accurate, there will be drift. This can be explained as follows:
Let the actual scaling factor be
Sf=Sfi(1+α) (1)
Let the ideal sample rate ratio,
Ri=2−N·Sfi·Rc·=FSin/FSout (2)
The actual ratio is
R=2−N·Sf·Rc=2−N·Sfi·(1+α)·Rc=Ri(1+α) (3)
Hence,
α=(R−Ri)/Ri (4)
The buffer write operation is at the input sample rate, FSin and the read operation from the buffer is at a rate R×FSout
Now, from (3), and (2)
R×FSout=Ri(1+α)×FSout=(1+α)FSin (5)
The period between two consecutive buffer write operations, Tin, is
Tin=1/FSin
So hence, the average period, Pave, between two consecutive buffer read operations is:
Pave=1/[FSin(1+α)]=Tin(1+α)−1
As α is very small,
Pave=Tin(1−α)
The drift per input sample time, D, is the difference between the write period and the read period,
D=Tin−Tin(1−α)=αTin
Hence, the time until the buffer pointer drifts one buffer entry from its nominal position (the middle of the buffer), is
Tin/|α|
Using the example of Sf=147/160 the ideal scaling factor is 0.91875. Representing this ratio as a fixed point number with 26 bits,
2b·Sfi=226×0.91875=61656268.80
Thus,
2b·Sf=61656269
and
α=(R−Ri)/Ri=(Sf−Sfi)/Sfi=0.003 ppm
Hence, the time until the buffer pointer drifts one buffer entry from its nominal position,
Tin/|α|=1/(FSin|α|)=116 minutes
The drift rate, D, can be reduced and sometimes avoided if a sufficient number of bits are used for the fixed point representation of the sample ratio clock Rc. However, in a hardware implementation, increasing the number of bits will result in a higher area and increased power consumption and in a software implementation, increasing the number of bits above the processor word width, say 32 bit, would then require double precision arithmetic, resulting in higher MIPS requirement and increased power consumption. Another approach is to increase the buffer depth such that the time before the overrun occurs can be longer, as depicted in the
If the buffer size is C and there is no jitter and just drift is present, then the overrun or under-run will occur after a period of (Tin·C)/2|α|.
The drift rate, D, can be reduced or avoided if a sufficient number of bits are used for the fixed point representation of the sample ratio R. However, in a hardware implementation, increasing the number of bits will result in a higher area and increased power consumption and in a software implementation, increasing the number of bits above the processor word width, say 32 bit, would then require double precision arithmetic, resulting in higher MIPS requirement and increased power consumption. Another approach is to increase the buffer depth of the SSRC such that the time before the overrun occurs can be longer, as depicted in the
For the drift that occurs in the SSRC scenario drift avoidance can be achieved by implementing an asynchronous sample rate convertor (ASRC). In an asynchronous sample rate converter (ASRC) the input and the output clocks are derived from different sources. Effectively an ASRC 1008 adds a phase tracking unit 1102 to the SSRC 1102, as shown in
The phase tracking unit has two clock input signals, Fin and Fout: The first clock signal, Fin is at the input sample rate, FSin, and the other input signal, Fout, is the output sample rate, FSout. The phase tracking unit output is a value representing the sample rate ratio R in a fixed point format. In this case, however, the value of R is not fixed but fluctuates between several values in a manner that ensures that the average exactly matches the desired sample rate ratio. In this way the drift is completely avoided. A sufficient number of bits is selected for the fixed point representation of R to ensure that the SNR degradation due to jitter resulting from the fluctuations is negligible. In a typical implementation, the number of bits that is required to ensure negligible jitter is much smaller than the number of bits required for decreasing the time for the buffer to overrun or under-run. However, adding the tracking unit to the SSRC increases the complexity, area and power consumption of the rate convertor. In addition to that, before actual sample rate conversion can start, the tracking unit must first lock onto the frequency ratio. Note also that, in certain cases, the actual clocks representing the sample rate rates are not readily available to be processed.
A full duplex ASRC performs the conversion in both directions simultaneously.
In the case of bi-directional traffic, there are two ASRCs 1008 and 1009—a first ASRC 1008 that converting signal FS A to signal FS B, and the second ASRC 1009 for converting signal FS B to signal FS A with the corresponding clock frequency ratios being Rc and 1/Rc respectively. The conventional method would be to simply use two phase tracking blocks as shown in
According to an embodiment of the invention there is provided a variation on the synchronous sample rate converter such that the phase tracking of an asynchronous sample rate converter is effectively replaced by a “fractional R” scheme which is used to generate an accurate value for R. The value for R is then derived from a single source and is accurate without the need for a high number of bits to represent the fixed point value of R.
A fractional scheme is used to produce a value for the ratio R that is accurate. A fixed pattern is used to vary between two fixed point values. The first value is the fixed point value integer of the ratio, I, and the second value is I+1. By switching the value between I and I+1, with a ratio of n1 to n2, the average value can be made to exactly equal the desired value for R.
For example, if FSin, and FSout are 44.1 ksps and 48 ksps respectively, then the desired ratio, R, is 0.91875. If using b bits, the desired fixed point value for R is (2^b×R).
Hence if b=26, then R=61656268.80. Therefore the value for I=INTEGER(2^b×R)=61656268 and I+1 is 61656269. To produce the ratio of I and I+1 required to provide the fractional part of R, 0.80, a ratio of 1 to 4 is required, i.e. n1=1 and n2=4, and hence (I+1) is send 4 times and I is sent once, repeatedly.
Average R=(n1×I+n2×(I+1))/(n1+n2)=(I+4×(I+1))/5=(5×I+4)/5=I+4/5=I+0.8
FSin, FSout R, I, b, n1 and n2 are related as follows:
FSin=Input sample rate
FSout=Output sample rate
FSin/FSout=M/L where M and L are positive integers
b=Number of bits.
R in fixed point=(2^b×M/L)
I=INTEGER(2^b×M/L)
Let
G=GCD[(2^b×M−L×I),L)
where GCD is the greatest common denominator
Then
n2=(2^b×M−L×I)/G
n1=L/G−n2
Hence, using the same example as previous,
FSin=44.1 ksps
FSout=48 ksps
FSin/FSout=M/L=147/160 M=147 and L=160
b=26
Hence,
R in fixed point=(2^26×147/160)=61656268.80
I=INTEGER(2^26×147/160)=61656268
G=GCD[(2^26×147−160×61656268),160)=32
Then
n2=(2^26×147−160×61656268)/32=4
and
n1=160/32−4=1
Therefore the desired sample rate ratio sequence is a repetitive series where each series period has the following pattern:
61656268, 61656269, 61656269, 61656269, 61656269; the average value of which is 61656269.80.
For given values of FSin and FSout the values for n1 and n2 can be calculated and the sample rate pattern for I and I+1 derived. This pattern has the result that drift in the phase is completely eliminated and there is zero chance for an overrun or under-run. This scheme is termed “fractional R”.
The following simulation compares the fixed sample rate ratio obtained with
R=INTEGER(2^b×M/L+0.5) to the method described in this invention.
The signal used for interpolation is a sinusoid at f0=20 kHz
Number of bits used for the fixed point value of R, b=26 bits.
The results are given in the Table below:
As can be seen in the table, for the two cases where the fractional R is used the drift is fully eliminated. If a fixed R is used a drift is present and a sample drop or skip occurs due to the buffer overrun or under-run. The time for the buffer to overrun or under-run depends on the buffer size. It should be noted that the buffer acts as an elastic buffer and compensates for the jitter that is present in the system due to the fractional R values and is therefore retained in the fractional R scheme. There is no SNR degradation using the fractional R scheme compared to the fixed sample rate ratio. The actual size of the buffer is determined by the summation of the size required due to jitter considerations.
According to an embodiment of the invention, in the case of a unidirectional ASRC, in order to produce a value for R that is accurate a fractional scheme is used.
As previously explained the ideal scaling factor, Sfi=S2/S1 where Sf is a time varying estimate of Sfi. A fixed pattern is used to vary between two fixed point values. The first value is the fixed point value integer of the ratio, I, and the second value is I+1. By switching the value between I and I+1, with a ratio of n1 to n2, the average value can be made to exactly equal the desired value for Sfi.
Sfi, S1, S2, b, n1 and n2 are related as follows:
Sfi=S2/S1
I=INTEGER(2b·S2/S1)
Let
G=GCD[(2b·S2−S1·I),S1)
Then
n2=[(2b·S2−S1·I)/G
n1=S1/G−n2
For example, using the example given in figure C the desired scaling factor, Sfi, is R, where R, the sample clock rate is equal to 0.91875. If using b bits and b=26, then 2b·Sf=61656268.80. Therefore the value for I=INTEGER(2^b×R)=61656268 and I+1 is 61656269. To produce the ratio of I and I+1 required to provide the fractional part 0.80, a ratio of 1 to 4 is required, i.e. n1=1 and n2=4, and hence (I+1) is send 4 times and I is sent once, repeatedly.
Average Sf=(n1×I+n2×(I+1))/(n1+n2)=(I+4×(I+1))/5=(5×I+4)/5=I+4/5=I+0.8
Note that the value 0.8=4/5 cannot be represented in binary format using a finite number of bits, the binary representation is 0.11001100110011 . . . recurring.
Hence, using the same example as previous,
S2/S1=147/160
b=26
Hence,
2b·Sf=(2^26×147/160)=61656268.80
I=INTEGER(2^26×147/160)=61656268
G=GCD[(2^26×147−160×61656268),160)=32
Then
n2=(2^26×147−160×61656268)/32=4
and
n1=160/32−4=1
Therefore the desired sample rate ratio sequence is a repetitive series where each series period has the following pattern:
61656268, 61656269, 61656269, 61656269, 61656269; the average value of which is 61656269.80.
For given values of S1 and S2 the values for n1 and n2 can be calculated and the sample rate pattern for I and I+1 derived. This pattern has the result that drift in the phase is completely eliminated and there is zero chance for an overrun or under-run of the interpolator buffer. This scheme is termed “fractional scaling factor”.
In place of using two independent ASCRs to implement a duplex ASRC, as shown in
The ASCR that converts signal FS A to signal FS B operates as the simplex scheme. If required, proper scaling of the clock frequency ratio can be carried out inside the phase tracking unit or the interpolator unit by either using the fractional scaling factor scheme as per this invention, or by other methods. The desired value for the clock frequency ratio for ASRC that converts signal FS B to signal FS A is 1/Rc. To avoid inaccuracies in the 1/Rc estimation for this second ASRC a closed loop converter block is implemented that converts the ratio from Rc to 1/Rc. This closed loop converter could be included in all interpolator blocks. Consider a product that includes a bank of phase tracking blocks and interpolator units. A flexible interconnect mechanism would enable a user to configure multiple ASRC units at simplex or full duplex using this bank. The user can allocate phase tracking units form the bank to form specific ASRCs and when a full duplex ASRC is required, only a single phase tracking block is required.
A block schematic diagram for an example closed loop converter is shown in
The schematic diagram shown in
At step m, the input is R(m) which is equal to R.
Assume that
G(m−1)=1/R+δ(m−1)
where δ(m−1) is a small error.
The output of the multiplier is then
R(m)·G(m−1)=R·(1/R+δ(m−1))=1+R·δ(m−1)
This value is then subtracted from one in the first adder to produce the error value e(m).
Hence,
e(m)=1−R(m)·G(m−1)=1−(1+R·δ(m−1))=−R·δ(m−1)
The action of the shifter is to multiply the error e(m) by a value of k, where k=2−N where N is the number of shifts performed on the error after the shifter, which shifts the e(m) bits to effectively reduce the value of e(m), the resulting value, k·e(m) is applied to one input of the second adder. The other input to this adder is G(m−1). Hence, the output of the second adder,
G(m)=k·e(m)+G(m−1).
Therefore,
G(m)=−k·R·δ(m−1)+1/R+δ(m−1)=1/R+δ(m−1)(1−k·R)=1/R+δ(m)
To ensure the error of G(m) is less than that of
G(m−1):|δ(m)|<|δ(m−1)|
|δ(m−1)|·|(1−k·R)|<|δ(m−1)|
|(1−k·R)|<|→(1−k·R)<1 and (1−k·R)>−1→k·R>0 and k·R<2.
k·R is always positive since k and R are both positive. Therefore, by taking a sufficiently small k the error is further reduced and the output G(m) will approach and be almost exactly equal to 1/R, the desired output value.
The closed loop can be perceived as a special case of the normalized LMS (least mean square) algorithm which finds the inverse of linear system form the special case of a single tap-gain transfer function. LMS convergence properties are well known and convergence is guaranteed for a sufficiently small value for k. It is also guaranteed that the error function is convex and hence has a single minimum point.
The initialization of the value for G(m) could either be an estimate of the correct value, or a simple value such as one or zero. G(m) would use the same number of bits as R(m). The value of k would be a power of 2 so as to simplify the implementation and hence a shifter can be used. In the general case, R(m) may vary slightly as the clock frequencies may slowly drift over time. G(m) will track these slow drifts and changes.
The subject matter regarded as the invention is particularly pointed out and distinctly claimed in the concluding portion of the specification. The invention, however, both as to organization and method of operation, together with objects, features, and advantages thereof, may best be understood by reference to the following detailed description when read with the accompanying drawings in which:
In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the invention. However, it will be understood by those skilled in the art that the present invention may be practiced without these specific details. In other instances, well-known methods, procedures, and components have not been described in detail so as not to obscure the present invention.
The subject matter regarded as the invention is particularly pointed out and distinctly claimed in the concluding portion of the specification. The invention, however, both as to organization and method of operation, together with objects, features, and advantages thereof, may best be understood by reference to the following detailed description when read with the accompanying drawings.
It will be appreciated that for simplicity and clarity of illustration, elements shown in the figures have not necessarily been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. Further, where considered appropriate, reference numerals may be repeated among the figures to indicate corresponding or analogous elements.
Because the illustrated embodiments of the present invention may for the most part, be implemented using electronic components and circuits known to those skilled in the art, details will not be explained in any greater extent than that considered necessary as illustrated above, for the understanding and appreciation of the underlying concepts of the present invention and in order not to obfuscate or distract from the teachings of the present invention.
Any reference in the specification to a method should be applied mutatis mutandis to a system capable of executing the method.
Any reference in the specification to a system should be applied mutatis mutandis to a method that may be executed by the system.
According to an embodiment of the invention there may be provided a device that may include a first interpolator. The device may be an integrated circuit, an electronic board, a computer, a mobile phone, an audio player, a media player, and the like.
The first interpolator may be configured to (a) receive, at a first clock rate, a first signal having a first sampling rate and (b) output, at a second clock rate, a second signal having a first desired sampling rate average. The first interpolator may include a first buffer for storing the first signal; and a first fractional sampling ratio circuit that is configured to generate a first pattern of fixed point values, wherein an average value of the first pattern corresponds to a first desired sampling rate ratio between the first desired sampling rate average and the first sampling rate. Non-limiting examples of a first fractional ratio circuit are shown in
In
In
In
In
In
In
The interpolator is configured to set the first desired sampling rate ratio in response to the clock frequency ratio.
The desired sampling rate ratio may equal the clock frequency ratio (Rc).
It is noted that in some scenarios the desired sampling rate ratio differs from the clock frequency ratio—see for example
As indicated above,
The first interpolator of
In
In the device of
The other input to the control block 1040 is the first ratio input R 1050. The first ratio input 1050 is the ratio between the first sampling rate (input sampling rate FSin) of input clock signal 1020 and the output signal sampling rate of output clock signal 1030.
This ratio input 1050 is a fixed point number.
Output 1055 from the control block 1040 is used to clock out the samples 1065 from the buffer 1035 at a rate equal to the output clock rate 1030. These samples 1065 are then applied to the digital interpolation filter 1045. Output 1060 from the control block 1040 is also applied to the digital interpolation filter 1045. The interpolation filter 1045 filters the samples 1065 with the proper delay shift so as to provide the desired output sample 1025.
The sample rate ratio 1050 may be required to be equal to the ratio of the input clock 1020 and the output clock 1030. In practice this number is represented as a fixed point number but if the number of bits is limited, this sample rate ratio 1050 cannot be presented as a fixed point number without some loss of accuracy. For example, if the input sample rate 1020 is FSin=44.1 kHz and the output sample rate 1030 is FSout=48 kHz, the first desired sampling rate ratio (R 1050) equals 0.91875. Representing this ratio R accurately as a fixed point number with 32 bits or less is not possible. If using 26 bits, for example, then the calculated value for R=61656268.80. In practice, the value for R would need to be set to the closest whole number, in this case 61656269. This error will cause a phase drift and dependent upon the depth of the buffer 1035, will eventually result in the buffer either overrunning or under-running with a subsequent sample error at the output 1025.
A first fractional rate circuit 1001 generates the “Fractional R” pattern and feeds it to the controller 1010.
Using the same example as before, if the pattern of the output 1150 is 61656269, 61656269, 61656269, 61656269, 61656268, repeatedly, then the average is 6165626.8 exactly. In this case the weights for the pattern are 1 and 4, for I and I+1, respectively. The required pattern input 1145 for the switching of the multiplexer 1120 is provided by the pattern control block 1125. The inputs 1135 and 1140 set the weights for I and I+1, respectively. Input 1135, sets the weight of the value 1100, I, and input 1140 sets the weight of the value, 1115, I+1. The clock 1130 is applied to the pattern control block 1125 such that the output 1145 is switched synchronously with the output sample rate 1030 in
The output 1150 in
According to an embodiment of the invention ASRC 100 may be coupled between an application processor 155 and a SlimBus connection 160—having the same environment as illustrated in
In general the value for Rc can be represented as a product of 2N·S1/S2 where N, S1 and S2 are all integers. In this example the following values for N, S1 and S2 apply: N=9, S1=160, S2=147. Hence, Rc=29×160147. In order to scale Rc a direct solution would be to multiply the value of Rc by 2−N·S2/S1. Whereas scaling by 2−N is straightforward, a simple shift operation, scaling by S2/S1 involves an integer ratio. It is desirable that the ratio is represented as a fixed point number; however, if the number of bits used to represent the ratio is limited, this ratio cannot be presented as a fixed point number without some loss of accuracy.
For example, in the example shown in
In
It is often the case that the scaling factor cannot be accurately represented by a fixed point number due to a restricted number of bits. This invention allows an asynchronous sample rate converter to be used when the number of bits of the associated processor word width or HW implementation word width is not sufficient to accurately represent the required scaling factor, without having to resort to higher precision arithmetic. Thus this “fractional scaling factor” scheme provides a potential saving in integrated circuit area, MIPS and power consumption.
The conversion from FS A 345 to FS B 350 in first interpolator 325 uses Rc, 320 as the clock frequency ratio. When converting in the opposite direction (from FS B 370 to FS A 365) the function performed by second interpolator 360, the sample clock frequency ratio needs to be the reciprocal of Rc 320. Hence the function of the closed loop converter 400 is to convert the signal at its input Rc 320 into a signal 1/Rc 355 at its output.
In order to understand the process of the closed loop converter 400 a simple analysis of the steady state condition follows. Assume that the input 405 is at the fixed value R and hence the desired output 460 G(m−1) will have a value of 1/R with a small error, δ(m−1).
Hence, output 460
G(m−1)=1/R+δ(m−1)
where δ(m−1) is a small error.
The output 415 of the multiplier 410 is
R(m)·G(m−1)=R·(1/R+δ(m−1))=1+R·δ(m−1)
This value is then subtracted from unity 425 in the first adder 420 to produce the error value e(m), 430.
e(m)=1−R(m)·G(m−1)=1(1+R·δ(m−1))=−R·δ(m−1)
The shifter, 435 shifts e(m) bits 430 to effectively reduce the value of e(m). The shifter 435 effectively multiplies the error value e(m) 430 by a value k, where k=2−N where N is the number of right shifts performed on the error 430. The resulting value, k·e(m) 440 is applied to one input of the second adder 445. The other input 460 to this adder 445 is G(m−1). Hence, the output of the second adder 445 is
G(m)=k·e(m)+G(m−1)
Substituting for e(m), and setting
G(m−1)=1/R+δ(M−1)
Hence, after one iteration the value at the output 460 is
G(m)=1/R+δ(m−1)(1−k·R).
To ensure the error is in G(m) is less than that in
G(m−1):|δ(m)|<|δ(m−1)|
|δ(m−1)|·|(1−k·R)|<|δ(m−1)|
|(1−k·R)|<1→(1−k·R)<1 and (1−k·R)>−1→k·R>0 and k·R<2.
k·R is always positive since k and R are both positive. Therefore by taking a sufficiently small k the error is further reduced and the output G(m) will approach and be almost exactly equal to 1/R, the desired output value. This closed loop 400 can be perceived as a special case of the normalized LMS (least mean square) algorithm which finds the inverse of linear system form the special case of a single tap-gain transfer function. LMS convergence properties are well known and convergence is guaranteed for a sufficiently small value for k. It is also guaranteed that error function is convex and hence has a single minimum point. The initialization of the value for G(m), 460, could either be an estimate of the correct value, or a simple value such as one or zero. The output G(m), 460, would use the same number of bits as the input R(m), 405 The value of k is a power of 2 so as to simplify the implementation of multiplying the error 430 and hence enabling a shifter 435 to be used. In the general case the input 405 R(m) may vary slightly as the clock frequencies may slowly drift over time, the output 460 G(m) will track these slow drifts and changes.
Using this closed loop conversion scheme in place of carrying out a standard long division or, indeed, using two phase tracking blocks in a duplex ASRC, has several benefits. The closed loop converter can be included as part of the interpolator block and this allows a bank of interpolators and phase trackers to be realized that can be dynamically connected to produce a wide variety of configurations of duplex and simplex sample rate converters. By this means the number of phase tracking blocks can be reduced with the subsequent savings in chip area and cost. Together with the fractional scaling factor scheme described in
While the above descriptions contain many specificities, these should not be construed as limitations on the scope, but rather as an exemplification of one or more embodiments thereof. Many other variations are possible. For example, the method to produce the pattern for the I and (I+1) as described in
Method 5000 may start by stage 5010 of receiving, by a first interpolator, at a first clock rate, a first signal having a first sampling rate.
Stage 5010 may be followed by stage 5020 of storing, by a first buffer, the first signal.
Stage 5020 may be followed by stage 5030 of generating a second signal having a first desired sampling rate average. The generating of the second signal may include generating (5032) a first pattern, by a first fractional sampling ratio circuit, the first pattern comprises fixed point values, wherein an average value of the first pattern corresponds to a first desired sampling rate ratio between the first desired sampling rate average and the first sampling rate. The first pattern may be fed to an interpolation filter that assists in generating the second signal. In case of a synchronous sampling rate converter stage 5030 may include stage 5034 of feeding the first pattern to an interpolator and retrieving the first signal from the first buffer at a rate that is set by the first pattern. In a case of an asynchronous sampling rate converter stage 5030 may include stage 5036 of multiplying the first clock frequency ratio by the first pattern to provide an output pattern and feeding the output pattern to an interpolator and retrieving the first signal from the first buffer at a rate that is set by the output pattern.
Stage 5030 may be followed by stage 5040 of outputting, at a second clock rate, the second signal.
Method 5000 may be executed by any interpolated illustrated in the previous figures.
According to various embodiment of the invention the first pattern may include only two fixed point values that differ from each other or may include at least three different fixed point values.
At least two fixed point values of the first pattern may differ from each other by one or by an offset that differs from one.
The first pattern (number of different fixed point values, offset) may be set according to a desired signal to noise ration or any other parameter related to the second signal.
Stage 5032 may include (i) adding by a first adder, an offset to a first fixed point value that is an integer value of the first desired sampling rate ratio, to provide a second fixed point value; (ii) repetitively selecting, by a first multiplexer, between the first fixed point value and the second fixed point value to provide the first pattern.
Method 5000 may also include stage 5005 of receiving, by a first phase tracking block, a first clock signal of the first clock rate, receiving a second clock signal of a second clock rate, calculating a first clock frequency ratio between the second clock rate and the first clock rate. The desired sampling rate ratio may equal the clock frequency ratio or may differ from the clock frequency ratio. The first sampling rate ratio may differ from the first clock frequency ratio by a factor that is responsive to a relationship between the first clock rate and the first sampling rate.
Method 6000 includes stages 5005, 5010, 5020, 5030 and 5040.
Method 6000 also includes stages 6005, 6010, 6020, 6030 and 6040.
Stage 6005 includes calculating an approximation of a reciprocal of the first clock frequency ratio. The first clock frequency ratio is provided from stage 5005.
Stage 6010 includes receiving, by a second interpolator, at a second clock rate, a third signal having a second sampling rate.
Stage 6010 may be followed by stage 6020 of storing, by a second buffer, the third signal.
Stage 6020 may be followed by stage 6030 of generating a fourth signal having a second desired sampling rate average. The generating of the fourth signal may include generating (6032) a second pattern, by a second fractional sampling ratio circuit, the second pattern comprises fixed point values, wherein an average value of the second pattern corresponds to a second desired sampling rate ratio between the second desired sampling rate average and the second sampling rate. The second pattern may be fed to an interpolation filter that assists in generating the second signal. In case of a synchronous sampling rate converter stage 6030 may include stage 6034 of feeding the second pattern to a second interpolator and retrieving the third signal from the second buffer at a rate that is set by the second pattern. In a case of an asynchronous sampling rate converter stage 6030 may include stage 6036 of multiplying the second clock frequency ratio by the second pattern to provide a second output pattern. Feeding the second output pattern to a second interpolator and retrieving the third signal from the second buffer at a rate that is set by the second output pattern.
Stage 6030 may be followed by stage 6040 of outputting, at a first clock rate, the fourth signal.
Those skilled in the art will recognize that the boundaries between logic blocks are merely illustrative and that alternative embodiments may merge logic blocks or circuit elements or impose an alternate decomposition of functionality upon various logic blocks or circuit elements. Thus, it is to be understood that the architectures depicted herein are merely exemplary, and that in fact many other architectures may be implemented which achieve the same functionality.
Any arrangement of components to achieve the same functionality is effectively “associated” such that the desired functionality is achieved. Hence, any two components herein combined to achieve a particular functionality may be seen as “associated with” each other such that the desired functionality is achieved, irrespective of architectures or intermedial components. Likewise, any two components so associated can also be viewed as being “operably connected,” or “operably coupled,” to each other to achieve the desired functionality.
Furthermore, those skilled in the art will recognize that boundaries between the above described operations merely illustrative. The multiple operations may be combined into a single operation, a single operation may be distributed in additional operations and operations may be executed at least partially overlapping in time. Moreover, alternative embodiments may include multiple instances of a particular operation, and the order of operations may be altered in various other embodiments.
Also for example, in one embodiment, the illustrated examples may be implemented as circuitry located on a single integrated circuit or within a same device. Alternatively, the examples may be implemented as any number of separate integrated circuits or separate devices interconnected with each other in a suitable manner.
However, other modifications, variations and alternatives are also possible. The specifications and drawings are, accordingly, to be regarded in an illustrative rather than in a restrictive sense.
In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word ‘comprising’ does not exclude the presence of other elements or steps then those listed in a claim. Furthermore, the terms “a” or “an,” as used herein, are defined as one or more than one. Also, the use of introductory phrases such as “at least one” and “one or more” in the claims should not be construed to imply that the introduction of another claim element by the indefinite articles “a” or “an” limits any particular claim containing such introduced claim element to inventions containing only one such element, even when the same claim includes the introductory phrases “one or more” or “at least one” and indefinite articles such as “a” or “an.” The same holds true for the use of definite articles. Unless stated otherwise, terms such as “first” and “second” are used to arbitrarily distinguish between the elements such terms describe. Thus, these terms are not necessarily intended to indicate temporal or other prioritization of such elements. The mere fact that certain measures are recited in mutually different claims does not indicate that a combination of these measures cannot be used to advantage.
While certain features of the invention have been illustrated and described herein, many modifications, substitutions, changes, and equivalents will now occur to those of ordinary skill in the art. It is, therefore, to be understood that the appended claims are intended to cover all such modifications and changes as fall within the true spirit of the invention.
This application claims priority from U.S. provisional patent Ser. No. 61/935,947 filing date Feb. 5, 2014 and from U.S. provisional patent Ser. No. 61/982,359 filing date Apr. 22, 2014 and both being incorporated herein by reference.
Number | Name | Date | Kind |
---|---|---|---|
7061409 | Jantti et al. | Jun 2006 | B1 |
Number | Date | Country | |
---|---|---|---|
20150244349 A1 | Aug 2015 | US |
Number | Date | Country | |
---|---|---|---|
61935947 | Feb 2014 | US | |
61982359 | Apr 2014 | US |