Adaptive FIFO memory controller

Abstract: A controller for a First in First out memory (100) comprises detector logic (200) for detecting any difference between the number of addresses in the memory (100) into which data is written and the number of addresses in the memory (100) from which data is read. Comparator logic (220) connected to the detector logic (200) generates a request data transfer signal in response to said difference becoming greater than or equal to a threshold. Threshold select logic (310,320) connected to the comparator logic (220) is responsive to data having first and second portions being written to the memory (100). The threshold select logic (310,320) sets the threshold to a first value when the first portion is being written and sets the threshold to a second value, greater than the first value, when the second portion is being written. Because different thresholds are assoicated with the portions, data, such as a digitised video signal having active line portions separated by control portions for example, can be transferred via the FIFO from one system to another more efficiently in terms of communication bandwidth usage.

Description: The present invention generally relates to First in First Out memories (FIFOs) and particularly relates to an adaptive FIFO memory controller for a digital video communications channel. A FIFO typically comprises a memory array in the form of a stack of addressable bytes of data. Data bytes are written into the stack at addresses specified by a write address counter or "pointer" in response to a write enable signal. Similarly, data bytes are read out of the stack from addresses indicated by a read address pointer in response to a read enable signal. The addresses indicated by the read and write address pointers are incremented by read and write clock signals respectively. The read and write addresses are thus respectively indicative of the number of bytes written to and the number of bytes read from the stack. Because data can be read out of the stack at a different rate to which it was written, FIFOs are useful for providing data communication channels between two data processing systems of different bandwidths. In particular, FIFOs are useful for transferring data to a receiving system that may not be able to accept the data immediately because, for example, it is busy processing data already received. To maximise use of the data channel bandwidth available, data is preferably transferred to the receiving system through the FIFO in blocks or bursts. This usually involves allowing a quantity of data to accumulate in the FIFO before indicating to the receiving system that there is data to be received. The receiving system then reads the burst from the FIFO as a continuous data flow. The flow of data through the FIFO is usually regulated by a FIFO controller. The FIFO controller generates a data transfer request signal to the receiving system when the difference between the number of data bits written to and the number of data bits read from the stack reaches a predetermined threshold or burst value. The receiving system reads the burst from the FIFO in response to the data transfer request signal. EP-A-0 247 317 describes a FIFO memory system comprising detector logic for detecting any difference between the number of addresses in a FIFO memory into which data is written and the number of addresses in the memory from which data is read, and comparator logic for a generating a request data transfer signal in response to said difference becoming grater than or equal to a variable threshold. A similar system is disclosed in US Patent 4,942,553. The FIFO memory apparatus hereinbefore described is useful for transferring bursts of an uninterrupted data flow such as digitised samples of an audio signal for example. However, some data flows, such as digitised samples of video signals for example, can be punctuated by periodic synchronisation codes. The synchronisation codes associated with a digitised video signal separate the data corresponding to successive video lines of a digitised video image and data corresponding to successive video frames. If the number of samples in each video line is not divisible by the burst value, data representing the end of one video line may be retained in the FIFO as data representing the next video line is written to the FIFO. This may result in the retained data being overwritten. The receiving system may not therefore be able to reproduce the edge of the image. It is therefore desirable to ensure that the FIFO is emptied between successive video line transfers. Conventionally, this has been achieved by requesting data transfer whenever there is at least some data in the stack instead of waiting until enough data for a burst transfer has accumulated. However, this mitigates against maximising use of the bandwidth of the data channel. In accordance with the present invention, there is now provided a controller for a First in First out memory, the controller comprising: detector logic for detecting any difference between the number of addresses in the memory into which data is written and the number of addresses in the memory from which data is read; and comparator logic for generating a request data transfer signal in response to said difference becoming greater than or equal to a threshold; characterised in that the controller comprises: threshold select logic responsive to a data stream having alternating first portion and second longer portion being written to the memory, the threshold select logic setting the threshold to a first value when the first portion is being written and setting the threshold to a second value, greater than the first value, when the second portion is being written; the threshold select logic comprising: a control signal generator for setting a single control bit to a first level when a first portion of the data stream is being written and setting the control bit to a second level when a said second portion of the data stream is being written; and a demultiplexor for connecting a first register storing the first value to the comparator logic when the control bit is set to the first level and connecting a second register storing the second value to the comparator logic when the control bit is set to the second level. The present invention is based on the realisation that data having first and second portions, such as a digitised video signal having active line portions separated by control portions for example, can be transferred through a FIFO from one system to another more efficiently in terms of communication bandwidth usage if the two portions are transferred as functions of different thresholds. It will be appreciated that the different thresholds facilitate data transfer at correspondingly different rates. The improvement in efficiency provided by the present invention is therefore particularly apparent where the second portion is much longer than the first portion. Thus, the present invention is particularly useful for transferring digitised video signals from one system to another because the active line portions of video signals are generally much longer than the control portions. Preferably, the threshold select logic comprises: a control signal generator for generating a binary control signal in response to the data being written to the memory, the control signal generator setting the control signal to a first level when the first portion is being written and setting the control signal to a second level when the second portion is being written; and a demultiplexor for connecting a first register storing the first value to the comparator logic when the control signal is set to the first level and connecting a second register storing the second value to the comparator logic when the control signal is set to the second level. Because the first and second levels are stored in registers, they can be changed simply by loading different values into the registers. This advantageously permits the FIFO controller of the present invention to reconfigured in accordance with different types of data. The FIFO controller of the present invention is therefore particularly useful for transferring a digitised video signal from a video capture device to a display adapter in a digital video system in which an image can be resolved into any one of a number of pixel-per-line formats. In a particularly preferred embodiment of the present invention, the control signal generator comprises: a counter having a parallel output for counting addresses in the memory into which data is being written; a first decoder connected to the parallel output for generating a first pulse in response to a first output count; a second decoder connected to the parallel output for generating a second pulse in response to a second output count, the second output count being greater than the first; and a bistable latch connected to the first and second decoders for setting the control signal to the first level in repsonse to the first pulse and setting the control signal to the second level in response to the second pulse. Preferred embodiments of the present invention will now be described with reference to the accompanying drawings in which: Figure 1 is a block diagram of a digital video capture system; Figure 2 is a block diagram of a typical FIFO; Figure 3 is a block diagram of a conventional FIFO controller; Figure 4 is a waveform diagram of a typical video signal; Figure 5 is a block diagram of a FIFO controller of the present invention; Figure 6 is a control signal for the FIFO controller of the present invention; Figure 7 is a block diagram of a logic circuit for generating the control signal; and Figure 8 is a block diagram of another FIFO controller of the present invention. Referring first to Figure 1, an example of a digital video capture system comprises an analogue video source 10 such as a colour video camera, television receiver, video tape player or the like. The video source 10 generates red (R), green (G) and blue (B) video signals. The R,G and B video signals are sampled, digitised and processed by the video capture device 20 to produce digitised luminence and chrominence signals Y and U/V. The digitised Y and U/V signals are received by a receiving system in the form of a display adaptor 30 connected to the bus architecture 50 of a host computer system such as a personal computer. The host computer system comprises a central processing unit 60, random access memory 60, read only storage 95, and large capacity storage 80 such as a hard disk drive, tape streamer or the like, all interconnected by the bus architecture 50. The bus architecture 50 may also be connected to other computer systems in a local area network 90. The display adapter has red, green and blue analogue video outputs (R',G', and B') connected to an analogue video output device 40 such as a colour display device, video tape recorder or the like. It will be appreciated that both the display adapter 30 and the video capture device 20 may be integrated on a single peripheral card adapted to be releasably connected to the bus architecture 50 of the computer system. In operation, the central processing unit 60, under the control of an application computer program, can treat the digitised video image from the video capture device 20 as a data file that can be stored in the random access memory 70 or the storage device 80; communicated to other computer systems on the local area network 90; or adapted by the display adaptor 30 for output to the video output device 40. The digitised Y and U/V signals are sequences of 1 byte samples. Each sequence is transferred to the display adaptor via a data communication channel 25 comprising a first in first out memory (FIFO) and a FIFO controller. Referring now to Figure 2, an example of a FIFO, such as the uPD42101 produced by Nippon Electric Company, comprises a memory array in the form of a stack 100 of m addressable bytes of data. Data bytes are written into the stack in parallel via a 1 byte input buffer 110. Similarly, data bytes are read from the stack 100 in parallel via a 1 byte output buffer 120. A write address counter 130 or "pointer" indicates the memory address into which a byte stored in the input buffer 110 is to be written. Similarly, a read address pointer 140 indicates the memory address from which a byte is to be read into the output buffer 120. The addresses indicated by the read and write address pointers are incremented by read and write clock signals RCLK and WCLK respectively. The read and write addresses are thus respectively indicative of the number of bytes written to and the number of bytes read from the stack 100. A data byte is loaded from the input buffer 110 into the address in the stack 100 specified by the write address pointer 130 in response to a write enable signal WE. Similarly, a data byte is read into the output buffer 120 from an address in the stack 100 specified by the read address pointer 140 in response to a read enable signal RE. Referring now to Figure 3, a conventional FIFO controller typically comprises an up/down counter 200 having a parallel output x and a register 210 having a parallel output n. The parallel outputs x and n are both respectively connected to signal and threshold inputs of a digital comparator 220. WCLK and WE are connected to inputs of an AND gate 230. The output of AND gate 230 is connected a count up clock input of the counter 200. Similarly, RCLK and RE are connected to inputs of an AND gate 240. The output of AND gate 240 is connected a count down clock input of the counter 200. A predetermined burst value is loaded into register 210 to set the threshold of the digital comparator 220. The burst value n specifies the number of data bytes to be read from the FIFO by the receiving system in response to each request data transfer signal. In operation, when WE is set, WCLK is gated by AND gate 230 onto the count up clock input of the counter 200. The counter thus counts up as data bytes are written into successive addresses in the stack 100. Similarly, when RE is set, WCLK is gated by AND gate 240 onto the count down clock input of the counter 200. The counter 200 thus counts down as data bytes are read from successive addresses in the stack 100. Output x therefore indicates the difference between the number of bytes written to and the number of bytes read from the stack 100. When output x becomes greater than or equal to output n (the burst value), the comparator 120 sends a request data transfer signal to the receiving system. With reference to Figure 4, a typical composite colour video signal 400 comprises an active line portion 410, and a control portion including a colour burst 420, a line sync pulse 430, and border portions 440 and 450. Referring now to Figure 5, a preferred example of a FIFO controller of the present invention further comprises a selector 310 and another register 300. A value of "1" is loaded into register 300. The selector 310 is a combinatorial logic circuit responsive to a binary control signal 320 for connecting one of either the burst value n stored in register 210 or "1" stored in register 300 to the threshold input of the comparator 220. In operation, the register 300 is connected to the comparator 220 when the control signal is low and register 210 is connected to the comparator 220 when the control signal is high. With reference to Figure 6, the binary control signal 320 is high during the active line portion 410 of the video signal 400 and low during the control portion. Thus, referring back to Figure 5, during the active line portion 410 of the video signal 400, the threshold input is set to the predetermined burst value n. The comparator 220 therefore generates a request data transfer signal whenever the difference between the number of bytes written to and the number of bytes read from the FIFO 100 is greater than or equal to n. Thus, during the active line portion 410 of the video signal data is read from the FIFO by the display adaptor 30 only in continuous bursts each comprising n bytes. In a particularly preferred embodiment of the present invention, n is set 8. However, it will be appreciated that n could be set to any value below the total number of addresses in the stack. During the control portion of the video signal 400, the threshold input of the comparator 220 is set to "1". The comparator 220 therefore generates a request data transfer signal whenever the difference between the number of bytes written to and the number of bytes read from the FIFO 100, as indicated by counter output x is greater than or equal to "1". Thus, during the control portion of the video signal, the display adapter 30 reads data from the FIFO 100 if there is any difference at all between number of data bytes written to and the number data bytes read from the FIFO 100. Because the threshold is reduced to unity at the end of each active portion, if the number of bytes in each active line portion of the video signal is not divisible by the threshold value n, the residue retained in the FIFO 100 is read by the display adaptor 30 before data corresponding to the next video line is written to the FIFO 100. Data corresponding to the edge of the video image is therefore not lost between transfers of successive video lines. Because the control portion of the video signal 400 is much shorter than the active line portion, most of a video picture captured and digitised by the video capture device 20 is transferred to the display adaptor 30 in bursts thereby maximising use of the bandwidth of the data communication channel. The captured picture can be reproduced in the display adaptor without substantially reducing the rate of picture transmission from the video capture device. It will thus be appreciated that the present invention permits higher speed transmission of interrupted data flows than previously possible. Referring now to Figure 7, an example of a circuit for generating the control signal in accordance with the present invention comprises a counter 550 and a set/reset (SR) latch 580. The count output from the counter 550 is connected to a start decoder 560 and a stop decoder 570. The outputs of the start and stop decoders are respectively connected to the set and reset inputs of the SR latch 580. In operation, an analogue video decoder 500 in the video capture device 20 extracts a line sync signal 530 from the input analogue video signal. A phase locked loop 540 synchronises a sample/hold signal 590 for triggering a sample/hold circuit 510 in the video capture device 20 to the line sync signal 530. The output from the phase locked loop is also used to generate the read and write clock signals, RCLK and WCLK, and the read enable and write enable signals, RE and WE. In addition the output of the phase locked loop is connected to the clock input of the counter 560. The start decoder is configured to generate an output pulse when the counter output reaches a first predetermined value. The output pulse from the start decoder sets the output of the SR latch 580 and the control signal 320 goes high. The stop decoder 570 is configured to generate an output pulse when the counter output reaches a second predetermined value that is greater than the first predetermined value. The output pulse from the stop decoder 570 resets the the output of the SR latch 580 and the control signal 320 goes low. The first and second predetermined values are selected to provide a pulse in the control signal that is of the same length of the control portion of the input video signal. Referring now to Figure 8, another example of the present invention, the inputs of a digital subtracter 600 is connected to parallel outputs of the read and write pointers, 130 and 140, of the FIFO. 100. In operation, the digital subtracter subtracts the write address from the read address to generate the difference, x, between the number of bytes written to and the number of bytes read from the FIFO. In accordance with the present invention, the difference x is compared by the comparator 220 with either the threshold value n or "1" depending on the state of the control signal 320. In the examples of the present invention hereinbefore described, the threshold input is switchable between the predetermined burst value n and "1". It will however be appreciated that, in other examples of the present invention, the threshold input could be switchable between two different burst values both greater than "1". Furthermore, in the examples of the present invention hereinbefore described, each address in the FIFO can hold one byte of data. It will however be appreciated that the present invention is equally applicable to FIFOs in which each address can hold more or less than 8 bits of data. Although examples of the present invention have been described in the foregoing with reference to a colour video capture system, it will now be appreciated that the present invention is equally applicable to monochrome video capture systems.

Claims: A controller for a First in First out memory (100), the controller comprising: detector logic (200) for detecting any difference between the number of addresses in the memory (100) into which data is written and the number of addresses in the memory from which data is read; and comparator logic (220) for generating a request data transfer signal in response to said difference becoming greater than or equal to a threshold; characterised in that the controller comprises: threshold select logic (310,320) responsive to a data stream having alternating first portion and second longer portion being written to the memory (100), the threshold select logic setting the threshold to a first value when the first portion is being written and setting the threshold to a second value, greater than the first value, when the second portion is being written; the threshold select logic (310,320) comprising: a control signal generator for setting a single control bit (320) to a first level when a first portion of the data stream is being written and setting the control bit to a second level when a said second portion of the data stream is being written; and a demultiplexor (310) for connecting a first register (210) storing the first value to the comparator logic (220) when the control bit (320) is set to the first level and connecting a second register (300) storing the second value to the comparator logic (220) when the control bit (320) is set to the second level. A controller as claimed in claim 1, wherein the control signal generator comprises: a counter (550) having a parallel output for counting addresses in the memory into which data is being written; a first decoder (560) connected to the parallel output for generating a first pulse in response to a first output count; a second decoder (560) connected to the parallel output for generating a second pulse in response to a second output count, the second output count being greater than the first; and a bistable latch (580) connected to the first and second decoders for setting the control signal (320) to the first level in repsonse to the first pulse and setting the control signal (320) to the second level in response to the second pulse. A controller as claimed in any preceding claim wherein the detector logic comprises a up/down counter (200) having a parallel output, a count up clock input for incrementing the parallel output in response to data being written an address in the memory (100), and a count down clock input for decrementing the parallel output in response to data being read from an address in the memory (100). A controller as claimed in any claim preceding claim 3 wherein the detector logic comprises subtractor logic (600) for subtracting a write address stored in a write address pointer (130) connected to the memory (100) from a read address stored in a read address pointer (140) connected to the memory (100). A controller as claimed in any preceding claim wherein the first threshold is unity. First in First Out memory apparatus comprising a First In First out memory (100) with a controller as claimed in any preceding claim. A digital video capture system comprising: a video capture device (20), a display adaptor (30), and apparatus as claimed in claim 6 connected to the capture device (20) and the display adaptor (30).

Inventors: CONWAY-JONES DAVID CHARLES, SMITH PETER MARTIN, CONWAY-JONES, DAVID CHARLES, SMITH, PETER MARTIN
Applicants: IBM, INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1991
Main classification: G06F5
IPC codes: H04N5, G06F13, G06F5, G11C7