Variable-length decoder using a memory

Abstract: A memory interfacing method for a variable-length decoder and a circuit therefor are provided. The memory interfacing circuit (10) includes a read controller (15) for generating a read chip-enable signal and a read address in response to a first request signal output from the variable-length decoder (21), generating a second request signal when the read address reaches a predetermined level, and providing the second request signal to an external memory controller (13) which is connected to an external memory (11), a write controller (17) for generating a write address and a write section signal in response to an accept signal generated by the external memory controller (13) in response to the second request signal, and an internal memory controller (19) which includes an internal memory, for controlling data provided from an external memory (11) to be written according to the write address and the write section signal generated by the write controller (17). Accordingly, the present invention simplifies complex signal processing due to frequent memory access between a variable-length decoder (21) and external memory (11).

Description: The present invention relates to an image compressing/restoring apparatus, and more particularly, to a memory interfacing method for a variable-length decoder and a circuit therefor. As the amount of information processed in data storage and retrieval systems and image processors, which are traditionally analog in nature, becomes greater due to conversion to digital modes, the amount of information should be reduced (compressed) in order to efficiently use storage media and transmission channels. The Moving Picture Experts Group (MPEG) has agreed on standards for achieving such reduction. According to a general method for compressing an MPEG-encoded bit stream, i.e., variable-length encoding, repetitive (redundant) information is removed using time and spacial correlations of image information comprising the bit stream. Here, a variable-length encoder in the image compression apparatus allocates a shorter code to those symbols which occur more frequently, and, in order to restore the encoded image signal, it is applied to an image restoring apparatus comprising a variable-length decoder for restoring the variable-length-compressed signal back into its original form. More particularly, the variable-length decoder controls an external memory to read the shorter codes slowly and the longer codes quickly, by generating a request signal and timely providing the request signal to the external memory. Accordingly, whenever the request signal is received from the variable-length decoder, the external memory sends the data to the variable-length decoder immediately, regardless of code length. However, stored in the external memory are many kinds of data to be accessed, and when a request signal having a higher priority is received from elsewhere in the system, the request signal from the variable-length decoder must stand by. During this brief waiting period, the image compressing/restoring process is unavoidably interrupted since the variable-length decoder is directly connected to the external memory, with no interface circuitry. US 5,280,584 discloses a two-way data transfer device implemented by a FIFO memory. It is an aim of preferred embodiments of the present invention to provide a memory interfacing method for a variable-length decoder in an image compressing/restoring apparatus, for processing a request signal from a variable-length decoder by employing an internal memory and for requesting high-speed page mode access to an external memory when the amount of data in the internal memory drops below a predetermined level. According to a first aspect of the present invention, there is provided a memory interfacing method characterised in being for a variable-length decoder and comprising the steps of: (a) generating a read chip-enable signal and a read address based on a first request signal output from the variable-length decoder, to read out data from an internal memory; (b) generating a second request signal when data stored at an address of the internal memory which exceeds a predetermined level is read out from the internal memory; and (c) generating and applying a write address and a write section signal to the internal memory when an accept signal is generated in response to the second request signal, to write data provided from an external memory to the internal memory. According to a second aspect of the invention, is also provided a memory interfacing circuit characterised in being for a variable-length decoder and comprising: a read controller for generating a read chip-enable signal and a read address based on a first request signal output from the variable-length decoder, generating a second request signal when the read address reaches a predetermined level, and providing the second request signal to an external memory controller which is connected to an external memory; a write controller for generating a write address and a write section signal based on an accept signal when in response to the second request signal the accept signal is generated by the external memory controller; and an internal memory controller, having an internal memory, for controlling data provided from an external memory to be written to the internal memory according to the write address and the write section signal generated by the write controller. The read controller may comprise: a first multiplexer which receives said first request signal and in response thereto generates a read clock; a first counter which receives said read clock and generates said read address by counting according to said read clock; a decoder unit connected to said first counter and determining whether said read address equals one of a first predetermined level and a second predetermined level; a first signal generator connected to said decoder and generating said second request signal (SECOND REQUEST) based on a decoding result of said decoder unit; and a second signal generator connected to said first multiplexer and generating said read chip-enable signal based on said read clock. Preferably, said write controller comprises: a third signal generator (D6, D7, NA2) which receives said accept signal (VLD-ACCEPT) and generates a reset signal (R) in response thereto; a second counter which receives said first clock and said reset signal (R), generates said write address (WADDR) by counting according to said first clock, generates a reset-carry signal ( RC ), and resets the count in response to said reset signal (R); a fourth signal generator (D8-D10, A2) which generates said write section signal (WRITE SECTION) in response to said reset signal (R) and said reset-carry signal ( RC ) generated by said second counter; a fifth signal generator which generates a read/write control signal (RIW) in response to said write section signal (WRITE SECTION) and a signal obtained by latching said first clock according to a second clock; and a sixth signal generator (O3) which generates a write chip-enable signal (WCEN) in response to said second clock, said write section signal and said signal obtained by latching said first clock according to said second clock. The read chip-enable signal is preferably based on said read clock and said second clock. Said internal memory controller may comprise: a second multiplexer which selectively outputs as an address signal said read address and said write address (WADDR) in response to said signal obtained by latching said first clock according to said second clock; a seventh signal generator which generates a chip-enable signal from said read chip-enable signal and said write chip-enable signal; a first shift register which receives and shifts data provided from said external memory controller; a second shift register which outputs data output from said internal memory according to said read clock; and a third multiplexer which receives and divides data output from said second shift register into upper and lower bits according to said read clock and outputs the divided data, wherein said internal memory stores the data shifted by said first shift register in response to said chip-enable signal,, address signal and read/write control signal. Said decoder unit preferably comprises first and second decoders each connected to said first counter and determine said first and second predetermined levels, respectively. Said first predetermined level is preferably "32" and said second predetermined level "0". Said first clock is preferably obtained by dividing the frequency of said second clock by a factor of two. For a better understanding of the invention, and to show how embodiments of the same may be carried into effect, reference will now be made, by way of example, to the accompanying diagrammatic drawings, in which: Figure 1 is a block diagram of a memory interfacing circuit for a variable-length decoder according to an embodiment of the present invention; Figure 2 is a detailed circuit diagram of the memory interfacing circuit shown in Figure 1; Figures 3A-3G are operational timing diagrams illustrating the write operations of the memory interfacing circuit shown in Figure 2; Figures 4A-4H are operational timing diagrams illustrating the read operations of the memory interfacing circuit shown in Figure 2; Figures 5A-5K are operational timing diagrams illustrating the write operations in the memory interfacing circuit shown in Figure 2, after an accept signal is generated. As shown in Figure 1, a memory interfacing circuit 10 for a variable-length decoder according to the present invention includes a read controller 15 for generating a read chip-enable signal RCEN and a read address RADDR based on a first request signal output from a variable-length decoder (VLD) 21. Read controller 15 generates a second request signal if the read address reaches a predetermined value, and provides the second request signal to an external memory controller 13. Memory interfacing circuit 10 also includes a write controller 17 for generating a write address WADDR and a write section signal which is based on an accept signal VLD-ACCEPT received from external memory controller 13, which is generated with respect to the second request signal. Also included is an internal memory controller 19, which includes an internal memory, for controlling the data provided from an external memory 11 connected to external memory controller 13 to be written to the internal memory according to the WADDR and the write section signals. (Here, although not expressly shown, the internal memory is preferably a FIFO memory or RAM having a capacity of 64 bits x 64 words.) Figure 2 is a detailed circuit diagram of the memory interfacing circuit 10 shown in Figure 1. Read controller 15 comprises five D flip-flops D1-D5, a first multiplexer MUX1, a first counter 151, first and second decoders 152 and 153, a first OR gate O1, a first AND gate A1, and a first NAND gate NA1. Write controller 17 comprises five D flip-flops D6-D10, a second NAND gate N2, a second counter 171, an inverter I1, a second AND gate A2, and second and third OR gates O2 and O3. Internal memory controller 19 comprises a RAM 191, two 64-bit shift registers 192 and 193, two D flip-flops D11 and D12, second and third multiplexers MUX2 and MUX3, a buffer B1, and a third AND gate A3. Figures 3A-3G are operational timing diagrams illustrating the write operations of the memory interfacing circuit shown in Figure 2. Figure 3A shows a 40MHz clock signal CLK40; Figure 3B shows a 20MHz clock signal CLK20; Figure 3C shows a write section signal output from AND gate A2; Figure 3D shows a signal obtained by latching clock signal CLK20 at the falling edges of clock signal CLK40 in flip-flop D11; Figure 3E shows the Q output of D flip-flop D12; Figure 3F shows a write chip-enable signal WCEN output as a result of the OR operation performed by OR gate O3 with respect to clock signal CLK40, the write section signal (Figure 3C) and the Q output (Figure 3E) of D flip-flop D12; and Figure 3G shows a read/write control signal R/W output as a result of the OR operation performed by OR gate O2 with respect to the write section signal (Figure 3C) and the Q output (Figure 3E) of D flip-flop D12. Figures 4A-4H are operational timing diagrams illustrating the read operations of the memory interfacing circuit shown in Figure 2. Figures 4A and 4B show clock signals CLK40 and CLK20, respectively; Figure 4C shows the second request signal output from AND gate A1; Figure 4D shows the output from multiplexer MUX1 which is applied to the select (S) port of multiplexer MUX3; Figure 4E shows the Q output of D flip-flop D4; Figure 4F shows the Q output of D flip-flop D5; Figure 4G shows a read chip-enable signal RCEN output from NAND gate NA1; and Figure 4H shows a read address RADDR output from first counter 151. Figures 5A-5K are operational timing diagrams illustrating a write operation of the memory interfacing circuit shown in Figure 2, after an accept signal is generated. Figure 5A shows clock signal CLK20; Figure 5B shows a VLD-accept signal input to D flip-flop D6; Figure 5C shows a signal obtained by latching the VLD-accept signal at the falling edges of clock signal CLK20, in D flip-flop D6; Figure 5D shows a signal obtained by latching the Q output (Figure 5C) of D flip-flop D6, in D flip-flop D7; Figure 5E shows a signal output from NAND gate NA2; Figure 5F shows a write address WADDR[4:0] (the most significant bit WADDR[5] being predetermined) output from a second counter 171; Figure 5G shows a signal obtained by latching the reset-carry ( RC ) output of second counter 171 at the falling edges of clock signal CLK20, in D flip-flop D9; Figure 5H shows a signal obtained by latching the Q output (Figure 5G) from D flip-flop D9 at the rising edges of clock signal CLK20, in D flip-flop D10; Figure 5I shows a signal obtained by latching the output (Figure 5E) of NAND gate NA2 at the rising edges of clock signal CLK20, in D flip-flop D8; Figure 5J shows the write section signal output from AND gate A2; and Figure 5K shows the data signal to be written in the internal memory at the falling edges of clock signal CLK20. The operation of the memory interfacing circuit according to the present invention will now be described with reference to Figures 1 to 5. The write operation of memory interfacing circuit 10 before the VLD-accept signal is generated, as follows. First, in the internal memory controller 19, the clock signal CLK 20 (Figure 3A) is latched at the falling edges of clock signal CLK 40 (Figure 3B) by the D flip-flop D11 which outputs the signal shown in Figure 3D, and then latched again at the rising edges of clock signal CLK 40 (Figure 3B) by the D flip-flop D12 which outputs the signal shown in Figure 3E. The output (Figure 3E) of the D flip-flop D12 is inverted by the inverter (B1) which outputs the signal shown in Figure 3F. In the write controller 17, a clock signal CLK 40 (Figure 3B), the output (Figure 3 E) of the D flip-flop D12 and the write section signal (Figure 3C) is subjected to an OR operation by the OR gate O3 which output the write chip enable signal WCEN shown in Figure 3G. Also, the write section signal (Figure 3C) and the output (Figure 3F) of the inverter (B1) is subjected to an OR operation by the OR gate O2 which output the read or write signal R/W. In read controller 15, when the first request signal generated from VLD 21 is active, e.g., high, it is latched according to a CLK20 signal (a 20MHz clock signal obtained by dividing the CLK40 clock frequency by two) and then the frequency of the latched signal is divided by two. Here, internal memory controller 19 reads out the data from RAM 191; that is, multiplexer MUX1 toggles the output of D flip-flop D1. On the other hand, multiplexer MUX1 outputs the signal shown in Figure 4D by holding the previously input value, when the first request signal is low. Thus, for every two occurrences of the first request signal, the output value of first counter 151, i.e., read address RADDR (Figure 4H), is increased by one, to read out the data of the internal memory. Here, a read/write control signal R/W is generated together with the read address RADDR. That is, after toggling the first request signal from VLD 21 N times, the request signal is used as a read clock for the internal memory, where N is a function of the number of data bits in a unit of storage of the internal memory and a number of bits in a VLD processing unit. For example, if the ratio of the number of data bits of the internal memory to the number of bits in a VLD processing unit is 64:32, then N is equal to one. Meanwhile, first and second decoders 152 and 153 decode the values "32" and a "0", respectively, among the count values output from first counter 151. The outputs of first and second decoders 152 and 153 are logically combined by OR gate O1. The second request signal (Figure 4C) is generated from the output of OR gate O1 via D flip-flop D2, D flip-flop D3 and AND gate A1, in accordance with clock signal CLK20, and then provided to external memory controller 13. That is, when read address RADDR equals the predetermined values of "32" or "0," so that the data corresponding to these predetermined addresses is read out from RAM 191, the second request signal is provided to external memory controller 13. The output (Figure 4D) of multiplexer MUX1 is latched at the falling edges of clock signal CLK40 by D flip-flop D4 which outputs the signal shown in Figure 4E, and then latched again at the rising edges of clock signal CLK40 by D flip-flop D5 to output the signal shown in Figure 4F. The Q output of D flip-flop D4 and the Q output of D flip-flop D5 are logically combined according to a NAND operation by NAND gate NA1, to generate read chip-enable signal RCEN (Figure 4G) having a rate corresponding to the CLK40 signal. External memory controller 13 receives the second request signal and generates a VLD-accept signal in accordance with a valid time based on the state of other request signals supplied to external memory controller 13 from elsewhere. The VLD-accept signal is then applied to write controller 17. In write controller 17, when the VLD-accept signal (Figure 5B) is generated with respect to the second request signal generated by read controller 15, the VLD-accept signal is latched by D flip-flop D6 in order to output the signal shown in Figure 5C, which is latched again by flip-flop D7 in order to output the signal shown in Figure 5D, each at the falling edges of clock signal CLK20 (Figure 5A). The Q output of D flip-flop D6 and the Q output of D flip-flop D7 are logically combined by NAND gate NA2 and the result is provided as the reset (R) signal to second counter 171. After being reset by the output (Figure 5E) of NAND gate NA2, second counter 171 outputs the count value as shown in Figure 5F, and then the count value is combined with an inverted read address RADDR[5] to generate a write address WADDR[5:0]. Meanwhile, the reset-carry output signal of second counter 171 is latched at the falling edges of clock signal CLK20 (Figure 5A) by D flip-flop D9, to output the signal shown in Figure 5G. The Q output (Figure 5G) of flip-flop D9 is then latched at the rising edges of clock signal CLK20 by D flip-flop 10D, to output the signal shown in Figure 5H. The Q output from flip-flop D9 is also applied to the enable port (EN) of second counter 171. Here, flip-flop D9 is provided for removing a glitch. The output signal (Figure 5E) of NAND gate NA2 is latched at the rising edges of clock signal CLK20 by D flip-flop D8, to output the signal shown in Figure 5I. AND gate A2 performs an AND-operation with respect to the Q output (Figure 5I) of flip-flop D8, the Q output (Figure 5G) of flip-flop D9, and the Q output (Figure 5H) of D flip-flop D10, to output the write section signal shown in Figure 5J. OR gate 02 performs an OR operation with respect to the write section signal (Figure 5J) and the Q output of flip-flop D12 in the internal memory of the internal memory controller 19 and outputs read/write control signal R/W. Here, read/write control signal R/W is maintained in the high state with respect to the remaining section other than a writing slot of the writing section. OR gate 03 performs an OR operation with respect to the write section signal (Figure 5J), the Q output of flip-flop D12 and clock signal CLK40, to generate write chip-enable signal WCEN having a rate corresponding to CLK40. In internal memory controller 19, first 64-bit shift register 192 shifts the incoming serial data, output from external memory controller 13, to generate 64-bit parallel data having a rate corresponding to CLK20, and then provides the parallel data to RAM 191. RAM 191 outputs 64-bit parallel data, which is divided by 64-bit shift register 193 into upper and lower 32-bit signals according to read chip-enable signal RCEN and the result is provided to multiplexer MUX3. Multiplexer MUX3 selects the upper 32 bits or the lower 32 bits according to the signal output from multiplexer MUX1 of read controller 15 and provides the selected data signal to VLD 21. And gate A3 generates a chip-enable signal CEN from read chip-enable signal RCEN and write chip-enable signal WCEN. For the sake of convenience, it is assumed that 64-bit data is stored in locations of external memory 11 and VLD 21 performs VLD-processing with respect to the data by dividing it into 32-bit unit. Thus, when writing data from external memory 11 into RAM 191 of internal memory controller 19, 64-bit data is written. However, when the read address with respect to the second request signal is generated, 64 bit data should be divided into a 32-bit unit, to be provided to VLD 21. Thus, RAM 191 having 64 bits × 64 words in the preferred embodiment of the present invention may be changed based on the particular application. Also, though shown here as being "64," the address of the 64-bit data stored in RAM 191 of internal memory controller 19 can be modified according to the application, since this value is related to the variable-length decoder's processing speed and the maximum delay time until an accept signal for the second VLD request signal is generated. Further, when the read addresses are "0" and "32" among 64-bit data, the second request signal is generated; however, the particular read addresses may be easily changed. The clock signals CLK20 and CLK40 may have other frequencies besides the preferred frequencies of 20MHz and 40MHz, so long as they have same ratio as described above, obtained by dividing the frequency of one of the clock signals by two. The memory interfacing circuit can be applied as a buffer controller for controlling a buffer according to the data input speed, or as a memory interface for an apparatus conforming to the widely used VLD architecture. Also, the interfacing operation can be easily performed regardless of the state of the external memory, by controlling the buffer using a request/accept mode to the external memory. A memory interfacing circuit in accordance with embodiments of the present invention is applied to MPEG compression standards in which the VLD processing unit is comprised of 32 bits and used with a 64 bits external memory, and which can be applied to HDTV systems. As described above, according to the memory interfacing method of the variable-length decoder in an image compressing/restoring apparatus and circuit therefor, the data of the internal memory is read out with respect to the request signal generated by the variable-length decoder, and a high-speed data request signal is provided to the external memory when the empty portion of internal memory exceeds a predetermined level. After the accept signal is generated, the input data is written to the internal memory, so that complex signal processing due to the frequent memory access between a variable-length decoder and external memory, can be simplified. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and/or all of the steps of any method or process so disclosed, may be combined in any combination, except combinations where at least some of such features and/or steps are mutually exclusive.

Claims: A memory interfacing method characterised in being for a variable-length decoder and comprising the steps of: (a) generating a read chip-enable signal and a read address based on a first request signal output from the variable-length decoder, to read out data from an internal memory; (b) generating a second request signal when data stored at an address of said internal memory which exceeds a predetermined level is read out from said internal memory; and (c) generating and applying a write address and a write section signal to said internal memory when an accept signal is generated in response to said second request signal, to write data provided from an external memory to said internal memory. A memory interfacing circuit characterised in being for a variable-length decoder (21) and comprising: a read controller means (15) which generates a read chip-enable signal (RCEN) and a read address (RADDR) based on a first request (FIRST REQUEST) signal output from the variable-length decoder (21), a second request signal (SECOND REQUEST) when said read address (RADDR) reaches a predetermined level, and outputs said second request signal (SECOND REQUEST) to an external memory controller (13) which is connected to an external memory (11); a write controller (17) which receives an accept signal (VLD-ACCEPT) and generates a write address (WADDR) and a write section signal (WRITE SECTION) based on said accept signal (VLD-ACCEPT), wherein said accept signal (VLD-ACCEPT) is generated by said external memory controller (13) in response to said second request signal (SECOND REQUEST); and an internal memory controller (19) having an internal memory (191), which controls data provided from said external memory (11) to be written to said internal memory (191) according to said write address (WADDR) and said write section signal (WRITE SECTION) generated by said write controller (17). A memory interfacing circuit as claimed in claim 2, wherein said read controller (15) comprises: a first multiplexer (MUX1) which receives said first request signal (FIRST REQUEST) and in response thereto generates a read clock; a first counter (151) which receives said read clock and generates said read address (RADDR) by counting according to said read clock; a decoder unit (152, 153) connected to said first counter (151) and determining whether said read address (RADDR) equals one of a first predetermined level and a second predetermined level; a first signal generator (O1, D2, D3, A1) connected to said decoder (152, 153) and generating said second request signal (SECOND REQUEST) based on a decoding result of said decoder unit (152, 153); and a second signal generator (D4, D5, NA1) connected to said first multiplexer (MUX1) and generating said read chip-enable signal (RCEN) based on said read clock. A memory interfacing circuit as claimed in claim 3, wherein said write controller (17) comprises: a third signal generator (D6, D7, NA2) which receives said accept signal (VLD-ACCEPT) and generates a reset signal (R) in response thereto; a second counter (171) which receives said first clock and said reset signal (R), generates said write address (WADDR) by counting according to said first clock, generates a reset-carry signal (RC), and resets the count in response to said reset signal (R); a fourth signal generator (D8-D10, A2) which generates said write section signal (WRITE SECTION) in response to said reset signal (R) and said reset-carry signal (RC) generated by said second counter (171); a fifth signal generator (02) which generates a read/write control signal (R/W) in response to said write section signal (WRITE SECTION) and a signal obtained by latching said first clock according to a second clock; and a sixth signal generator (O3) which generates a write chip-enable signal (WCEN) in response to said second clock, said write section signal and said signal obtained by latching said first clock according to said second clock. A memory interfacing circuit according to claim 4, wherein said read chip-enable signal (RCEN) is based on said read clock and said second clock. A memory interfacing circuit as claimed in claim 4 or 5, wherein said internal memory controller (19) comprises: a second multiplexer (MUX2) which selectively outputs as an address signal said read address (RADDR) and said write address (WADDR) in response to said signal obtained by latching said first clock according to said second clock; a seventh signal generator (A3) which generates a chip-enable signal (CEN) from said read chip-enable signal (RCEN) and said write chip-enable signal (WCEN); a first shift register which receives and shifts data provided from said external memory controller (13); a second shift register (193) which outputs data output from said internal memory (191) according to said read clock; and a third multiplexer (MUX3) which receives and divides data output from said second shift register (193) into upper and lower bits according to said read clock and outputs the divided data, wherein said internal memory (191) stores the data shifted by said first shift register in response to said chip-enable signal (CEN), address signal (ADDR) and read/write control signal (R/W). A memory interfacing circuit as claimed in claim 3, 4, 5 or 6, wherein said decoder unit comprises first (152) and second (153) decoders each connected to said first counter (151) and determine said first and second predetermined levels, respectively. A memory interfacing circuit as claimed in claim 4, 5, 6 or 7, wherein said first predetermined level is "32" and said second predetermined level is "0". A memory interfacing circuit as claimed in any of claims 2 to 8, wherein said read chip-enable signal (RCEN) output from said read controller means (15) is generated by toggling said first request signal N times. A memory interfacing circuit as claimed in claim 9, wherein N is determined according to the number of data bits constituting a unit of storage in said internal memory (191) and the number of bits in a processing unit of the variable-length decoder (VLD). A memory interfacing circuit as claimed in any of claims 2 to 10, wherein said first clock is obtained by dividing the frequency of said second clock by a factor of two.

Inventors: SHIM DAE-YUN, SHIM, DAE-YUN
Applicants: SAMSUNG ELECTRONICS CO LTD, SAMSUNG ELECTRONICS CO., LTD.
Application year: 1996
Main classification: H03M7
IPC codes: H04N7, H03M7, H04N1