Asynchronous FIFO (First In First Out) circuit with margin control at any depth and data processing method
By introducing pointer synchronization module and capacity module into the asynchronous FIFO circuit, arbitrary depth and margin control is achieved, the problems of waste of resources and data errors in traditional asynchronous FIFO circuits are solved, ensuring the integrity and accuracy of data transmission.
Patent Information
- Application Number
- CN202410807161.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-11-01
AI Technical Summary
The depth of traditional asynchronous FIFO circuits usually needs to be power of 2, resulting in waste of resources and inability to effectively analyze read and write margins, which may lead to data errors and disorders.
A asynchronous FIFO circuit with arbitrary depth and margin control is designed. The pointer synchronization module is used to synchronize the read pointer and write pointer. The capacity module is used to determine the empty and full system capacity and calculate the margin to realize the capacity of the asynchronous FIFO circuit. control of any depth and margin.
It effectively avoids the deep waste of traditional asynchronous FIFO circuits, ensures the integrity and accuracy of data transmission, and avoids data errors and disorders caused by insufficient margin.
Smart Images

Figure CN118885149A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of asynchronous signal processing, and in particular to an asynchronous FIFO circuit with arbitrary depth and margin control and a data processing method. Background Art
[0002] In modern integrated circuit chips, asynchronous signal processing across clock domains is common. For multi-bit signal processing across clock domains, the asynchronous first-in-first-out (FIFO) method is usually used, which is also a relatively stable way to process multi-bit signals across clock domains. These asynchronous FIFOs are used for data buffering, data transmission between pipeline stages, and other applications that need to solve the problem of clock domain asynchrony.
[0003] Traditional asynchronous FIFOs need to synchronize the read and write pointers to different clock domains, and usually use Gray code to represent the pointer state to avoid the problem of intermediate states. However, the asynchronous FIFO depth in traditional methods usually needs to be a power of 2, which may lead to a waste of chip resources. For example, if we need a FIFO with a depth of 101, the traditional method will require us to use a depth of 128, which means that 27 idle positions are wasted.
[0004] As the instruction manual Figure 2 As shown in the figure, the traditional asynchronous FIFO circuit structure block diagram is mainly composed of the following parts: write module, read module and dual-port RAM. Reading and writing are in two different clock domains, realizing data transmission across clock domains. The write module works in the write clock domain and mainly processes the write pointer and the Gray code conversion of the write address inside the FIFO; the read module works in the read clock domain and mainly processes the Gray code conversion of the read pointer and the read address. In addition, there are two synchronization modules, whose main function is to synchronize the pointers in the read and write clock domains to the write and read clock domains. The write pointer synchronization module sync_w2r works in the read clock domain, and the read pointer synchronization module sync_r2w works in the write clock domain to determine the empty and full status of the FIFO.
[0005] In asynchronous FIFOs, pointers use Gray code counting. When binary counters are synchronized across clock domains, each bit may change, greatly increasing the probability of errors. For example, for a FIFO with a depth of 16, the counter required is a bit counter. 1920 in binary is 1001110100, and three bits flip on the same signal edge. If a binary counter is used, a handshake signal is also required to confirm that the binary number is safely and completely synchronized to different clock domains, but this will delay the pointer by at least 2 beats, which will have an impact on the empty and full judgment of the FIFO. By introducing Gray code counting, the Gray code corresponding to 1920 in binary is 1101011110, and only one bit will flip, which can solve the problem of multiple bit flips on the same clock edge.
[0006] The main function of the write module is to write data to the FIFO memory and update the write pointer wptr. Each time the write operation of the memory is completed, the write pointer is incremented synchronously. When wptr reaches the maximum value, the write pointer wraps around to the initial value. Similarly, the main function of the read module is to read data from the memory. Each time the data read operation is completed, the read pointer rptr is incremented synchronously. When rptr reaches the maximum value, the read pointer wraps around to the initial value.
[0007] FIFO follows a principle: full cannot be written, empty cannot be read. Therefore, judging whether FIFO is empty or full is a very important part. The empty and full judgment of FIFO is judged by the read-write pointer (wptr and rptr). When the read-write pointer is equal, FIFO is empty. When the read-write pointer differs by the depth of FIFO, FIFO is full. The depth of traditional asynchronous FIFO can only be a power of 2. In actual use, it may cause a large waste of area. For example, if a FIFO with a depth of 600 is required, then when using traditional asynchronous FIFO, the depth of the memory needs to be 424. In actual use, there will be an extra waste of 424 depth, which does not improve the transmission capacity and wastes chip area. In addition, the traditional asynchronous FIFO does not analyze the read and write margin. When transmitting a large amount of continuous data, it is impossible to determine whether the data can be written completely, which may cause data errors and disorder. Summary of the invention
[0008] In view of the fact that the depth of the current traditional asynchronous FIFO circuit is easily wasted and there is no analysis of the read and write margin, which is easy to cause data errors and disorder, the patent of the present invention provides an asynchronous FIFO circuit with arbitrary depth and margin control, which uses a pointer synchronization module to synchronize the read pointer and write pointer, and uses the capacity module to judge the empty and full capacity of the system and calculate the margin.
[0009] To achieve the above object, the embodiments of the present invention adopt the following technical solutions:
[0010] An asynchronous FIFO circuit with arbitrary depth and margin control, the asynchronous FIFO circuit with arbitrary depth and margin control comprising:
[0011] The write module is used to write addresses and data and generate write pointers;
[0012] Read module, used to read addresses and data and generate read pointers;
[0013] Memory, used for storing addresses and data;
[0014] Pointer synchronization module, used for synchronization of write pointer and read pointer;
[0015] The capacity module is used to determine whether the asynchronous FIFO circuit capacity is empty or full and calculate the margin.
[0016] According to one aspect of the present invention, the writing module comprises:
[0017] a write address counter, which is incremented after the write address and the write data are written into the memory;
[0018] a write Gray code decoder for converting a write address counter into a write pointer;
[0019] Write Gray code reverse decoder to convert write pointer to binary.
[0020] According to one aspect of the present invention, the reading module comprises:
[0021] a read address counter, which is incremented after the read address and the read data are read from the memory;
[0022] a read Gray code decoder for converting a read address counter into a read pointer;
[0023] Read Gray code reverse decoder to convert the read pointer into binary.
[0024] According to one aspect of the present invention, the memory includes a write end and an output end, and the asynchronous FIFO circuit with arbitrary depth and margin control also includes:
[0025] The write clock domain is defined as the domain for writing addresses and data into the memory within the same clock signal, and includes at least the write module and the write end of the memory;
[0026] The read clock domain is defined as the domain for reading the address and data in the memory within the same clock signal, and includes at least the output end of the read module and the memory.
[0027] According to one aspect of the present invention, the write clock domain and the read clock domain in the asynchronous FIFO circuit communicate asynchronously, and the pointer synchronization module is used to synchronize the write pointer to the read clock domain and synchronize the read pointer to the write clock domain.
[0028] According to one aspect of the present invention, the pointer synchronization module comprises:
[0029] A write pointer synchronization module, used to synchronize the write pointer to the read clock domain and generate a write synchronization pointer;
[0030] The read pointer synchronization module is used to synchronize the read pointer to the write clock domain and generate a read synchronization pointer.
[0031] According to one aspect of the present invention, the capacity module comprises:
[0032] A full judgment and write margin calculation module, used to judge whether the asynchronous FIFO circuit is full and calculate the write margin;
[0033] The empty judgment and read margin calculation module is used to judge whether the asynchronous FIFO circuit is empty and calculate the read margin.
[0034] According to one aspect of the present invention, the asynchronous FIFO circuit with arbitrary depth and margin control further includes a reset circuit for resetting the write module and the read module.
[0035] According to one aspect of the present invention, the asynchronous FIFO circuit with arbitrary depth and margin control also includes a depth difference, which is the difference between the depth of the asynchronous FIFO circuit and the theoretical depth, and the initial values of the write pointer and the read pointer are the absolute values of the depth difference.
[0036] A method for processing data of an asynchronous FIFO circuit with arbitrary depth and margin control comprises the following steps:
[0037] Write address and data to generate write pointer, read address and data to generate read pointer;
[0038] Synchronize the write pointer to the read clock domain to generate a write synchronization pointer, and synchronize the read pointer to the write clock domain to generate a read synchronization pointer;
[0039] According to the write pointer and the write synchronization pointer, it is judged whether the asynchronous FIFO circuit is full, and the write margin is calculated and output; according to the read pointer and the read synchronization pointer, it is judged whether the asynchronous FIFO circuit is empty, and the read margin is calculated and output;
[0040] When the asynchronous FIFO circuit is full, writing of addresses and data is stopped, and when the asynchronous FIFO circuit is empty, reading of addresses and data is stopped.
[0041] Advantages of the implementation of the present invention: The asynchronous FIFO circuit of arbitrary depth and with margin control described in the present invention includes a write module, a read module, a memory, a pointer synchronization module and a capacity module. The write address and write data are written into the memory through the write module to generate a write pointer. The read address and read data are read from the memory through the read module to generate a read pointer, and the pointer is synchronized through the pointer synchronization module. The write pointer and the read pointer are adjusted through the read module, the write module and the capacity module to realize an asynchronous FIFO circuit of arbitrary depth. The capacity module is used to calculate the empty and full capacity of the asynchronous FIFO circuit and the calculation margin, and the read and write margin of the asynchronous FIFO circuit is controlled. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 This is a block diagram of an asynchronous FIFO circuit with arbitrary depth and margin control according to the first embodiment of the present invention;
[0044] Figure 2 It is a block diagram of the traditional asynchronous FIFO circuit structure described in the background technology of the present invention;
[0045] Figure 3 This is a comparison chart of decimal, pointer and Gray code with a depth of 8;
[0046] Figure 4 This is a write timing diagram according to the first embodiment of the present invention;
[0047] Figure 5 This is a reading timing diagram according to the first embodiment of the present invention;
[0048] Figure 6 This is a flow chart of a data processing method for an asynchronous FIFO circuit with arbitrary depth and margin control as described in the second embodiment of the present invention. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] The terms "including" and "having" and any variations thereof in the embodiments of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product or equipment comprising a series of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products or equipment.
[0051] The naming or numbering of the steps in the embodiments of the present invention does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The execution order of the named or numbered process steps can be changed according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved.
[0052] Reference to an "embodiment" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0053] Embodiment 1
[0054] like Figure 1 As shown, an asynchronous FIFO circuit with arbitrary depth and margin control includes:
[0055] The write module is used to write addresses and data and generate a write pointer wptr;
[0056] The read module is used to read the address and data and generate the read pointer rptr;
[0057] Memory, used for storing addresses and data;
[0058] Pointer synchronization module, used for synchronization of write pointer wptr and read pointer rptr;
[0059] The capacity module is used to determine whether the asynchronous FIFO circuit capacity is empty or full and calculate the margin.
[0060] In this embodiment, the depth of the asynchronous FIFO circuit with any depth and margin control is D, and the required pointer is M. The calculation method is as follows:
[0061]
[0062] Among them, [] is the rounding up operator.
[0063] The memory is a dual-port memory, including a write end and an output end, the write end is connected to the write module, and the output end is connected to the read module; the pointer synchronization module includes a write pointer synchronization module and a read pointer synchronization module; the capacity module includes a full judgment and write margin calculation module, and an empty judgment and read margin calculation module.
[0064] To realize an asynchronous FIFO circuit of arbitrary depth, the initial values of the read pointer rptr and the write pointer wptr represented by Gray code are not 0, but bias. Bias is the difference between the depth of the asynchronous FIFO circuit and the theoretical depth. The actual depth is D. The range of the read address and the write address is expressed in decimal as [0, D-1]. The Gray code of the write pointer wptr and the read pointer rptr is expressed in decimal as [bias, bias+D-1].
[0065] For the convenience of explanation, in this embodiment, the address and data written into the memory are referred to as write address and write data, and the address and data read from the memory are referred to as read address and read data.
[0066] The reading and writing of the asynchronous FIFO circuit are in two different clock domains, which can realize data transmission across clock domains. In the asynchronous FIFO circuit of any depth and with margin control in this application, the clock domain includes a write clock domain and a read clock domain, and the write clock domain communicates asynchronously with the read clock domain.
[0067] The write clock domain includes a write module, a write end of the memory, a read pointer synchronization module, and a full judgment and write margin calculation module. The write clock domain is defined as a domain for writing write addresses and write data into the memory within the same clock signal;
[0068] The read clock domain includes a read module, an output end of the memory, a write pointer synchronization module, and an empty judgment and read margin calculation module. The read clock domain is defined as a domain for reading the read address and read data in the memory within the same clock signal.
[0069] The write module works in the write clock domain, including:
[0070] Write address counter waddr, the write address counter waddr counts in binary, and the counting range is [0,2D-1] (here the counting range is expressed in decimal for convenience). After the write address and write data are written into the memory, the write address counter waddr increases. When the write address counter waddr reaches 2D-1 and counts again, the write address counter waddr returns to 0;
[0071] A write Gray code decoder is used to convert a write address counter into a write pointer wptr, and the write pointer wptr points to a write address of a write end of the memory;
[0072] Write Gray code reverse decoder,The write Gray code reverse decoder can convert the write pointer into binary.
[0073] The read module works in the read clock domain and includes:
[0074] Read address counter raddr, the read address counter raddr counts in binary, and the counting range is [0, 2D-1] (here the counting range is expressed in decimal for convenience). After reading the read address and read data from the memory, the read address counter raddr increases. When the read address counter raddr reaches 2D-1 and counts again, the read address counter raddr returns to 0;
[0075] A read Gray code decoder is used to convert a read address counter into a read pointer, and the read pointer points to a read address of a write end of the memory;
[0076] Read Gray code reverse decoder,The read Gray code reverse decoder can convert the read pointer into binary.
[0077] In this embodiment, the asynchronous FIFO circuit uses Gray code counting, and the read pointer rptr and the write pointer wptr are one bit more than the read address and the write address in the memory. The highest bit of the read pointer rptr and the write pointer wptr, that is, the Mth bit, is used for empty and full and margin calculations. The read address counter raddr and the write address counter waddr are both Mbits. When processing the read address and the write address, the highest bit is removed, and the remaining M-1bit is the read address and the write address of the memory.
[0078] The dual-port memory works in two different read and write clock domains. When data needs to be written to the memory, the data and write address are transferred to the memory in the write clock domain. When data needs to be read out, the memory sends the corresponding data according to the read address in the read clock domain.
[0079] The write pointer synchronization module works in the read clock domain and is used to synchronize the write pointer wptr from the write clock domain to the read clock domain to generate a write synchronization pointer wptr_sync.
[0080] The read pointer synchronization module works in the write clock domain and is used to synchronize the read pointer rptr from the read clock domain to the write clock domain to generate a read synchronization pointer rptr_sync.
[0081] In the asynchronous FIFO circuit, writing is prohibited when the asynchronous FIFO circuit is full, and reading is prohibited when the asynchronous FIFO circuit is empty.
[0082] A full judgment and write margin calculation module, working in the write clock domain, is used to judge whether the asynchronous FIFO circuit is full and calculate the write margin;
[0083] The empty judgment and read margin calculation module operates in the read clock domain and is used to judge whether the asynchronous FIFO circuit is empty and calculate the read margin.
[0084] Specifically, the Gray code reverse decoding module converts the four pointers wptr_sync, rptr_sync, wptr and rptr from Gray code to binary wptr_sync_b, rptr_sync_b, wptr_b and rptr_b, and then processes the binary address to obtain wptr_sync_bin, rptr_sync_bin, wptr_bin and rptr_bin to determine the empty and full of FIFO and calculate the read and write margin of FIFO. This is because there is a bias when the read and write address is converted to the read and write pointer. When calculating, the pointer on the upper part of the dividing line has an additional bias, while the pointer on the lower part does not change. As shown in the figure below, the read and write address 05 is actually mapped to 37 on the dividing line, while it is actually mapped to 05 below the dividing line;
[0085] The full judgment and margin calculation module compares the read synchronization pointer rptr_sync with the write pointer wptr to determine whether the asynchronous FIFO circuit is full, and calculates the value of the write margin through the read synchronization pointer rptr_sync and the write pointer wptr;
[0086] The empty judgment and margin calculation module compares the write synchronization pointer wptr_sync with the read pointer rptr to determine whether the asynchronous FIFO circuit is empty, and calculates the value of the read margin through the write synchronization pointer wptr_sync and the read pointer rptr.
[0087] In practical applications, empty and full judgments are all made using binary, and write margin and read margin are also calculated using binary.
[0088] In the read clock domain, when wptr_sync_addr_bin = rptr_bin, the asynchronous FIFO circuit is judged to be empty. (_addr represents the address, and _bin represents binary data)
[0089] In the write clock domain, when
[0090] When rptr_sync_addr_bin={! wptr_bin[FIFO_ADDR], wptr_bin[FIFO_ADDR-1:0]}, it is determined that the asynchronous FIFO circuit is full.
[0091] The asynchronous FIFO circuit with arbitrary depth and margin control also includes a reset circuit for resetting the writing module and the reading module.
[0092] Specifically, the reset circuit is used to reset the read address counter and the write address counter. During reset, the difference bias is converted to bias_g through the Gray code conversion circuit (i.e., the write Gray code decoder and the read Gray code decoder). The read pointer and the write pointer are reset to bias_g. The actual read and write address length addr_all is introduced. The reset process of the write address counter waddr and the read address counter raddr is as follows:
[0093] When the write address counter waddr receives a write signal and determines that the asynchronous FIFO circuit is not full, the write address counter waddr increases. When the write address counter waddr increases to addr_all, if it is written again, the counter returns to 0;
[0094] When the read address counter raddr receives the read signal and determines that the asynchronous FIFO circuit is not empty, the read address counter raddr increases. When the read address counter raddr increases to addr_all, if it is read again, the counter returns to 0.
[0095] like Figure 3 As shown in the figure, the asynchronous FIFO circuit with a depth of 8 and margin control requires 4 pointers M. If you want to implement an address with a depth of 5, you need to discard 3 pointers. Due to the characteristics of Gray code, when the pointer reaches the maximum value, it will return to the initial position. So with 2 M-1 -1 is the dividing line, which is symmetrical above and below. The Gray code with a decimal value of 3 is 0010, and the symmetrical Gray code with a decimal value of 12 is 1010. Only one bit is flipped, which does not affect the use requirements of the Gray code.
[0096] In actual use, an asynchronous FIFO circuit with a depth of 976 is used to realize the output of read and write margin. The write timing diagram of the asynchronous FIFO circuit is shown in Figure 4, and the read timing diagram is shown in Figure 5. Figure 5 shown.
[0097] The asynchronous FIFO circuit of arbitrary depth and with margin control described in this embodiment includes a write module, a read module, a memory, a pointer synchronization module and a capacity module. The write module writes the write address and write data into the memory to generate a write pointer. The read module reads the read address and read data from the memory to generate a read pointer, and synchronizes the pointer through the pointer synchronization module. The read module, the write module and the capacity module adjust the write pointer and the read pointer to realize an asynchronous FIFO circuit of arbitrary depth. The capacity module is used to calculate the empty and full capacity of the asynchronous FIFO circuit and the calculation margin, and the read and write margin of the asynchronous FIFO circuit is controlled.
[0098] Embodiment 2
[0099] like Figure 6As shown, a data processing method for an asynchronous FIFO circuit with arbitrary depth and margin control includes the following steps:
[0100] Step S1: write address and data to generate a write pointer, read address and data to generate a read pointer;
[0101] In the write clock domain, the write module writes the write address and write data in the write end of the memory, the write address counter waddr increases, and the write address counter waddr is converted into a write pointer wptr by the write Gray code decoder;
[0102] In the read clock domain, the read module reads the read address and the read data from the output of the memory, the read address counter raddr increases, and the read address counter raddr is converted into a read pointer rptr by the read Gray code decoder.
[0103] Step S2: Synchronize the write pointer to the read clock domain to generate a write synchronization pointer, and synchronize the read pointer to the write clock domain to generate a read synchronization pointer;
[0104] In the write clock domain, the read pointer synchronization module synchronizes the read pointer rptr from the read clock domain to the write clock domain, generates the read synchronization pointer rptr_sync, and the write pointer wptr is still retained in the write clock domain;
[0105] In the read clock domain, the write pointer synchronization module synchronizes the write pointer wptr from the write clock domain to the read clock domain, generates a write synchronization pointer wptr_sync, and the read pointer rptr is still retained in the read clock domain.
[0106] Step S3: judging whether the asynchronous FIFO circuit is full according to the write pointer and the write synchronization pointer, calculating and outputting the write margin, judging whether the asynchronous FIFO circuit is empty according to the read pointer and the read synchronization pointer, calculating and outputting the read margin;
[0107] Specifically, the Gray code reverse decoding module converts the four pointers wptr_sync, rptr_sync, wptr and rptr from Gray code to binary wptr_sync_b, rptr_sync_b, wptr_b and rptr_b, and then obtains wptr_sync_bin, rptr_sync_bin, wptr_bin and rptr_bin through processing of the binary address to determine the empty and full of FIFO and calculate the read and write margin of FIFO;
[0108] The full judgment and margin calculation module compares the read synchronization pointer rptr_sync with the write pointer wptr to determine whether the asynchronous FIFO circuit is full, and calculates the value of the write margin through the read synchronization pointer rptr_sync and the write pointer wptr;
[0109] The empty judgment and margin calculation module compares the write synchronization pointer wptr_sync with the read pointer rptr to determine whether the asynchronous FIFO circuit is empty, and calculates the value of the read margin through the write synchronization pointer wptr_sync and the read pointer rptr.
[0110] Step S4: When the asynchronous FIFO circuit is full, stop writing the write address and write data; when the asynchronous FIFO circuit is empty, stop reading the read address and read data.
[0111] In an asynchronous FIFO circuit, writing is prohibited when the asynchronous FIFO circuit is full, and reading is prohibited when the asynchronous FIFO circuit is empty. Therefore, when the asynchronous FIFO circuit is full, writing the write address and writing data is stopped, and when the asynchronous FIFO circuit is empty, reading the address and reading data is stopped.
[0112] The data processing method of an asynchronous FIFO circuit of arbitrary depth and with margin control described in this embodiment converts a read-write address counter into a read-write pointer, synchronizes the read pointer to the write clock domain to generate a read synchronization pointer, synchronizes the write pointer to the read clock domain to generate a write synchronization pointer, compares the write pointer with the read synchronization pointer and the read pointer with the write synchronization pointer to determine whether the asynchronous FIFO circuit is empty or full, and calculates the margin. This method can ensure the normal use of the asynchronous FIFO at an appropriate depth without affecting the requirements for the use of Gray code, avoid depth waste, and the margin analysis can determine whether the data is completely written or read, thereby ensuring data normality.
[0113] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the art within the technical scope disclosed in the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. An asynchronous FIFO circuit with arbitrary depth and margin control, characterized in that: The asynchronous FIFO circuit with any depth and margin control comprises: The write module is used to write addresses and data and generate write pointers; Read module, used to read addresses and data and generate read pointers; Memory, used for storing addresses and data; Pointer synchronization module, used for synchronization of write pointer and read pointer; The capacity module is used to determine whether the asynchronous FIFO circuit capacity is empty or full and calculate the margin.
2. The asynchronous FIFO circuit with any depth and margin control according to claim 1, characterized in that: The writing module comprises: a write address counter, which is incremented after the write address and the write data are written into the memory; a write Gray code decoder for converting a write address counter into a write pointer; Write Gray code reverse decoder to convert write pointer to binary.
3. The asynchronous FIFO circuit with any depth and margin control according to claim 1, characterized in that: The reading module comprises: a read address counter, which is incremented after the read address and the read data are read from the memory; a read Gray code decoder for converting a read address counter into a read pointer; Read Gray code reverse decoder to convert the read pointer into binary.
4. The asynchronous FIFO circuit with any depth and margin control according to claim 1, characterized in that: The memory includes a write end and an output end, and the asynchronous FIFO circuit with arbitrary depth and margin control also includes: The write clock domain is defined as the domain for writing addresses and data into the memory within the same clock signal, and includes at least the write module and the write end of the memory; The read clock domain is defined as the domain for reading the address and data in the memory within the same clock signal, and includes at least the output end of the read module and the memory.
5. The asynchronous FIFO circuit with any depth and margin control according to claim 4, characterized in that: The write clock domain and the read clock domain in the asynchronous FIFO circuit communicate asynchronously, and the pointer synchronization module is used to synchronize the write pointer to the read clock domain and synchronize the read pointer to the write clock domain.
6. The asynchronous FIFO circuit with any depth and margin control according to claim 5, characterized in that: The pointer synchronization module comprises: A write pointer synchronization module, used to synchronize the write pointer to the read clock domain and generate a write synchronization pointer; The read pointer synchronization module is used to synchronize the read pointer to the write clock domain and generate a read synchronization pointer.
7. The asynchronous FIFO circuit with any depth and margin control according to claim 4, characterized in that: The capacity module includes: A full judgment and write margin calculation module, used to judge whether the asynchronous FIFO circuit is full and calculate the write margin; The empty judgment and read margin calculation module is used to judge whether the asynchronous FIFO circuit is empty and calculate the read margin.
8. The asynchronous FIFO circuit with any depth and margin control according to claim 1, characterized in that: The asynchronous FIFO circuit with arbitrary depth and margin control also includes a reset circuit for resetting the write module and the read module.
9. The asynchronous FIFO circuit with any depth and margin control according to claim 1, characterized in that: The asynchronous FIFO circuit with arbitrary depth and margin control also includes a depth difference, where the depth difference is the difference between the depth of the asynchronous FIFO circuit and a theoretical depth, and the initial values of the write pointer and the read pointer are absolute values of the depth difference.
10. A method for processing data in an asynchronous FIFO circuit with arbitrary depth and margin control, characterized in that: The data processing method comprises the following steps: Write address and data to generate write pointer, read address and data to generate read pointer; Synchronize the write pointer to the read clock domain to generate a write synchronization pointer, and synchronize the read pointer to the write clock domain to generate a read synchronization pointer; According to the write pointer and the write synchronization pointer, it is judged whether the asynchronous FIFO circuit is full, and the write margin is calculated and output; according to the read pointer and the read synchronization pointer, it is judged whether the asynchronous FIFO circuit is empty, and the read margin is calculated and output; When the asynchronous FIFO circuit is full, writing of addresses and data is stopped, and when the asynchronous FIFO circuit is empty, reading of addresses and data is stopped.
Citation Information
Cited By
CAN mailbox access device and method based on DSRAM
CN119135652A
