Abstract:
A circuit adapted to a first-in/first-out device (&#34;FIFO&#34;) is disclosed. The circuit includes a counter and a first end of packet detector that is coupled to the counter. The first end of packet detector increments the counter if an end of packet is detected at an input of the FIFO. The circuit also includes a second end of packet detector coupled to the counter. The second end of packet detector decrements the counter if an end of packet is detected at an output of the FIFO. A detector circuit is coupled to an output of the counter and requests a bus transaction in response to the output of the counter. In another aspect, the present invention is a method of preventing data over-run errors in a receive FIFO having an input and an output. The method includes the steps of monitoring an input of the receive FIFO to determine a number of data packets received, monitoring an output of the receive FIFO for an end of packet to determine a number of data packets drained, and asserting a busy acknowledge line if the difference between the number of data packets received and the number of data packets drained is greater than and alternatively equal to a predetermined value.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates generally to the field of computer systems, and specifically, to a method and apparatus for minimizing asynchronous transmit FIFO under-run and receive FIFO over-run conditions. 
     2. Background Information 
     A general purpose computer system typically includes a processor, memory, and one or more peripheral devices coupled together by one or more buses. Recently, serial peripheral buses (e.g., a universal serial bus &#34;USB&#34;, a 1394 serial bus, IEEE 1394-1995 High Performance Serial Bus IEEE, 1995, etc.) have become increasingly popular in computer systems mainly because they offer a low cost, high performance alternative to other bus architectures. A serial bus architecture typically includes transmit and receive first-in/first-out devices (&#34;FIFOs&#34;), an interface module which interfaces between the computer system bus and the FIFOs, and a serial interface module that operates as an interface between the serial bus (and one or more peripheral devices on the serial bus) and the FIFOs. These serial buses transmit and receive asynchronous data as well as isochronous data depending on the peripheral device coupled to the serial bus. Asynchronous transmission places emphasis on guaranteed delivery of data over guaranteed timing whereas isochronous transmission places emphasis on guaranteed timing of data over delivery of data. 
     For data transmission, the host processor creates a context program in memory, the context program including data and commands. The commands direct how the data is to be assembled for transmission, the destination of the data packets, etc. The interface module retrieves the commands and data packets from memory and places them into the transmit FIFO. However, before data can be read from memory, the interface module must request access to gain control of the system bus. The time that it takes to gain control (referred to as &#34;system bus latency&#34;) of the system bus is non-deterministic and depends on several factors including the bus speed, the number of devices requesting access to gain control of the bus, and the like. 
     As soon as data is placed in the transmit FIFO, transmit FIFO control circuitry requests to transmit the data on the serial bus. Similarly, the time that it takes for a serial bus grant (referred to as &#34;serial bus latency&#34;) is non-deterministic and depends on a number of factors including the serial bus speed, the number of serial peripheral devices on the serial bus, and the amount of isochronous traffic. Once access is granted, the data is transmitted on the serial bus. If the data packet size to be transmitted is greater than the transmit FIFO size, portions (or the balance) of the data packet must be retrieved from memory as the data is drained from the transmit FIFO onto the serial bus. However, if the system bus latency for retrieving the balance of the data packet is greater than the time that it takes to drain the transmit FIFO, an under-run condition will occur. The chances of an under-run condition occurring rapidly increases in a computer system having a heavy traffic on the system bus. An under-run condition is undesirable because it wastes serial bus bandwidth, thus slowing the system down. 
     Accordingly, there is a need in the technology for a method and apparatus to minimize/prevent an asynchronous transmit FIFO under-run condition due to system latencies. 
     Data that is received from a peripheral device on the serial bus in a receive FIFO is placed in memory for processing by the processor. In this case, if data is not placed in memory fast enough, a data over-run condition may occur (i.e., when data is received by a full FIFO to cause data already in the FIFO to be overwritten). The depth of the receive FIFO is one factor in determining the system bus latency that the FIFO can handle without an over-run condition occurring. The issue of system bus latency is exacerbated by the fact that the interface module may need to fetch commands from memory prior to being able to write data from the receive FIFO into memory. That is, a typical asynchronous packet may require a command fetch, data storage, and status write-back, all to different locations in memory. If many small asynchronous packets are received in the receive FIFO, the system bus latency required to fetch commands from and complete the status write-back to memory may greatly exceed the time required to drain the data from the receive FIFO. 
     Accordingly, there is a further need in the technology for a method and apparatus to eliminate over-run conditions in a receive FIFO. 
     SUMMARY OF THE INVENTION 
     In one embodiment, the present invention is a circuit adapted to a first-in/first-out device (&#34;FIFO&#34;). The circuit includes a counter and a first end of packet detector that is coupled to the counter. The first end of packet detector increments the counter if an end of packet is detected at an input of the FIFO. The circuit also includes a second end of packet detector coupled to the counter. The second end of packet detector decrements the counter if an end of packet is detected at an output of the FIFO. A detector circuit is coupled to an output of the counter and requests a bus transaction in response to the output of the counter. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The features and advantages of the present invention will become apparent from the following detailed description of the present invention in which: 
     FIG. 1 illustrates an exemplary computer system suitable for use with the present invention. 
     FIG. 2 illustrates an embodiment of the south bridge in accordance to the teachings of the present invention. 
     FIG. 3 illustrates one embodiment of an asynchronous transmit module of the present invention. 
     FIG. 4 illustrates one embodiment of a receive module of the present invention. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     In the following description, for purposes of explanation, numerous details are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to one skilled in the art that these specific details are not required in order to practice the present invention. As discussed herein, a &#34;computer system&#34; is a product including circuitry capable of processing data. The computer system may include, but is not limited or restricted to, a conventional computer (e.g., laptop, desktop, palmtop, server, mainframe, etc.), hard copy equipment (e.g., printer, plotter, scanner, fax machine, etc.), banking equipment (e.g., an automated teller machine), wireless communication equipment, and the like. 
     FIG. 1 illustrates an exemplary computer system 100 suitable for use with the present invention. The computer system 100 includes a processor 105 coupled to a host bridge 115 (hereinafter referred to as a &#34;north bridge&#34;) by way of host bus 110. Processor 105 may be any type of processor such as a microcontroller or a general purpose microprocessor. In the embodiment shown, the north bridge 115 is a host-to-peripheral component interconnect (&#34;PCI&#34;) bridge, although other bridges may be used in lieu thereof. The north bridge 115 is coupled to a system memory 120 (e.g., dynamic random access memory &#34;DRAM&#34;, static RAM &#34;SRAM&#34;, etc.), PCI bus 130, and a graphics interface 125. The north bridge 115 is responsible for bridging processor transactions to either system memory 120, PCI bus 130, or graphics interface 125. The north bridge 115 also bridges graphics interface 125 or PCI mastered transactions to system memory 120 while initiating processor 105 cache snoop cycles. 
     The PCI bus 130 provides a communication path between processor 105 or system memory 120 and one or more peripheral devices 135 1  -135 M  (e.g., a network interface card, a SCSI controller card, etc.), where &#34;M&#34; is a positive whole number. The PCI bus 130 further provides a communication path between the processor 105 or system memory 120 and a second bridge 140 (hereinafter referred to as a &#34;south bridge&#34;). 
     In one embodiment, the south bridge 140, among other things, serves two major purposes. First, the south bridge 140 bridges transactions between the PCI bus 130 and an expansion bus 145. In the embodiment shown, the expansion bus 145 is an industry standard architecture (&#34;ISA&#34;) bus, although any other type of bus architectures may be used in lieu thereof. The expansion bus 145 provides a communication path between the PCI bus 130 and a plurality of expansion peripheral devices 150 1  -150 N  (e.g., a disk drive controller, a sound card, a modem, a serial and parallel port controller, etc.), where &#34;N&#34; is a positive whole number. 
     Second, the south bridge 140 bridges transactions from the PCI bus 130 and a serial bus 160. In the preferred embodiment, the serial bus is a 1394 serial bus in accordance with &#34;IEEE 1394-1995 High Performance Serial Bus&#34;, published in 1995, although any other serial bus architecture may be used. The south bridge 140 is coupled to a 1394 physical interface 155. The physical interface 155 is coupled to a plurality of nodes 160 1  -160 p  (where &#34;P&#34; is a positive whole number). It is to be appreciated by one skilled in the art that the specific architecture of the computer system 100 is not critical in practicing the present invention, as variations may be made to the computer system 100 without departing from the spirit and scope of the present invention. 
     FIG. 2 illustrates an embodiment of the south bridge 140 in accordance to the teachings of the present invention. Referring to FIGS. 1 and 2, the south bridge 140 includes a PCI interface module 205 which interfaces with a PCI-to-ISA bridge 210 and an arbitration module 215. The PCI-to-ISA bridge 210 allows transactions between one or more expansion peripheral devices 150 1  -150 N  and devices coupled to the PCI bus 130, processor 105, and system memory 120. The arbitration module 215 is coupled to asynchronous transmit module 220 (referred to as &#34;ATX module&#34;), isochronous transmit module 225 (referred to as &#34;ITX module&#34;), and receive module 230. The arbitration module 215 performs the necessary arbitration between ATX, ITX, and receive modules 220, 225, and 230 to access the PCI bus 130. 
     The ATX, ITX, and receive modules 220, 225, and 230 are coupled to a 1394 link interface 235 which provides the necessary interface to the 1394 serial bus. In one embodiment, the 1394 link interface 235 serializes and de-serializes data streams. The 1394 link interface 235 is coupled to the physical link interface 155 which is connected to the 1394 serial bus. In particular, the ATX module 220 transmits asynchronous data packets to peripheral devices on the 1394 serial bus while the ITX module 225 transmits isochronous data packets to peripheral devices on the 1394 serial bus. The receive module 230, on the other hand, receives both asynchronous and isochronous data packets from peripheral devices on the 1394 serial bus. In another implementation, separate asynchronous and isochronous receive modules may be used. Asynchronous transmission places emphasis on guaranteed delivery of data over guaranteed timing whereas isochronous transmission places emphasis on guaranteed timing of data over delivery of data. An example of an isochronous serial peripheral device is a digital camera used for video conferencing. If an isochronous data packet is lost (for any reason), it cannot be re-transmitted whereas if an asynchronous data packet is lost, it can be re-transmitted. Therefore, it is more important to assure that isochronous data packets are not lost or missed. 
     FIG. 3 illustrates one embodiment of an asynchronous transmit module of the present invention. Referring to FIGS. 1-3, the ATX module 220 includes a direct memory access (&#34;DMA&#34;) engine 305 coupled to a transmit FIFO 310 and the arbitration module 215 of FIG. 2 by way of address, data, and control signal lines 355. In one embodiment, the transmit FIFO 310 is four bytes wide (referred to as a &#34;quadlet&#34; of data) and 1 kilo bytes deep, although other arrangements may be used in lieu thereof. For data transmission to a peripheral device on the serial bus, the processor 105 of FIG. 1 creates a context program in memory 120 consisting of command descriptors and data packets. The processor 105 then writes to an internal register of the DMA engine 305 which causes the DMA engine 305 to retrieve the command descriptors and data packets from memory 120. The DMA engine 305 asserts a request line (one of the signal lines 355) to the arbitration unit 215 to request access to the PCI bus 130. Once the request is granted by the PCI bus arbiter (e.g., the north bridge 115), the DMA engine 305 fetches the command descriptors and data packets from system memory 120 and places them in the transmit FIFO 310. However, the transmit FIFO 310 does not request access to transmit the data on the serial bus at this time, as will be explained in greater detail below. 
     The DMA engine 305 is also coupled to a first end of packet (&#34;EOP&#34;) detector 315 which is in turn coupled to a counter 320. The first EOP detector 315 monitors the data placed in the transmit FIFO 310. Once an end of packet marker is detected, the first EOP detector 315 increments the counter 320 by one. The output of the transmit FIFO 310 is coupled to a second EOP detector 330 with an output of the second EOP detector 330 being coupled to the counter 320. The second EOP detector 330 monitors the data drained from the transmit FIFO 310. Once an end of packet marker is drained from the transmit FIFO 310, the second EOP detector 330 decrements the counter 320. In one embodiment, the first and second EOP detectors 415 and 330 detect an end of packet by reading a packet header to obtain the packet size and counting the number of units of data that pass through the transmit FIFO 310. The output of the transmit FIFO is also coupled to a translation module 325 which provides data bus width translations. For example, the translation module 325 translates data buses having different data widths (e.g., quadlet to byte bus width translations). The translation module 325 is coupled to the 1394 link interface 235 and provides the data to the link interface 235 for transmission. 
     The output of the counter 320 is coupled to a zero detector circuit 335. As long as the output of the counter 320 is greater than zero, the zero detector circuit 335 asserts a signal on signal line 340 which indicates that at least one complete packet (or at least an end portion thereof) is fully contained in the transmit FIFO 310. The signal line 340 is coupled to one input of an OR gate 350. The output of the OR gate 350 is a link request line (&#34;LREQ&#34;) which signals to the 1394 link interface 235 of FIG. 2 to request access to the 1394 serial bus. Thus, with the present invention, a request to transmit data on the serial bus is gated until an entire data packet is contained in the transmit FIFO 310 to eliminate system bus latencies, as described in the background section above. 
     Moreover, the transmit FIFO 310 includes a FIFO FULL signal on signal line 345 which is coupled to a second input of the OR gate 350. The FIFO FULL signal indicates that the transmit FIFO 310 is &#34;full&#34; (i.e., filled beyond a predetermined threshold such as 75%, 90%, etc.). In this configuration, the LREQ signal is asserted when the FIFO is &#34;full&#34;. In one embodiment, data in and data out pointer registers may be used as markers to track whether the transmit FIFO 310 is &#34;full&#34;. This gives the DMA engine 305 the maximum amount of time to fetch the rest of the data packet from memory before a data under-run condition occurs. Once the request for transmission on the 1394 serial bus is granted, the DMA engine 305 continues to attempt to keep the transmit FIFO 310 &#34;full&#34; or up to the point where the data packet is completely contained therein. 
     Thus, the LREQ signal line is gated until either the transmit FIFO 310 is &#34;full&#34; or the data packet to be transmitted is completely contained within the transmit FIFO 310. Gating LREQ in this manner minimizes the possibility that when an asynchronous packet is transmitted on the serial bus, an under-run condition will exist. In addition, the present invention allows asynchronous transmit FIFO fills to be independent of the system bus latency until transmission begins on the 1394 serial bus. As such, the south bridge 140 achieves a maximum 1394 serial bus utilization under medium to heavily loaded PCI conditions without dropping large asynchronous data packets. Moreover, the wasting of 1394 bandwidth is minimized when a PCI or any other bus cannot keep up with the 1394 serial bus. The present invention also enables low-priority filling of the transmit FIFO 310 without a 1394 bus request being sent which maximizes PCI bus bandwidth. 
     FIG. 4 illustrates one embodiment of a receive module 230 of the present invention. In this aspect of the present invention, the receive module 230 maintains a receive FIFO in a state to maximize the probability that a large incoming data packet (e.g., an isochronous data packet) will not over-run the receive FIFO. This objective is met by creating a programmable upper bound value in a register for the number of asynchronous packets allowed in the receive FIFO, and rejecting asynchronous packets once this upper bound is exceeded. In one embodiment, the receive module 230 is used for both asynchronous and isochronous data streams. 
     Referring to FIG. 4, the receive module 230 includes a data packet decoder 405 which is coupled to the physical link interface 235 of FIG. 2. The data packet decoder 405 decodes data packets received from the 1394 serial bus and determines whether the data packets are addressed to the receive module 230. If the data packets are addressed to the receive module 230, the data packet decoder 405 forwards the data packets to a receive FIFO 410, otherwise the data packets are ignored. In one embodiment, the receive FIFO 410 is a quadlet of data wide and two kilo-bytes deep, although other arrangements are possible. 
     The receive FIFO 410 receives asynchronous and isochronous data packets from the 1394 serial bus. Once data is received in the receive FIFO 410, a receive DMA engine 430 requests to access the PCI bus 130 and drain the receive FIFO 410 in memory 120. The data packet decoder 405 is also coupled to a first EOP detector 415 which is coupled to a counter 420. When the first EOP detector 415 detects an end of packet received, it increments the counter 420 by one to indicate that an entire packet (or an end portion thereof) was received by the receive FIFO 410. The output of the receive FIFO 410 is coupled to a second EOP detector 425 which is also coupled to the counter 420. The second EOP detector 425 monitors the data packets drained from the receive FIFO 410 for an end of packet. Each time an asynchronous data packet is drained from the top of the receive FIFO 410, the second EOP detector 425 decrements the counter 420 by one. In one embodiment, the first and second EOP detectors 415 and 425 detect an end of packet by reading a packet header to obtain the packet size and counting the number of units of data that pass through the receive FIFO 410. 
     To limit the number of asynchronous packets in the receive FIFO 410, a register 440 (or a memory location) is used to provide a programmable upper bound value. The output of the register 440 and the output of the counter 420 are fed to a comparator 435. If the number of asynchronous data packets in the receive FIFO 410 is equal to (or greater than) the upper bound value in the register 440, the output of the comparator 435 is asserted to causes the data packet decoder 405 to assert an acknowledge/busy signal to the 1394 link interface 235. The acknowledge/busy signal is part of the signals between the data packet decoder 405 and the 1394 link interface 235. An acknowledge/busy condition indicates to the 1394 link interface 235 that the data packet decoder 405 received the asynchronous data packet, but that the data packet could not be accepted at this time. The 1394 link interface 235 will then inform the initiator of the asynchronous data packet to re-transmit the data packet. When the number of asynchronous data packets in the receive FIFO 410 falls below (or is equal to) the upper bound value, the output of comparator 435 is deasserted which causes the data packet decoder 405 to deassert the acknowledge/busy signal. As such, the receive FIFO 410 can now again accept asynchronous data packets. 
     This aspect of the present invention allows a basic input/output system (&#34;BIOS&#34;) to adjust 1394 performance on a system by system basis. In addition, this aspect of the present invention enables future designs to leverage the programming registers to simulate various 1394 utilization models in hardware. This will allow design trade-offs to be visualized prior to implementation. 
     While certain exemplary embodiments have been described and shown in the accompanying drawings, it is to be understood that such embodiments are merely illustrative of and not restrictive on the broad invention, and that this invention not be limited to the specific constructions and arrangements shown and described, since various other modifications may occur to those ordinarily skilled in the art.