Asynchronous FIFO circuit, asynchronous interrupt processing circuit and system
By designing a simplified asynchronous FIFO circuit and asynchronous interrupt processing circuit, the circuit complexity and metastable state problems in the prior art are solved, and more efficient asynchronous communication and interrupt state information processing are achieved.
Patent Information
- Application Number
- CN202411208135.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-03
AI Technical Summary
In PICC communication, existing asynchronous FIFO circuits and interrupt processing circuits have problems such as complex circuit structure, large area, high power consumption, and errors or loss of interrupt state information due to metastable state.
An asynchronous FIFO circuit and an asynchronous interrupt processing circuit were designed, and a single address synchronization unit was used to realize the synchronization of write addresses and read addresses, which simplified the circuit structure and reduced access power consumption. In the asynchronous interrupt processing circuit, two interrupt states were used. Registers, one holds real-time state, and the other is updated when SPI is not in operation, avoiding metastable problems.
It realizes simplified circuit structure, reduces the reliability of power consumption and interrupt state information of asynchronous FIFO circuits, and avoids read errors and information loss caused by metastable state.
Smart Images

Figure CN119065629A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of near field communication, and in particular to an asynchronous FIFO circuit, an asynchronous interrupt processing circuit and a half-duplex asynchronous communication system. Background Art
[0002] Near Field Communication (NFC) technology can provide short-range wireless connection and realize two-way interactive communication between electronic devices.
[0003] NFC involves two-way communication between proximity coupling devices (PCD), which is equivalent to a reader / writer, and proximity cards (PICC), which is equivalent to electronic tags. In actual applications, in the data downlink path, PCD sends data to PICC; in the data uplink path, PICC sends data to PCD. Uplink and downlink communications are not carried out at the same time, which is a typical half-duplex communication.
[0004] In PICC communication, such as Figure 1 As shown, PICC creates a data link between PCD and microcontroller. The data exchange between the air interface (PICC wireless communication interface) and the serial peripheral interface (Serial Peripheral Interface, SPI) exists in two different clock domains, the air interface clock domain and the SPI interface clock domain. This asynchronous communication can use an asynchronous FIFO (first in, first out) circuit to achieve data synchronization of read and write operations. However, the existing asynchronous FIFO circuit usually uses two synchronizers to synchronize the write address to the read clock domain and synchronize the read address to the write clock domain, which has problems such as complex circuit structure, large area, and high power consumption.
[0005] In PICC communication, the air interface clock is continuous, while the SPI interface clock only exists during SPI communication. Therefore, the interrupt status information is generated in the air interface clock domain and stored in the interrupt status register, and an interrupt trigger signal is generated at the same time. The external microcontroller uses SPI to read the interrupt status information, which needs to be operated in the SPI clock domain. If a new interrupt is generated while reading or clearing the interrupt status information, there is a risk of metastable state causing errors in reading the interrupt status information or loss of the interrupt status information. Summary of the invention
[0006] In view of the problems in the prior art, the embodiments of the present invention provide an asynchronous FIFO circuit, an asynchronous interrupt processing circuit and a half-duplex asynchronous communication system, which can at least partially solve the problems in the prior art.
[0007] In a first aspect, the present invention provides an asynchronous FIFO circuit, comprising a write clock generating unit, a read clock generating unit, a write address generating unit, a read address generating unit, a first Gray code converter, a second Gray code converter, an address synchronization unit, a status information generating unit and a storage unit, wherein:
[0008] A first write clock signal is connected to a first signal input terminal of the write clock generating unit, and a second write clock signal is connected to a second signal input terminal of the write clock generating unit; a first read clock signal is connected to a first signal input terminal of the read clock generating unit, and a second read clock signal is connected to a second signal input terminal of the read clock generating unit; the first write clock signal and the first read clock signal are derived from a first clock domain, and the second write clock signal and the second read clock signal are derived from a second clock domain; the first clock domain and the second clock domain are two different clock domains;
[0009] The output end of the write clock generating unit is connected to the input end of the write address generating unit, the output end of the write address generating unit is connected to the input end of the first Gray code converter, the output end of the first Gray code converter is connected to the first input end of the address synchronization unit; the output end of the address synchronization unit is connected to the input end of the status information generating unit;
[0010] The output end of the read clock generating unit is connected to the input end of the read address generating unit, the output end of the read address generating unit is connected to the input end of the second Gray code converter, and the output end of the second Gray code converter is connected to the second input end of the address synchronization unit;
[0011] The storage unit is connected to the write clock generating unit, the read clock generating unit, the write address generating unit and the read address generating unit respectively.
[0012] Furthermore, the asynchronous FIFO circuit provided by the embodiment of the present invention further includes a first clock gating unit, a second clock gating unit, a third clock gating unit and a fourth clock gating unit, wherein:
[0013] The first clock gating unit is used to generate the first write clock signal according to the first write clock enable signal and the first clock signal of the first clock domain; the second clock gating unit is used to generate the second write clock signal according to the second write clock enable signal and the second clock signal of the second clock domain;
[0014] The third clock gating unit is used to generate the first read clock signal according to the first read clock enable signal and the first clock signal of the first clock domain; the fourth clock gating unit is used to generate the second read clock signal according to the second read clock enable signal and the second clock signal of the second clock domain;
[0015] The first clock gating unit and the second clock gating unit are respectively connected to the write clock generating unit; the third clock gating unit and the fourth clock gating unit are respectively connected to the read clock generating unit.
[0016] Further, the write clock generating unit and the read clock generating unit are OR circuits.
[0017] Furthermore, the storage unit is a random access memory or a register group.
[0018] In a second aspect, the present invention provides an asynchronous interrupt processing circuit, comprising a serial peripheral interface state unit, a clear read signal generating unit and an interrupt trigger signal generating unit, wherein:
[0019] The serial peripheral interface status unit is used to generate a serial peripheral interface status signal according to a chip select signal of the serial peripheral interface and a first clock signal;
[0020] The clear read signal generating unit is used to generate a clear read signal of the interrupt status register and the interrupt status shadow register according to the read signal of the serial peripheral interface, the first clock signal, and the second clock signal;
[0021] The interrupt trigger signal generating unit is used to latch the interrupt status information into the interrupt status register, and when the serial peripheral interface status signal indicates that the serial peripheral interface is idle, synchronize the interrupt status information in the interrupt status register to the interrupt status shadow register to generate an interrupt trigger signal; when the read clear signal is valid, clear the same interrupt status bit in the interrupt status register and the interrupt status shadow register; the interrupt trigger signal generating unit includes the interrupt status register and the interrupt status shadow register;
[0022] The interrupt status information and the first clock signal are generated in a first clock domain; the chip select signal and the second clock signal are generated in a second clock domain, and the first clock domain and the second clock domain are two different clock domains.
[0023] Furthermore, the interrupt trigger signal generating unit is further configured to latch the interrupt status information of the interrupt status register when the read clear signal is valid and the interrupt status information is generated at the same time.
[0024] Further, the interrupt trigger signal generating unit includes a real-time interrupt latch component and an interrupt trigger signal generating component, wherein:
[0025] The real-time interrupt latch component includes an interrupt status register, and the real-time interrupt latch component is used to receive and latch the interrupt status information into the interrupt status register; when the read clear signal is valid, clear the interrupt status bit in the interrupt status register that is the same as that in the interrupt status shadow register; when the read clear signal is valid and the interrupt status information is generated at the same time, latch the interrupt status information of the interrupt status register;
[0026] The interrupt trigger signal generating component includes an interrupt status shadow register, and the interrupt trigger signal generating component is used to synchronize the interrupt status information in the interrupt status register to the interrupt status shadow register when the serial peripheral interface status signal indicates that the serial peripheral interface is idle, generate an interrupt trigger signal, and clear the interrupt status bit in the interrupt status shadow register when the read clear signal is valid.
[0027] Furthermore, the real-time interrupt latch component further includes a first multiplexer, an XOR gate and a first OR gate; the interrupt trigger signal generating component further includes a second multiplexer, a third multiplexer and a second OR gate, wherein:
[0028] A low level is input to the first end of the first multiplexer, a second end of the first multiplexer is connected to the output end of the interrupt status shadow register, a control end of the first multiplexer is connected to the output end of the read clear signal generating unit, an output end of the first multiplexer is connected to the first input end of the XOR gate, a second input end of the XOR gate is connected to the output end of the interrupt status register, an output end of the XOR gate is connected to the first input end of the first OR gate, a second input end of the first OR gate receives the interrupt status information, an output end of the first OR gate is connected to the interrupt status register, the first clock signal is connected to the clock signal input end of the interrupt status register, and an output end of the interrupt status register is connected to the second end of the second multiplexer;
[0029] The first end of the second multiplexer is connected to the output end of the interrupt status shadow register, the control end of the second multiplexer is connected to the output end of the serial peripheral interface state unit, the output end of the second multiplexer is connected to the first end of the third multiplexer, the second end of the third multiplexer inputs a low level, the control end of the third multiplexer is connected to the output end of the read clear signal generating unit, the output end of the third multiplexer is connected to the interrupt status shadow register, the first clock signal is connected to the clock signal input end of the interrupt status shadow register, the output end of the interrupt status shadow register is connected to the input end of the second OR gate, and the output end of the second OR gate outputs the interrupt trigger signal.
[0030] Further, the clear read signal generating unit includes a read indication generating component and a clear read signal generating component, wherein:
[0031] The read indication generating component is used to generate a read operation indication signal according to the read signal of the serial peripheral interface and the second clock signal;
[0032] The read clear signal generating component is used to generate a read clear signal of the interrupt status register and the interrupt status shadow register according to the read operation indication signal and the first clock signal.
[0033] In a third aspect, the present invention proposes a half-duplex asynchronous communication system, comprising the asynchronous FIFO circuit described in any of the above embodiments and the asynchronous interrupt processing circuit described in any of the above embodiments, wherein the asynchronous FIFO circuit transmits the interrupt status information generated in the first clock domain to the asynchronous interrupt processing circuit.
[0034] The asynchronous FIFO circuit, the asynchronous interrupt processing circuit and the half-duplex asynchronous communication system provided by the embodiment of the present invention, the asynchronous FIFO circuit uses a single address synchronization unit to synchronize the write address and the read address to the first clock domain, simplifies the circuit structure, reduces the circuit scale and reduces the access power consumption of the asynchronous FIFO circuit; the asynchronous interrupt processing circuit uses two interrupt status registers, the first one stores the latest real-time interrupt status information, and the second one updates the content of the first register when the SPI is not operated. Since the SPI interface reads the second register information, the metastable problem when the SPI reads the interrupt status information and the new interrupt is generated at the same time is avoided. When the SPI is not operated, an interrupt trigger signal is generated, which can avoid the problem of interruption during the SPI interface access, and improves the reliability of the storage and reading of the interrupt status information. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. 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 creative work. In the drawings:
[0036] Figure 1 It is a schematic diagram of the structure of a half-duplex communication system provided by an embodiment of the present invention.
[0037] Figure 2 It is a schematic diagram of the structure of an asynchronous FIFO circuit provided by an embodiment of the present invention.
[0038] Figure 3 4 is a timing diagram of a write clock signal provided by an embodiment of the present invention.
[0039] Figure 4 4 is a timing diagram of a read clock signal provided by an embodiment of the present invention.
[0040] Figure 5 It is a schematic diagram of the structure of an asynchronous FIFO circuit provided by another embodiment of the present invention.
[0041] Figure 6 is a timing diagram of a first write clock signal provided by an embodiment of the present invention.
[0042] Figure 7 is a timing diagram of a second write clock signal provided by an embodiment of the present invention.
[0043] Figure 8 is a timing diagram of a first read clock signal provided by an embodiment of the present invention.
[0044] Fig. 9 is a timing diagram of a second read clock signal provided by an embodiment of the present invention.
[0045] Fig.10 It is a schematic diagram of the structure of an asynchronous interrupt processing circuit provided by an embodiment of the present invention.
[0046] Fig.11 4 is a timing diagram of a read signal provided by an embodiment of the present invention.
[0047] Fig.12 It is a structural schematic diagram of an interrupt trigger signal generating unit provided in one embodiment of the present invention.
[0048] Fig.13 It is a structural schematic diagram of an interrupt trigger signal generating unit provided in another embodiment of the present invention.
[0049] Fig.14 It is a timing diagram of an interrupt trigger signal provided by an embodiment of the present invention.
[0050] Fig.15 It is a structural schematic diagram of a read signal generating unit provided in one embodiment of the present invention.
[0051] Fig.16 It is a structural schematic diagram of a read signal generating unit provided in another embodiment of the present invention.
[0052] Fig.17 It is a structural diagram of a serial peripheral interface status unit provided by an embodiment of the present invention.
[0053] Fig.18 It is a structural diagram of a half-duplex asynchronous communication system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention. It should be noted that, in the absence of conflict, the embodiments in this application and the features in the embodiments can be combined arbitrarily with each other. The acquisition, storage, use, and processing of data in the technical scheme in this application all comply with the relevant provisions of laws and regulations.
[0055] In view of the problems existing in asynchronous FIFO circuits in PICC communication, an embodiment of the present invention provides an asynchronous FIFO circuit that can synchronize read and write operations to a continuously existing clock domain, which not only reduces the complexity of the clock system and synchronization processing, reduces the circuit scale, but also reduces the access power consumption of the asynchronous FIFO circuit.
[0056] Figure 2 is a schematic diagram of the structure of an asynchronous FIFO circuit provided by an embodiment of the present invention. Figure 2 As shown, the asynchronous FIFO circuit provided by the embodiment of the present invention includes a write clock generating unit 101, a read clock generating unit 102, a write address generating unit 103, a read address generating unit 104, a first Gray code converter 105, a second Gray code converter 106, an address synchronization unit 107, a state information generating unit 108 and a storage unit 109, wherein:
[0057] The first write clock signal is connected to the first signal input terminal of the write clock generating unit 101, and the second write clock signal is connected to the second signal input terminal of the write clock generating unit 101; the first read clock signal is connected to the first signal input terminal of the read clock generating unit 102, and the second read clock signal is connected to the second signal input terminal of the read clock generating unit 102; the first write clock signal and the first read clock signal are derived from a first clock domain, and the second write clock signal and the second read clock signal are derived from a second clock domain; the first clock domain and the second clock domain are two different clock domains;
[0058] The output end of the write clock generating unit 101 is connected to the input end of the write address generating unit 103, the output end of the write address generating unit 103 is connected to the input end of the first Gray code converter 105, the output end of the first Gray code converter 105 is connected to the first input end of the address synchronization unit 107; the output end of the address synchronization unit 107 is connected to the input end of the status information generating unit 108;
[0059] The output end of the read clock generating unit 102 is connected to the input end of the read address generating unit 104, the output end of the read address generating unit 104 is connected to the input end of the second Gray code converter 106, and the output end of the second Gray code converter 106 is connected to the second input end of the address synchronization unit 107;
[0060] The storage unit 109 is connected to the write clock generating unit 101, the read clock generating unit 102, the write address generating unit 103 and the read address generating unit 104 respectively.
[0061] Specifically, the write clock generating unit 101 is capable of receiving write clock signals originating from two different clock domains: a first write clock signal and a second write clock signal. Due to half-duplex operation, the write clock signals of two different clock domains are usually not generated at the same time. The write clock generating unit 101 can generate a write clock signal when the first write clock signal is valid, or generate a write clock signal when the second write clock signal is valid. The output end of the write clock generating unit 101 outputs the write clock signal to the write address generating unit 103. The write address generating unit 103 generates a binary write address. The write address generating unit 103 is a cyclic counter, which accumulates at the rising edge of the write clock signal. If it accumulates to the maximum value, it is reset to the address 0 and accumulates again.
[0062] The read clock generating unit 102 can receive read clock signals from two different clock domains: a first read clock signal and a second read clock signal. Due to half-duplex operation, the read clock signals from two different clock domains are usually not generated at the same time. The read clock generating unit 102 can generate a read clock signal when the first read clock signal is valid, or generate a read clock signal when the second read clock signal is valid. The output end of the read clock generating unit 102 outputs the read clock signal to the read address generating unit 104. The read address generating unit 104 generates a binary read address. The read address generating unit 104 is a cyclic counter, which accumulates at the rising edge of the read clock signal. If the accumulation reaches the maximum value, it is reset to the address 0 and accumulated again.
[0063] For example, Figure 3 As shown, when the first write clock signal Wclk1 is at a high level and the second write clock signal Wclk2 is at a low level, the first write clock signal Wclk1 is valid, and the write clock generation unit 101 generates a write clock signal, that is, ff_wclk is at a high level. When the first write clock signal Wclk1 is at a low level and the second write clock signal Wclk2 is at a high level, the second write clock signal Wclk2 is valid, and the write clock generation unit 101 generates a write clock signal, that is, ff_wclk is at a high level. In the case of half-duplex communication, the first write clock signal Wclk1 and the second write clock signal Wclk2 are not generated at the same time.
[0064] For example, Figure 4 As shown, when the first read clock signal rclk1 is at a high level and the second read clock signal rclk2 is at a low level, the first read clock signal rclk1 is valid, and the read clock generating unit 102 generates a read clock signal, that is, ff_rclk is at a high level. When the first read clock signal rclk1 is at a low level and the second read clock signal rclk2 is at a high level, the second read clock signal Wclk2 is valid, and the read clock generating unit 102 generates a read clock signal, that is, ff_rclk is at a high level. In the case of half-duplex communication, the first read clock signal Wclk1 and the second write clock signal Wclk2 are not generated at the same time.
[0065] The first Gray code converter 105 receives a binary write address from the write address generating unit 103 and converts the binary write address into a Gray code write address. The second Gray code converter 106 receives a binary read address from the read address generating unit 104 and converts the binary read address into a Gray code read address. The address synchronization unit 107 receives the Gray code write address and synchronizes the Gray code write address to the first clock domain. The address synchronization unit 107 receives the Gray code read address and synchronizes the Gray code read address to the first clock domain. The address synchronization unit 107 converts the synchronized Gray code write address and the synchronized Gray code read address to generate a synchronized binary write address and a synchronized binary read address. The state information generating unit 108 generates the state information of the asynchronous FIFO circuit according to the current access state, the first clock signal of the first clock domain, the synchronized binary write address and the synchronized binary read address. The state information of the asynchronous FIFO circuit may include a FIFO overflow indication ff_ov, a FIFO underflow indication ff_uv, a FIFO water level indication ff_flw, etc.
[0066] The storage unit 109 can receive the write clock signal output by the write clock generating unit 101 and the binary write address output by the write address generating unit 103, and write data according to the write clock signal and the binary write address. The storage unit 109 can receive the read clock signal output by the read clock generating unit 102 and the binary read address output by the read address generating unit 104, and read data according to the read clock signal and the binary read address.
[0067] The asynchronous FIFO circuit provided by the embodiment of the present invention uses a single address synchronization unit to synchronize the write address and the read address to the first clock domain, thereby simplifying the circuit structure, reducing the circuit scale and reducing the access power consumption of the asynchronous FIFO circuit.
[0068] Figure 5 FIG. 1 is a schematic diagram of the structure of an asynchronous FIFO circuit provided by another embodiment of the present invention. Figure 5As shown, on the basis of the above embodiments, further, the asynchronous FIFO circuit provided in the embodiment of the present invention further includes a first clock gating unit 110, a second clock gating unit 111, a third clock gating unit 112 and a fourth clock gating unit 113, wherein:
[0069] The first clock gating unit 110 is used to generate the first write clock signal according to the first write clock enable signal and the first clock signal of the first clock domain; the second clock gating unit 111 is used to generate the second write clock signal according to the second write clock enable signal and the second clock signal of the second clock domain;
[0070] The third clock gating unit 112 is used to generate the first read clock signal according to the first read clock enable signal and the first clock signal of the first clock domain; the fourth clock gating unit 113 is used to generate the second read clock signal according to the second read clock enable signal and the second clock signal of the second clock domain;
[0071] The first clock gating unit 110 and the second clock gating unit 111 are connected to the write clock generating unit 101 , respectively; the third clock gating unit 112 and the fourth clock gating unit 113 are connected to the read clock generating unit 102 , respectively.
[0072] Specifically, the first clock gating unit 110 performs gating processing on the first write clock enable signal and the first clock signal to generate a first write clock signal. Figure 6 As shown, when the first clock signal afe_clk is at a high level and the first write clock enable signal afe_we is at a high level, the first write clock signal Wclk1 generated by the first clock gating unit 110 is at a high level. When any one of the first clock signal afe_clk and the first write clock enable signal afe_we is at a low level, the first write clock signal Wclk1 generated by the first clock gating unit 110 is at a low level.
[0073] The second clock gating unit 111 performs gating processing on the second write clock enable signal and the second clock signal to generate a second write clock signal. Figure 7 As shown, when the second clock signal spi_clk is at a high level and the second write clock enable signal spi_we is at a high level, the second write clock signal Wclk2 generated by the second clock gating unit 111 is at a high level. When any of the second clock signal spi_clk and the second write clock enable signal spi_we is at a low level, the second write clock signal Wclk2 generated by the second clock gating unit 111 is at a low level.
[0074] The third clock gating unit 112 performs gating processing on the first read clock enable signal and the first clock signal to generate a first read clock signal. Figure 8As shown, when the first clock signal afe_clk is at a high level and the first read clock enable signal afe_re is at a high level, the first read clock signal rclk1 generated by the third clock gating unit 112 is at a high level. When any one of the first clock signal afe_clk and the first read clock enable signal afe_re is at a low level, the first read clock signal rclk1 generated by the third clock gating unit 112 is at a low level.
[0075] The fourth clock gating unit 113 performs gating processing on the second read clock enable signal and the second clock signal to generate a second read clock signal. Fig. 9 As shown, when the second clock signal spi_clk is at a high level and the second read clock enable signal spi_re is at a high level, the second read clock signal rclk2 generated by the fourth clock gating unit 113 is at a high level. When any of the second clock signal spi_clk and the second read clock enable signal spi_re is at a low level, the second read clock signal rclk2 generated by the fourth clock gating unit 113 is at a low level.
[0076] The first clock gating unit 110, the second clock gating unit 111, the third clock gating unit 112 and the fourth clock gating unit 113 can be implemented by using gating circuits to avoid using complex clock selection circuits, which not only reduces the complexity of the asynchronous FIFO circuit but also reduces the access power consumption of the asynchronous FIFO circuit.
[0077] On the basis of the above embodiments, further, the write clock generating unit 101 is an OR circuit, and the read clock generating unit 102 is an OR circuit.
[0078] When the first write clock signal or the second write clock signal is at a high level, the write clock signal generated by the write clock generating unit 101 is at a high level. In the case of half-duplex operation, the first write clock signal and the second write clock signal are not at a high level at the same time.
[0079] When the first read clock signal or the second read clock signal is at a high level, the read clock signal generated by the read clock generating unit 102 is at a high level. In the case of half-duplex operation, the first read clock signal and the second read clock signal will not be at a high level at the same time.
[0080] On the basis of the above embodiments, further, the storage unit 109 is a random access memory or a register group.
[0081] In PICC communication, the air interface clock is continuous, while the SPI interface clock only exists during SPI communication. Therefore, the interrupt status information is generated in the air interface clock domain and stored in the interrupt status register, and an interrupt trigger signal is generated at the same time. The external microcontroller uses SPI to read the interrupt status information, which needs to be operated in the SPI clock domain. If a new interrupt is generated while reading the interrupt status information or clearing the interrupt status information, there is a risk of metastable state causing errors in reading the interrupt status information or loss of the interrupt status information. In addition, if the interrupt occurs during the SPI interface access, it may also cause the merging of two SPI interface operations, resulting in SPI interface access errors.
[0082] In view of the above problems, an embodiment of the present invention provides an asynchronous interrupt processing circuit, which uses two interrupt status registers, the first of which stores the latest real-time interrupt status information, and the second of which updates the content of the first register when the SPI is not in operation. Since the SPI interface reads the second register information, the metastable problem when the SPI reads the interrupt status information and a new interrupt is generated at the same time is avoided. When the SPI is not in operation, an interrupt trigger signal is generated, which can avoid the problem of interruption during SPI interface access.
[0083] Fig.10 FIG. 1 is a schematic diagram of the structure of an asynchronous interrupt processing circuit provided by an embodiment of the present invention. Fig.10 As shown, the asynchronous interrupt processing circuit provided by the embodiment of the present invention includes a serial peripheral interface state unit 201, a clear read signal generating unit 202 and an interrupt trigger signal generating unit 203, wherein:
[0084] The serial peripheral interface state unit 201 is used to generate a serial peripheral interface state signal according to a chip select signal of the serial peripheral interface and a first clock signal;
[0085] The clear read signal generating unit 202 is used to generate a clear read signal of the interrupt status register and the interrupt status shadow register according to the read signal of the serial peripheral interface, the first clock signal, and the second clock signal;
[0086] The interrupt trigger signal generating unit 203 is used to latch the interrupt status information into the interrupt status register, and when the serial peripheral interface status signal indicates that the serial peripheral interface is idle, synchronize the interrupt status information in the interrupt status register to the interrupt status shadow register to generate an interrupt trigger signal; when the read clear signal is valid, clear the same interrupt status bit in the interrupt status register and the interrupt status shadow register; the interrupt trigger signal generating unit 203 includes the interrupt status register and the interrupt status shadow register;
[0087] The interrupt status information and the first clock signal are generated in a first clock domain; the chip select signal and the second clock signal are generated in a second clock domain, and the first clock domain and the second clock domain are two different clock domains.
[0088] Specifically, the chip select signal of the serial peripheral interface is generated in the second clock domain, so it cannot be used directly in the first clock domain, otherwise there is a risk of metastable propagation. The serial peripheral interface state unit 201 generates a serial peripheral interface state signal according to the chip select signal of the serial peripheral interface and the first clock signal, thereby synchronizing the chip select signal of the serial peripheral interface to the first clock domain. The serial peripheral interface state signal can be used to determine whether the serial peripheral interface is idle.
[0089] The serial peripheral interface generates a read signal of the serial peripheral interface to perform a register read operation on the interrupt status shadow register. The clear read signal generating unit 202 generates a clear read signal of the interrupt status register and the interrupt status shadow register according to the read signal of the serial peripheral interface, the first clock signal, and the second clock signal. The clear read signal is used to clear the interrupt status register and the interrupt status shadow register.
[0090] The interrupt trigger signal generating unit 203 can receive the interrupt status information from the first clock domain and latch it into the interrupt status register, which can save the latest real-time interrupt status information. When the serial peripheral interface status signal indicates that the serial peripheral interface is idle, the interrupt trigger signal generating unit 203 synchronizes the interrupt status information stored in the interrupt status register to the interrupt status shadow register. Since the serial peripheral interface reads the interrupt status information in the interrupt status shadow register, the problem of metastable state caused by the serial peripheral interface reading the interrupt status information and storing the new interrupt status information at the same time can be avoided.
[0091] When the clear read signal is valid, the interrupt trigger signal generating unit 203 will clear the same interrupt status bit in the interrupt status register and the interrupt status shadow register. For example, the clear read signal is 1, indicating that the clear read signal is valid, and the clear read signal is 0, indicating that the clear read signal is invalid. The clear read signal synchronizes the read signal of the serial peripheral interface with the first clock domain, which can ensure that when reading, the information in the interrupt status register has been stably collected to the second clock domain, that is, the clock domain corresponding to the serial peripheral interface, to avoid the loss of the interrupt when a new interrupt and the clear read signal are generated at the same time.
[0092] The first clock domain generates real-time interrupt status information ff_status and stores it in the interrupt status register. If the serial peripheral interface is not in operation, that is, the serial peripheral interface status signal is at a high level, then the interrupt status information stored in the interrupt status register is updated to the interrupt status shadow register. Since this update operation only occurs when the serial peripheral interface is not in operation, it will not affect the access of the serial peripheral interface, and it also avoids the problem of metastable state. If the status bit corresponding to the interrupt status information of the interrupt status shadow register is 1, indicating that the interrupt status information is valid, then an interrupt trigger signal o_irq will be generated, and an external response interrupt will be generated, and the interrupt status information in the interrupt status shadow register will be passed to the SPI. When the SPI reads the interrupt status information, a read clear signal rd_xe will be generated, and the status bits that are consistent with the interrupt status register and the interrupt status shadow register will be cleared, and the newly generated interrupt status information will be retained in the interrupt status register to avoid interrupt loss.
[0093] Since the interrupt status register stores the latest real-time interrupt status, the interrupt status shadow register updates the interrupt status information in the interrupt status register when the SPI is idle, and the serial peripheral interface reads the interrupt status information in the interrupt status shadow register. Therefore, when the SPI generates a register read operation, the content of the interrupt status shadow register is fixed, avoiding the metastable problem when the SPI reads the interrupt status information and a new interrupt is generated at the same time. In addition, when the SPI is not operating, an interrupt trigger signal o_irq is generated, avoiding the problem of interruption during a certain SPI access, ensuring the integrity and correctness of an SPI interface operation, and ensuring that the interrupt will not cause two independent SPI operations to be mistakenly merged into one.
[0094] The asynchronous interrupt processing circuit provided by the embodiment of the present invention adopts two registers to avoid the metastable state and improve the reliability of storage and reading of interrupt status information.
[0095] On the basis of the above embodiments, further, the interrupt trigger signal generating unit 203 is also used to latch the interrupt status information of the interrupt status register when the read clear signal is valid and the interrupt status information is generated at the same time. The read clear signal is valid to clear the information in the interrupt status register. When the read clear signal is valid and the interrupt status information is generated at the same time, in order to avoid clearing the generated interrupt status information, the generated interrupt status information is latched into the interrupt status register.
[0096] Fig.11 is a timing diagram of a read signal provided by an embodiment of the present invention, such as Fig.11As shown, the first clock signal afe_clk is continuous. ff_ov, ff_flw and ff_uv are three different interrupt status information. rd_xe is a read clear signal. INT_reg represents an interrupt status register.
[0097] When the interrupt status information ff_ov is at a high level and the clear read signal rd_xe is at a low level, the interrupt status information ff_ov is stored in the interrupt status register INT_reg. When the interrupt status information ff_ov is at a low level and the clear read signal rd_xe is at a high level, the information in the interrupt status register INT_reg will be cleared. When the interrupt status information ff_flw is at a high level and the clear read signal rd_xe is at a low level, the interrupt status information ff_flw is stored in the interrupt status register INT_reg. When the interrupt status information ff_uv is at a high level and the clear read signal rd_xe is at a high level, the interrupt status information ff_uv is stored in the interrupt status register INT_reg, and the interrupt status register INT_reg will not be cleared. It can be seen that although the clear read signal rd_xe is at a high level at both 1 and 2, and the clear read signal rd_xe is valid, the interrupt status register INT_reg will not be cleared at 2 because the interrupt status information ff_uv is at a high level, and the interrupt status information ff_uv is saved, thereby latching the interrupt status information.
[0098] Fig.12 is a schematic diagram of the structure of an interrupt trigger signal generating unit provided by an embodiment of the present invention, such as Fig.12 As shown, based on the above embodiments, further, the interrupt trigger signal generating unit 203 includes a real-time interrupt latch component 2031 and an interrupt trigger signal generating component 2032, wherein:
[0099] The real-time interrupt latch component 2031 includes an interrupt status register 20311, and the real-time interrupt latch component 2031 is used to receive and latch the interrupt status information to the interrupt status register 20311; when the read clear signal is valid, clear the interrupt status bit in the interrupt status register 20311 that is the same as that in the interrupt status shadow register 20321; when the read clear signal is valid and the interrupt status information is generated at the same time, latch the interrupt status information of the interrupt status register 20311;
[0100] The interrupt trigger signal generating component 2032 includes an interrupt status shadow register 20321. The interrupt trigger signal generating component 2032 is used to synchronize the interrupt status information in the interrupt status register 20311 to the interrupt status shadow register 20321 when the serial peripheral interface status signal indicates that the serial peripheral interface is idle, generate an interrupt trigger signal, and clear the interrupt status bit in the interrupt status shadow register 20321 when the read clear signal is valid.
[0101] Specifically, when the first clock domain generates interrupt status information, it can be latched in real time into the interrupt status register 20311. When the read clear signal is valid, the interrupt status bit in the interrupt status register 20311 that is the same as that in the interrupt status shadow register 20321 can be cleared. The read clear signal is valid to clear the information in the interrupt status register. When the read clear signal is valid and the interrupt status information is generated at the same time, in order to avoid clearing the generated interrupt status information, the generated interrupt status information is latched into the interrupt status register 20311.
[0102] For example, the initial value of the interrupt status register 20311 is 0x00. When the interrupt status information ff_ov is generated, the corresponding bit of the interrupt status information ff_ov in the interrupt status register 20311 is set to 1. When the interrupt status information ff_flw is generated, the corresponding bit of the interrupt status information ff_flw in the interrupt status register 20311 is set to 1.
[0103] For example, when the read clear signal is valid, that is, when the read clear signal is at a high level, and no interrupt status information is generated at the same time, 0x00 is written to the interrupt status register 20311, indicating that all interrupt status registers are cleared to zero; when the read clear signal is valid and interrupt status information is generated at the same time, the interrupt status register 20311 will not be cleared to zero, and the interrupt status register 20311 will latch the latest interrupt status information.
[0104] When the serial peripheral interface is idle, the interrupt trigger signal generating component 2032 updates the real-time interrupt status information in the interrupt status register 20311 to the interrupt status shadow register 20321 and generates a corresponding interrupt trigger signal.
[0105] For example, when the interrupt status information ff_ov is generated and the serial peripheral interface status signal is at a high level, the 0x10 stored in the interrupt status register 20311 is updated to the interrupt status shadow register 20321, and a corresponding interrupt trigger signal is generated; wherein, 0x10 indicates that the bit 4 corresponding to the interrupt status information ff_ov in the interrupt status register 20311 is set to 1, and the serial peripheral interface status signal is at a high level, indicating that the serial peripheral interface is idle. When the interrupt status information ff_flw is generated and the serial peripheral interface status signal is at a high level, the 0x02 stored in the interrupt status register 20311 is updated to the interrupt status shadow register 20321, and a corresponding interrupt trigger signal is generated. 0x02 indicates that the bit 1 corresponding to the interrupt status information ff_flw in the interrupt status register 20311 is set to 1.
[0106] Fig.13is a schematic diagram of the structure of an interrupt trigger signal generating unit provided by another embodiment of the present invention, such as Fig.13 As shown, based on the above embodiments, further, the real-time interrupt latch component 2031 also includes a first multiplexer 20312, an XOR gate 20313 and a first OR gate 20314; the interrupt trigger signal generating component 2032 also includes a second multiplexer 20322, a third multiplexer 20323 and a second OR gate 20324, wherein:
[0107] A low level is input to the first end of the first multiplexer 20312, the second end of the first multiplexer 20312 is connected to the output end of the interrupt status shadow register 20321, the control end of the first multiplexer 20312 is connected to the output end of the clear read signal generating unit 202, the output end of the first multiplexer 20312 is connected to the first input end of the XOR gate 20313, the second input end of the XOR gate 20313 is connected to the output end of the interrupt status register 20311, the output end of the XOR gate 20313 is connected to the first input end of the first OR gate 20314, the second input end of the first OR gate 20314 receives the interrupt status information, the output end of the first OR gate 20314 is connected to the interrupt status register 20311, the first clock signal is connected to the clock signal input end of the interrupt status register 20311, and the output end of the interrupt status register 20311 is connected to the second end of the second multiplexer 20322;
[0108] The first end of the second multiplexer 20322 is connected to the output end of the interrupt status shadow register 20321, the control end of the second multiplexer 20322 is connected to the output end of the serial peripheral interface state unit 201, the output end of the second multiplexer 20322 is connected to the first end of the third multiplexer 20323, the second end of the third multiplexer 20323 inputs a low level, the control end of the third multiplexer 20323 is connected to the output end of the read clear signal generating unit 202, the output end of the third multiplexer 20323 is connected to the interrupt status shadow register 20321, the first clock signal is connected to the clock signal input end of the interrupt status shadow register 20321, the output end of the interrupt status shadow register 20321 is connected to the input end of the second OR gate 20324, and the output end of the second OR gate 20324 outputs the interrupt trigger signal.
[0109] Specifically, the clock signal input end of the interrupt status register 20311 receives the first clock signal afe_clk, and the first clock signal is continuous. When the second input end of the first OR gate 20314 receives the interrupt status information ff_status, it will receive a high level, and then perform an OR operation with the signal received by the first input end of the first OR gate 20314, and output a high level. The high level output of the first OR gate 20314 causes the interrupt status register 20311 to set the bit corresponding to the interrupt status information to 1, thereby realizing the storage of the interrupt status information.
[0110] When the read clear signal rd_xe received by the control end of the first multiplexer 20312 is valid, the output end of the first multiplexer 20312 outputs the interrupt status information received from the interrupt status shadow register 20321. The first input end of the XOR gate 20313 receives the interrupt status information output by the output end of the first multiplexer 20312, and the second input end of the XOR gate 20313 receives the interrupt status information output by the interrupt status register 20311. The XOR gate 20313 performs an XOR operation, and when the two inputs are the same, the output end of the XOR gate 20313 outputs a low level. The first input end of the first OR gate 20314 receives the low level output by the output end of the XOR gate 20313. If the second input end of the first OR gate 20314 does not receive the interrupt status information, it is deemed that the second input end of the first OR gate 20314 inputs a low level. Then the output end of the first OR gate 20314 outputs a low level, so that the interrupt status register 20311 is cleared. If the second input end of the first OR gate 20314 receives the interrupt status information, then the output end of the first OR gate 20314 will output a high level, the interrupt status register 20311 will not be cleared, and the latest interrupt status information will be stored.
[0111] The clock signal input end of the interrupt status shadow register 20321 receives the first clock signal afe_clk, and the first clock signal is continuous. When the serial peripheral interface is idle, the serial peripheral interface state signal ssn_d3 received by the control end of the second multiplexer 20322 is at a high level, the second end of the second multiplexer 20322 receives the interrupt status information from the interrupt status register 20311, and the output end of the second multiplexer 20322 outputs the interrupt status information. If the read clear signal rd_xe received by the control end of the third multiplexer 20323 is invalid, that is, the read clear signal is at a low level, then the third multiplexer 20323 will output the interrupt status information received from the output end of the second multiplexer 20322 to the interrupt status shadow register 20321 for storage. The interrupt status shadow register 20321 outputs the status bit of the interrupt status information to the second OR gate 20324. The second OR gate 20324 performs an OR operation on the status bits of various interrupt status information. If any status bit is at a high level, an interrupt trigger signal o_irq is generated. If the read clear signal received by the control end of the third multiplexer 20323 is valid, that is, the read clear signal is at a high level, the output end of the third multiplexer 20323 will output the low level input by the second end of the third multiplexer 20323 to the interrupt status shadow register 20321, so that the interrupt status shadow register 20321 is cleared.
[0112] It is understandable that when there are multiple interrupt status information, each interrupt status information may correspond to a status bit, and the second OR gate 20324 may perform an OR operation on the status bits of the multiple interrupt status information to output an interrupt trigger signal.
[0113] Fig.14 is a timing diagram of an interrupt trigger signal provided by an embodiment of the present invention, such as Fig.14 When the serial peripheral interface state signal ssn_d3 is at a high level and the interrupt state information ff_ov or ff_flw is at a low level (ie, no interrupt state information is generated), the data stored in the interrupt state register INT_reg and the interrupt state shadow register INTS_reg remain unchanged.
[0114] When the interrupt status information ff_ov is at a high level, the interrupt status register INT_reg stores the interrupt status information ff_ov.
[0115] When the serial peripheral interface status signal ssn_d3 is at a high level, the serial peripheral interface is idle, the interrupt status register INT_reg stores the interrupt status information ff_ov and synchronizes it to the interrupt status shadow register INTS_reg, and generates a corresponding interrupt trigger signal o_irq.
[0116] When the read clear signal rd_xe is valid, that is, the read clear signal rd_xe is at a high level, the interrupt status register INT_reg and the interrupt status shadow register INTS_reg are cleared.
[0117] When the interrupt status information ff_flw is at a high level, the interrupt status register INT_reg stores the interrupt status information ff_flw. When the serial peripheral interface status signal ssn_d3 is at a low level, the interrupt status information ff_flw stored in the interrupt status register INT_reg will not be synchronized to the interrupt status shadow register INTS_reg. When the serial peripheral interface status signal ssn_d3 becomes a high level, the interrupt status information ff_flw stored in the interrupt status register INT_reg is synchronized to the interrupt status shadow register INTS_reg.
[0118] Fig.15 FIG. 1 is a schematic diagram of the structure of a clear read signal generating unit provided by an embodiment of the present invention. Fig.15 As shown, based on the above embodiments, further, the clear read signal generating unit 202 includes a read indication generating component 2021 and a clear read signal generating component 2022, wherein:
[0119] The read indication generating component 2021 is used to generate a read operation indication signal according to the read signal of the serial peripheral interface and the second clock signal;
[0120] The clear-read signal generating component 2022 is used to generate a clear-read signal of the interrupt status register and the interrupt status shadow register according to the read operation indication signal and the first clock signal.
[0121] Specifically, whenever the serial peripheral interface performs a register read operation, the read indication generating component 2021 generates a read operation indication signal according to the read signal of the serial peripheral interface and the second clock signal. The read clear signal generating component 2022 can generate a read clear signal of the interrupt status register and the interrupt status shadow register according to the read operation indication signal and the first clock signal.
[0122] Each time the serial peripheral interface performs a register read operation, the read indication generating component 2021 may flip the read operation indication signal once, and by collecting the edge of the read operation indication signal, it can be known that the serial peripheral interface has performed a read operation of the interrupt status shadow register.
[0123] The clear read signal generating component 2022 can synchronize the read operation indication signal to the first clock domain through standard three-beat synchronization processing, and then perform an XOR operation on the output signals of the next two beats to extract the edge of the read operation indication signal as the clear read signal.
[0124] The clear read signal uses the first clock domain to synchronize the read signal of the serial peripheral interface, which can ensure that when reading clearly, the information in the interrupt status shadow register has been stably collected to the second clock domain, avoiding the problem of interrupt loss when a new interrupt and the clear read signal are generated at the same time.
[0125] For example, Fig.16 As shown, the read indication generating component 2021 includes a first XOR gate 20211 and a first D flip-flop 20212, and the read clear signal generating component 2022 includes a second D flip-flop 20221, a third D flip-flop 20222, a fourth D flip-flop 20223, and a second XOR gate 20224, wherein:
[0126] The first input end of the first XOR gate 20211 inputs the read signal spi_re of the serial peripheral interface, the second input end of the first XOR gate 20211 is connected to the output end of the first D flip-flop 20212, the output end of the first XOR gate 20211 is connected to the data input end of the first D flip-flop 20212, the clock input end of the first D flip-flop 20212 inputs the second clock signal spi_clk, the main output end of the first D flip-flop 20212 is connected to the data input end of the second D flip-flop 20221, and the main output end of the first D flip-flop 20212 outputs the read operation indication signal spi_rdi.
[0127] The second D flip-flop 20221, the third D flip-flop 20222 and the fourth D flip-flop 20223 are connected in sequence, the main output end of the second D flip-flop 20221 is connected to the data input end of the third D flip-flop 20222, and the main output end of the third D flip-flop 20222 is connected to the data input end of the fourth D flip-flop 20223; the clock input end of the second D flip-flop 20221, the clock input end of the third D flip-flop 20222 and the clock input end of the fourth D flip-flop 20223 are respectively connected to the first clock signal afe_clk; the first input end of the second XOR gate 20224 is connected to the main output end of the third D flip-flop 20222, the second input end of the second XOR gate 20224 is connected to the main output end of the fourth D flip-flop 20223, and the output end of the second XOR gate 20224 outputs a read clear signal rd_xe.
[0128] Fig.17 is a schematic diagram of the structure of a serial peripheral interface state unit provided by an embodiment of the present invention, such as Fig.17 As shown, the serial peripheral interface state unit 201 includes a fifth D flip-flop 2011, a sixth D flip-flop 2012 and a seventh D flip-flop 2013, wherein:
[0129] The clock input terminal of the fifth D flip-flop 2011, the clock input terminal of the sixth D flip-flop 2012 and the clock input terminal of the seventh D flip-flop 2013 are respectively connected to the first clock signal afe_clk, the data input terminal of the fifth D flip-flop 2011 receives the chip select signal ssn of the serial peripheral interface, the main output terminal of the fifth D flip-flop 2011 is connected to the data input terminal of the sixth D flip-flop 2012, the main output terminal of the sixth D flip-flop 2012 is connected to the data input terminal of the seventh D flip-flop 2013, and the main output terminal of the seventh D flip-flop 2013 outputs the serial peripheral interface status signal ssn_d3.
[0130] The chip select signal of the serial peripheral interface is generated in the clock domain of the serial peripheral interface (i.e., the second clock domain), so it cannot be used directly in the first clock domain, otherwise there is a risk of metastable propagation, and synchronization processing is required. Through standard single-bit synchronization processing, the chip select signal is beaten three times in the first clock domain to generate a synchronized serial peripheral interface status signal. When the serial peripheral interface status signal is high, it indicates that the serial peripheral interface is idle; when the serial peripheral interface status signal is low, it indicates that the serial peripheral interface is in use.
[0131] Fig.18 FIG. 1 is a schematic diagram of the structure of a half-duplex asynchronous communication system provided by an embodiment of the present invention. Fig.18 As shown, the half-duplex asynchronous communication system provided by an embodiment of the present invention includes the asynchronous FIFO circuit 301 described in any of the above embodiments and the asynchronous interrupt processing circuit 302 described in any of the above embodiments. The asynchronous FIFO circuit 301 transmits the interrupt status information generated in the first clock domain to the asynchronous interrupt processing circuit 302.
[0132] The half-duplex asynchronous communication system provided by the embodiment of the present invention operates in two different clock domains. The asynchronous FIFO circuit 301 and the asynchronous interrupt processing circuit 302 can receive the first clock signal afe_clk and the second clock signal spi_clk respectively. The asynchronous FIFO circuit 301 can output interrupt status information ff_status based on the first write clock enable signal afe_we and the first read clock enable signal afe_re and the first clock signal afe_clk from the first clock domain, the second write clock enable signal spi_we and the second read clock enable signal spi_re and the second clock signal spi_clk from the second clock domain, and the interrupt status information ff_status can include FIFO overflow indication ff_ov, FIFO underflow indication ff_uv, FIFO water level indication ff_flw, etc.
[0133] The asynchronous FIFO circuit 301 outputs the generated interrupt status information ff_status to the asynchronous interrupt processing circuit 302. The asynchronous interrupt processing circuit 302 can output the interrupt trigger signal o_irq based on the first clock signal, the second clock signal, the chip select signal ssn of the serial peripheral interface, the read signal spi_re of the serial peripheral interface and the interrupt status information ff_status. The read signal of the serial peripheral interface and the second read clock enable signal are the same signal.
[0134] The specific structures and working processes of the asynchronous FIFO circuit 301 and the asynchronous interrupt processing circuit 302 are described above and will not be described in detail here.
[0135] The half-duplex asynchronous communication system provided by the embodiment of the present invention simplifies the circuit structure, reduces the circuit scale and reduces the access power consumption of the asynchronous FIFO circuit due to the use of an asynchronous FIFO circuit. The asynchronous interrupt processing circuit is used to avoid metastable conditions and improve the reliability of interrupt status information storage and reading.
[0136] In the description of this specification, the description with reference to the terms "one embodiment", "a specific embodiment", "some embodiments", "for example", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0137] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. An asynchronous FIFO circuit, characterized in that: It includes a write clock generating unit, a read clock generating unit, a write address generating unit, a read address generating unit, a first Gray code converter, a second Gray code converter, an address synchronization unit, a state information generating unit and a storage unit, wherein: A first write clock signal is connected to a first signal input terminal of the write clock generating unit, and a second write clock signal is connected to a second signal input terminal of the write clock generating unit; a first read clock signal is connected to a first signal input terminal of the read clock generating unit, and a second read clock signal is connected to a second signal input terminal of the read clock generating unit; the first write clock signal and the first read clock signal are derived from a first clock domain, and the second write clock signal and the second read clock signal are derived from a second clock domain; the first clock domain and the second clock domain are two different clock domains; The output end of the write clock generating unit is connected to the input end of the write address generating unit, the output end of the write address generating unit is connected to the input end of the first Gray code converter, the output end of the first Gray code converter is connected to the first input end of the address synchronization unit; the output end of the address synchronization unit is connected to the input end of the status information generating unit; The output end of the read clock generating unit is connected to the input end of the read address generating unit, the output end of the read address generating unit is connected to the input end of the second Gray code converter, and the output end of the second Gray code converter is connected to the second input end of the address synchronization unit; The storage unit is connected to the write clock generating unit, the read clock generating unit, the write address generating unit and the read address generating unit respectively.
2. The asynchronous FIFO circuit according to claim 1, characterized in that: It also includes a first clock gating unit, a second clock gating unit, a third clock gating unit and a fourth clock gating unit, wherein: The first clock gating unit is used to generate the first write clock signal according to the first write clock enable signal and the first clock signal of the first clock domain; the second clock gating unit is used to generate the second write clock signal according to the second write clock enable signal and the second clock signal of the second clock domain; The third clock gating unit is used to generate the first read clock signal according to the first read clock enable signal and the first clock signal of the first clock domain; the fourth clock gating unit is used to generate the second read clock signal according to the second read clock enable signal and the second clock signal of the second clock domain; The first clock gating unit and the second clock gating unit are respectively connected to the write clock generating unit; the third clock gating unit and the fourth clock gating unit are respectively connected to the read clock generating unit.
3. The asynchronous FIFO circuit according to claim 1, characterized in that: The write clock generating unit and the read clock generating unit are OR circuits.
4. The asynchronous FIFO circuit according to any one of claims 1 to 3, characterized in that: The storage unit is a random access memory or a register group.
5. An asynchronous interrupt processing circuit, characterized in that: It includes a serial peripheral interface status unit, a read clear signal generating unit and an interrupt trigger signal generating unit, wherein: The serial peripheral interface status unit is used to generate a serial peripheral interface status signal according to a chip select signal of the serial peripheral interface and a first clock signal; The clear read signal generating unit is used to generate a clear read signal of the interrupt status register and the interrupt status shadow register according to the read signal of the serial peripheral interface, the first clock signal, and the second clock signal; The interrupt trigger signal generating unit is used to latch the interrupt status information into the interrupt status register, and when the serial peripheral interface status signal indicates that the serial peripheral interface is idle, synchronize the interrupt status information in the interrupt status register to the interrupt status shadow register to generate an interrupt trigger signal; when the read clear signal is valid, clear the same interrupt status bit in the interrupt status register and the interrupt status shadow register; the interrupt trigger signal generating unit includes the interrupt status register and the interrupt status shadow register; The interrupt status information and the first clock signal are generated in a first clock domain; the chip select signal and the second clock signal are generated in a second clock domain, and the first clock domain and the second clock domain are two different clock domains.
6. The asynchronous interrupt processing circuit according to claim 5, characterized in that: The interrupt trigger signal generating unit is further configured to latch the interrupt status information of the interrupt status register when the read clear signal is valid and the interrupt status information is generated at the same time.
7. The asynchronous interrupt processing circuit according to claim 5, characterized in that: The interrupt trigger signal generating unit comprises a real-time interrupt latch component and an interrupt trigger signal generating component, wherein: The real-time interrupt latch component includes an interrupt status register, and the real-time interrupt latch component is used to receive and latch the interrupt status information into the interrupt status register; when the read clear signal is valid, clear the interrupt status bit in the interrupt status register that is the same as that in the interrupt status shadow register; when the read clear signal is valid and the interrupt status information is generated at the same time, latch the interrupt status information of the interrupt status register; The interrupt trigger signal generating component includes an interrupt status shadow register, and the interrupt trigger signal generating component is used to synchronize the interrupt status information in the interrupt status register to the interrupt status shadow register when the serial peripheral interface status signal indicates that the serial peripheral interface is idle, generate an interrupt trigger signal, and clear the interrupt status bit in the interrupt status shadow register when the read clear signal is valid.
8. The asynchronous interrupt processing circuit according to claim 7, characterized in that: The real-time interrupt latch component further includes a first multiplexer, an XOR gate and a first OR gate; the interrupt trigger signal generating component further includes a second multiplexer, a third multiplexer and a second OR gate, wherein: A low level is input to the first end of the first multiplexer, a second end of the first multiplexer is connected to the output end of the interrupt status shadow register, a control end of the first multiplexer is connected to the output end of the read clear signal generating unit, an output end of the first multiplexer is connected to the first input end of the XOR gate, a second input end of the XOR gate is connected to the output end of the interrupt status register, an output end of the XOR gate is connected to the first input end of the first OR gate, a second input end of the first OR gate receives the interrupt status information, an output end of the first OR gate is connected to the interrupt status register, the first clock signal is connected to the clock signal input end of the interrupt status register, and an output end of the interrupt status register is connected to the second end of the second multiplexer; The first end of the second multiplexer is connected to the output end of the interrupt status shadow register, the control end of the second multiplexer is connected to the output end of the serial peripheral interface status unit, the output end of the second multiplexer is connected to the first end of the third multiplexer, the second end of the third multiplexer inputs a low level, the control end of the third multiplexer is connected to the output end of the read clear signal generating unit, the output end of the third multiplexer is connected to the interrupt status shadow register, the first clock signal is connected to the clock signal input end of the interrupt status shadow register, the output end of the interrupt status shadow register is connected to the input end of the second OR gate, and the output end of the second OR gate outputs the interrupt trigger signal.
9. The asynchronous interrupt processing circuit according to any one of claims 6 to 8, characterized in that: The clear read signal generating unit comprises a read indication generating component and a clear read signal generating component, wherein: The read indication generating component is used to generate a read operation indication signal according to the read signal of the serial peripheral interface and the second clock signal; The read clear signal generating component is used to generate a read clear signal of the interrupt status register and the interrupt status shadow register according to the read operation indication signal and the first clock signal.
10. A half-duplex asynchronous communication system, characterized in that: The method comprises the asynchronous FIFO circuit as claimed in any one of claims 1 to 4 and the asynchronous interrupt processing circuit as claimed in any one of claims 5 to 9, wherein the asynchronous FIFO circuit transmits interrupt status information generated in the first clock domain to the asynchronous interrupt processing circuit.
