CN120045140B - Multi-port synchronous FIFO data reading method, device, system, equipment and medium - Google Patents
Multi-port synchronous FIFO data reading method, device, system, equipment and mediumInfo
- Publication number
- CN120045140B CN120045140B CN202510510276.2A CN202510510276A CN120045140B CN 120045140 B CN120045140 B CN 120045140B CN 202510510276 A CN202510510276 A CN 202510510276A CN 120045140 B CN120045140 B CN 120045140B
- Authority
- CN
- China
- Prior art keywords
- data
- read
- port
- fifo
- address
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/061—Improving I/O performance
- G06F3/0611—Improving I/O performance in relation to response time
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F5/00—Methods or arrangements for data conversion without changing the order or content of the data handled
- G06F5/06—Methods or arrangements for data conversion without changing the order or content of the data handled for changing the speed of data flow, i.e. speed regularising or timing, e.g. delay lines, FIFO buffers; over- or underrun control therefor
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Communication Control (AREA)
- Multi Processors (AREA)
Abstract
Description
技术领域Technical Field
本申请涉及处理器技术领域,具体地,涉及一种多口同步FIFO数据读取方法、装置、系统、设备及介质。The present application relates to the field of processor technology, and in particular to a multi-port synchronous FIFO data reading method, apparatus, system, device and medium.
背景技术Background Art
在现代数字系统设计中,多口同步先进先出(First-In First-Out,FIFO)存储器作为一种具有多个读写端口的先进先出队列存储结构,且所有的读写操作都基于同一个全局时钟信号进行同步控制,已经广泛应用于各类数据处理与传输场景中,例如高速数据采集系统、网络通信设备以及多媒体信号处理平台等。在这些应用场景下,多口同步FIFO能够实现不同时钟域之间的数据缓冲与协调,确保数据在多个模块间高效、稳定地流通。In modern digital system design, multi-port synchronous First-In First-Out (FIFO) memory, a first-in, first-out queue storage structure with multiple read and write ports, where all read and write operations are synchronized based on a single global clock signal, has been widely used in various data processing and transmission scenarios, such as high-speed data acquisition systems, network communication equipment, and multimedia signal processing platforms. In these applications, multi-port synchronous FIFOs can buffer and coordinate data between different clock domains, ensuring efficient and stable data flow across multiple modules.
目前,相关技术中采用经典的多口同步FIFO电路结构,在经典多口同步FIFO的设计结构中,读操作时每个输出口从寄存器堆选数据需经过与FIFO深度绑定的大多路复用器MUX。随着对FIFO深度需求增大,MUX输入端口增多,内部组合逻辑更复杂,产生较大延时(Delay1),从而导致整个系统的运行速度和性能降低。Currently, related technologies use a classic multi-port synchronous FIFO circuit structure. In this design, each output port selects data from the register stack during a read operation through a large multiplexer (MUX) tied to the FIFO depth. As the demand for FIFO depth increases, the number of MUX input ports increases, and the internal combinational logic becomes more complex, resulting in a longer delay (Delay1), which reduces the speed and performance of the entire system.
发明内容Summary of the Invention
本申请实施例中提供了一种多口同步FIFO数据读取方法、装置、系统、设备及介质。Embodiments of the present application provide a multi-port synchronous FIFO data reading method, apparatus, system, device, and medium.
本申请实施例的第一个方面,提供了一种多口同步FIFO数据读取方法,该方法包括:A first aspect of an embodiment of the present application provides a multi-port synchronous FIFO data reading method, the method comprising:
当多个读口并行触发对应的数据读取请求时,获取每个所述读口对应的读使能信号和FIFO的当前状态信息;所述读使能信号用于指示所述读口是否进行读操作;When multiple read ports trigger corresponding data read requests in parallel, obtain a read enable signal corresponding to each read port and current status information of the FIFO; the read enable signal is used to indicate whether the read port performs a read operation;
对于每个所述读口,根据所述读使能信号和所述FIFO的当前状态信息确定目标地址;所述目标地址用于表征数据读取地址的标识;For each of the read ports, a target address is determined according to the read enable signal and the current state information of the FIFO; the target address is used to represent an identifier of a data read address;
根据所述目标地址,通过多路复用器从寄存器堆中或写口数据中选择目标数据;所述写口数据是指当前正在写入FIFO的数据;According to the target address, target data is selected from the register file or the write port data through a multiplexer; the write port data refers to the data currently being written into the FIFO;
将所述目标数据通过输入口输入寄存器执行打拍操作并通过所述FIFO对应的数据读取接口执行读取操作。The target data is input into the register through the input port to perform a beat operation and a read operation is performed through the data read interface corresponding to the FIFO.
本申请实施例的第二个方面,提供了一种多口同步FIFO数据读取装置,包括:A second aspect of an embodiment of the present application provides a multi-port synchronous FIFO data reading device, comprising:
获取模块,用于当多个读口并行触发对应的数据读取请求时,获取每个所述读口对应的读使能信号和FIFO的当前状态信息;所述读使能信号用于指示所述读口是否进行读操作;An acquisition module, configured to acquire a read enable signal corresponding to each read port and current status information of the FIFO when corresponding data read requests are triggered in parallel by multiple read ports; the read enable signal is used to indicate whether the read port performs a read operation;
确定模块,用于对于每个所述读口,根据所述读使能信号和所述FIFO的当前状态信息确定目标地址;所述目标地址用于表征数据读取地址的标识;a determination module, configured to determine, for each of the read ports, a target address according to the read enable signal and the current state information of the FIFO; the target address being used to identify a data read address;
选择模块,用于通过所述目标地址,通过多路复用器从寄存器堆中或写口数据中选择目标数据;所述写口数据是指当前正在写入FIFO的数据;A selection module is used to select target data from a register file or write port data through a multiplexer according to the target address; the write port data refers to data currently being written into the FIFO;
读取模块,用于将所述目标数据通过寄存器执行打拍操作并通过所述多口同步FIFO数据读取接口执行读取操作。The reading module is used to perform a beat operation on the target data through a register and perform a read operation through the multi-port synchronous FIFO data reading interface.
本申请实施例的第三个方面,提供了一种多口同步FIFO数据读取系统,包括:寄存器堆、多个多路复用器、多个寄存器、多个读指针、多个读口和数据读取接口,每个所述多路复用器与对应的所述寄存器建立通信连接,所述数据读取接口分别与每个所述寄存器、每个所述读指针建立通信连接;According to a third aspect of an embodiment of the present application, a multi-port synchronous FIFO data reading system is provided, comprising: a register file, a plurality of multiplexers, a plurality of registers, a plurality of read pointers, a plurality of read ports, and a data reading interface, wherein each of the multiplexers establishes a communication connection with a corresponding register, and the data reading interface establishes a communication connection with each of the registers and each of the read pointers, respectively;
每个所述读指针用于:当多个读口并行触发对应的数据读取请求时,获取所述读口对应的读使能信号和FIFO的当前状态信息并发送至对应的多路复用器;所述读使能信号用于指示所述读口是否进行读操作;Each of the read pointers is used to: when multiple read ports trigger corresponding data read requests in parallel, obtain the read enable signal corresponding to the read port and the current status information of the FIFO and send them to the corresponding multiplexer; the read enable signal is used to indicate whether the read port performs a read operation;
每个所述多路复用器用于:对于每个所述读口,根据所述读使能信号和所述FIFO的当前状态信息确定目标地址;根据所述目标地址,从寄存器堆中或写口数据中选择目标数据;所述目标地址用于表征数据读取地址的标识;所述写口数据是指当前正在写入FIFO的数据;Each of the multiplexers is configured to: for each of the read ports, determine a target address based on the read enable signal and the current state information of the FIFO; select target data from a register file or write port data based on the target address; the target address is used to identify a data read address; the write port data refers to data currently being written into the FIFO;
每个所述寄存器用于:对所述目标数据执行打拍操作,并将所述目标数据传输至所述数据读取接口;Each of the registers is used to: perform a beat operation on the target data and transmit the target data to the data reading interface;
所述数据读取接口用于:对所述目标数据执行读取操作。The data reading interface is used to perform a read operation on the target data.
本申请实施例的第四个方面,提供了一种计算机设备,包括:包括存储器和处理器,存储器存储有计算机程序,处理器执行计算机程序时实现如上任一项方法的步骤。According to a fourth aspect of the embodiments of the present application, a computer device is provided, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above methods when executing the computer program.
本申请实施例的第五个方面,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现如上任一项的方法的步骤。According to a fifth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.
本申请实施例中提供了一种多口同步FIFO数据读取方法、装置、系统、设备及介质,该方法包括:当多个读口并行触发对应的数据读取请求时,获取每个读口对应的读使能信号和FIFO的当前状态信息,并对于每个读口,根据读使能信号和FIFO的当前状态信息确定目标地址,并根据目标地址,通过多路复用器从寄存器堆中或写口数据中选择目标,将目标数据通过输入口输入寄存器执行打拍操作并通过FIFO对应的数据读取接口执行读取操作。本申请中的技术方案对于多个读口并行触发数据读取请求时,能够根据获取的读使能信号和FIFO的当前状态信息,提前确定出目标地址,从而能够直接从寄存器堆或者写口数据中选择对应的目标数据,避免了传统设计中因FIFO深度增加导致的大MUX延时问题,并通过寄存器根据目标数据执行打拍操作以通过数据读取接口读取,缓解了下游长组合逻辑时的时序瓶颈,进一步提高了系统整体运行速度和性能。In an embodiment of the present application, a multi-port synchronous FIFO data reading method, apparatus, system, equipment and medium are provided, the method comprising: when a plurality of read ports trigger corresponding data read requests in parallel, obtaining a read enable signal corresponding to each read port and the current status information of the FIFO, and for each read port, determining a target address according to the read enable signal and the current status information of the FIFO, and selecting a target from a register stack or write port data through a multiplexer according to the target address, inputting the target data into a register through an input port to perform a beat operation, and performing a read operation through a data read interface corresponding to the FIFO. The technical solution in the present application can determine the target address in advance according to the obtained read enable signal and the current status information of the FIFO when a plurality of read ports trigger data read requests in parallel, so that the corresponding target data can be directly selected from the register stack or the write port data, avoiding the large MUX delay problem caused by the increase in FIFO depth in traditional designs, and performing a beat operation according to the target data through the register to read through the data read interface, alleviating the timing bottleneck in the downstream long combinational logic, and further improving the overall operating speed and performance of the system.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
图1为本申请一个实施例提供的现有的FIFO结构的示意图;FIG1 is a schematic diagram of an existing FIFO structure provided by an embodiment of the present application;
图2为本申请一个实施例提供的通过不同读口读取数据产生时延的结构示意图;FIG2 is a schematic diagram of a structure of a delay generated by reading data through different reading ports according to an embodiment of the present application;
图3为本申请一个实施例提供的计算机设备的结构示意图;FIG3 is a schematic diagram of the structure of a computer device provided in one embodiment of the present application;
图4为本申请一个实施例提供的多口同步FIFO数据读取方法的流程图;FIG4 is a flow chart of a multi-port synchronous FIFO data reading method provided by one embodiment of the present application;
图5为本申请另一个实施例提供的根据读使能信号,生成对应的目标地址的方法的流程示意图;FIG5 is a flow chart of a method for generating a corresponding target address according to a read enable signal according to another embodiment of the present application;
图6为本申请一个实施例提供的多口同步FIFO数据读取装置的结构示意图;FIG6 is a schematic structural diagram of a multi-port synchronous FIFO data reading device provided by one embodiment of the present application;
图7为本申请一个实施例提供的多口同步FIFO数据读取系统的结构示意图。FIG7 is a schematic structural diagram of a multi-port synchronous FIFO data reading system provided by an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
在实现本申请的过程中,发明人发现,传统的多口同步FIFO电路结构存在输出数据时序延迟问题,从而导致整个系统的运行速度和性能降低。In the process of implementing the present application, the inventors discovered that the traditional multi-port synchronous FIFO circuit structure has an output data timing delay problem, which leads to a decrease in the operating speed and performance of the entire system.
为了使本申请实施例中的技术方案及优点更加清楚明白,以下结合附图对本申请的示例性实施例进行进一步详细的说明,显然,所描述的实施例仅是本申请的一部分实施例,而不是所有实施例的穷举。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。In order to make the technical solutions and advantages of the embodiments of the present application more clearly understood, the exemplary embodiments of the present application are further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, and are not an exhaustive list of all the embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other unless they conflict.
如背景技术中提到的,上述多口同步FIFO结构具有同步读写、多个读写口、读写控制逻辑、满空状态检测、地址映射、数据一致性等特点。其中,同步读写是指所有的读写操作都在同一个时钟域下进行,这意味着读写时钟频率相同,从而避免了跨时钟域设计中可能出现的同步问题。多个读写口是指设计中包含了多个独立的读写接口,允许多个数据源同时向FIFO写入数据,或从FIFO中读取数据,提高了数据吞吐量和系统的并行处理能力。读写控制逻辑包含读写指针的管理和更新逻辑,以及读写使能信号的产生。由于是同步FIFO,所以这些控制信号的生成要考虑时钟域同步问题,确保在给定时钟周期内的读写操作是互斥的,防止数据竞争。满空状态检测是指通过比较读指针和写指针来判断FIFO的状态,包括满、空以及半满等状态,这些状态信号是组合逻辑的结果,并及时反馈给读写控制器以防止溢出或下溢。地址映射是指针对多读写口的情况,可能会有复杂的地址映射算法,确保每个读写端口都能正确地访问到FIFO的相应存储位置。数据一致性是指在多口同步FIFO中,必须确保无论数据从哪个端口写入或读出,始终保持先进先出的顺序。在实际应用中,多口同步FIFO常用于高性能数据交换、多处理器通信、流水线设计和高速数据采集等领域,它可以高效地实现数据的分发、收集和暂存,有效解决了并行处理过程中的数据同步和缓存需求。As mentioned in the background, the multi-port synchronous FIFO structure features synchronous read and write, multiple read and write ports, read and write control logic, full/empty state detection, address mapping, and data consistency. Synchronous read and write means that all read and write operations are performed in the same clock domain, which means the read and write clock frequencies are the same, thus avoiding synchronization issues that may arise in cross-clock domain designs. Multiple read and write ports refer to the design containing multiple independent read and write interfaces, allowing multiple data sources to write data to or read data from the FIFO simultaneously, improving data throughput and the system's parallel processing capabilities. The read and write control logic includes the management and update logic of the read and write pointers, as well as the generation of read and write enable signals. Because it is a synchronous FIFO, the generation of these control signals must take into account clock domain synchronization issues to ensure that read and write operations within a given clock cycle are mutually exclusive and prevent data contention. Full/empty state detection refers to determining the FIFO status by comparing the read and write pointers, including full, empty, and half-full states. These status signals are the result of combinational logic and are promptly fed back to the read and write controller to prevent overflow or underflow. Address mapping refers to the use of complex address mapping algorithms for multiple read/write ports to ensure that each read/write port can correctly access the corresponding storage location in the FIFO. Data consistency refers to the requirement that data in a multi-port synchronous FIFO must always be in first-in, first-out order, regardless of which port the data is written or read from. In practical applications, multi-port synchronous FIFOs are commonly used in high-performance data exchange, multi-processor communication, pipeline design, and high-speed data acquisition. They can efficiently distribute, collect, and temporarily store data, effectively solving the data synchronization and caching requirements of parallel processing.
请参见图1所示,图1为现有的经典的多口同步FIFO结构的示意图,包括多个关键组件和接口信号,该关键组件包括:寄存器堆(Register File)、复用器(Multiplexer,MUX)、写指针(Write Pointer)、读指针(Read Pointer)、标志位(Flag Logic)、数据写入接口(Write Interface)和数据读取接口(Read Interface)。寄存器堆用于存储数据,是FIFO的存储主体。标志位用于生成FIFO的状态标志信号,包括full(满)和empty(空)信号,这些信号会反馈到写接口和读接口,以控制读写操作。在写路径和读路径上都有复用器,写路径的复用器用于根据写使能信号,选择对应的写端口数据(wport1_data、wport2_data 等)写入寄存器堆(Register File);读路径的复用器根据读使能(读使能1、读使能2、...、读使能N)信号,从寄存器文件中选择数据输出(rport1_data、rport2_data ...、rportN_data等)。写指针(写指针1Write Pointer1、写指针2Write Pointer2 ...、写指针NWrite PointerN)用于跟踪数据写入的位置,读指针模块(Read Pointer1、Read Pointer2 ...、ReadPointerN 等)用于跟踪数据读取的位置,写使能信号(写使能1、写使能2、...、写使能N)控制写指针更新,读使能信号(RE1、RE2等)控制读指针更新。Please refer to Figure 1, which shows a schematic diagram of a classic multi-port synchronous FIFO structure. It includes several key components and interface signals, including a register file, a multiplexer (MUX), a write pointer, a read pointer, flag logic, a data write interface, and a data read interface. The register file is used to store data and is the main storage component of the FIFO. The flag logic generates FIFO status signals, including full and empty signals. These signals are fed back to the write and read interfaces to control read and write operations. Both the write and read paths have multiplexers. The write path multiplexer selects the corresponding write port data (wport1_data, wport2_data, etc.) for writing to the register file based on the write enable signal. The read path multiplexer selects data outputs (rport1_data, rport2_data, ..., rportN_data, etc.) from the register file based on the read enable signals (Read Enable 1, Read Enable 2, ..., Read Enable N). Write pointers (Write Pointer 1, Write Pointer 2, ..., Write Pointer N) track the data write location, while read pointers (Read Pointer 1, Read Pointer 2, ..., ReadPointer N, etc.) track the data read location. Write enable signals (Write Enable 1, Write Enable 2, ..., Write Enable N) control write pointer updates, while read enable signals (RE1, RE2, etc.) control read pointer updates.
写接口有多个写端口(wport1、wport2等,统称wport),读接口有多个读端口(rport1、rport2等,统称rport)。The write interface has multiple write ports (wport1, wport2, etc., collectively referred to as wport), and the read interface has multiple read ports (rport1, rport2, etc., collectively referred to as rport).
上述接口信号包括写入接口信号和读取接口信号,写入接口信号包括:i_valid、i_ready和full,读取接口信号包括:o_valid、o_ready和empty。其中,i_valid表示输入数据是否有效,i_ready表示FIFO是否准备好接收新数据,full反馈FIFO已满的状态,阻止新数据写入。o_valid表示输出数据是否有效,o_ready表示接收端是否准备好接收数据,empty用于反馈FIFO为空的状态,阻止数据读取。上述该电路通过这些组件和信号协同工作,实现数据的有序写入和读出,确保FIFO在不同状态下的正确运行。The interface signals described above include write and read signals. The write signals include i_valid, i_ready, and full, while the read signals include o_valid, o_ready, and empty. i_valid indicates whether the input data is valid, i_ready indicates whether the FIFO is ready to receive new data, and full indicates a full FIFO state, preventing new data from being written. o_valid indicates whether the output data is valid, o_ready indicates whether the receiving end is ready to receive data, and empty indicates an empty FIFO state, preventing data from being read. The circuit described above uses these components and signals to coordinate orderly data writing and reading, ensuring the correct operation of the FIFO in different states.
在经典多口同步FIFO设计的读操作中,每个读口(rport)都有对应的读地址指针(Read Pointer1 - N)。当读操作发生时,这些读地址指针会指示从寄存器堆(RegisterFile)中读取数据的位置。由于存在多个读口,每个读口都要从寄存器堆众多存储单元中选择出对应的数据,所以每个读口都需要经过一个多路复用器(MUX)。MUX的作用就是根据读地址指针的信号,从寄存器堆的不同存储位置中选出该读口所需的正确读数据(rport(1-N)_data)。In a classic multi-port synchronous FIFO design, each read port (rport) has a corresponding read address pointer (Read Pointer1 - N). When a read operation occurs, these read address pointers indicate the location in the register file (RegisterFile) where data is to be read. Because there are multiple read ports, each must select the corresponding data from the numerous storage locations in the register file. Therefore, each read port must pass through a multiplexer (MUX). The MUX's function is to select the correct read data (rport(1-N)_data) required by that read port from various storage locations in the register file based on the signals from the read address pointers.
随着对FIFO深度(DP)需求的增大,寄存器堆中的存储单元数量会增多。因为MUX要从这些存储单元中进行数据选择,那么MUX的输入端口数量也会相应增加。而MUX内部是通过组合逻辑来实现数据选择功能的,输入端口越多,其内部的逻辑结构就越复杂,信号传播的路径也就越长。这样,信号从 MUX的输入传播到输出所花费的时间就会变长,这个时间就是组合逻辑延时(Delay1)。当FIFO下游连接着非常长的组合逻辑时,整个信号路径上的延时是各个部分延时的总和。由于读口处的MUX随着FIFO深度增加而产生的延时(Delay1)较大,在整个信号路径的延时中占比较高。如果这个延时过大,就会导致数据不能在规定的时钟周期内稳定传输到下游逻辑,从而影响整个系统的运行速度,使得该读口输出成为整个系统的时序瓶颈。As the required FIFO depth (DP) increases, the number of storage cells in the register file increases. Because the MUX must select data from these storage cells, the number of MUX input ports also increases accordingly. The MUX internally implements data selection through combinational logic. The more input ports, the more complex its internal logic structure and the longer the signal propagation path. Consequently, the time it takes for a signal to propagate from the MUX input to the output increases. This time is known as the combinational logic delay (Delay1). When the FIFO is connected downstream to very long combinational logic, the delay in the entire signal path is the sum of the delays in each component. Since the delay (Delay1) incurred by the MUX at the read port increases with increasing FIFO depth, it contributes significantly to the overall signal path delay. If this delay is excessive, data cannot be stably transmitted to the downstream logic within the specified clock cycle, affecting the overall system speed and making the read port output a timing bottleneck.
请参见图2所示,现有的经典多口同步FIFO设计会在每个读数据请求发生时存在输出数据时序延迟的问题,例如多个读请求包括:读口(rport1)请求、读口(rport2)请求、...、读口(rportN)请求,每个读口(rport)都有对应的读地址指针(Read Pointer1 -N)。当读操作发生时,这些读地址指针会指示从寄存器堆(Register File)中读取数据的位置。所以每个读口都需要经过一个多路复用器(MUX)。MUX 的作用就是根据读地址指针的信号,从寄存器堆的不同存储位置中选出该读口所需的正确读数据(rport (1 - N)_data),即rport1请求对应输出rport1读数据,rport2请求对应输出rport2读数据,rportN请求对应输出rportN读数据,由于每个读口都会经过一个大MUX选择器,从而产生了组合逻辑延时(Delay1),进而影响整个系统的运行速度和性能降低。As shown in Figure 2, the existing classic multi-port synchronous FIFO design suffers from data output timing delays for each read data request. For example, multiple read requests may include: read port (rport1), read port (rport2), ..., and read port (rportN). Each read port (rport) has a corresponding read address pointer (Read Pointer1 - N). When a read operation occurs, these read address pointers indicate the location in the register file from which data is to be read. Therefore, each read port must pass through a multiplexer (MUX). The MUX's function is to select the correct read data (rport (1 - N)_data) required by that read port from different storage locations in the register file based on the read address pointer signal. Specifically, an rport1 request corresponds to the output of rport1 read data, an rport2 request corresponds to the output of rport2 read data, and an rportN request corresponds to the output of rportN read data. Because each read port passes through a large MUX selector, this generates a combinational logic delay (Delay1), which in turn reduces the overall system speed and performance.
基于上述缺陷,本申请提供了一种多口同步FIFO时序优化方法,与相关技术相比,本申请中技术方案对于多个读口并行触发数据读取请求时,能够根据获取读使能信号和FIFO的当前状态信息,提前确定出目标地址,从而能够直接从寄存器堆或者写口数据中选择对应的目标数据,避免了传统设计中因FIFO深度增加导致的大MUX延时问题,并通过寄存器根据目标数据执行打拍操作以通过数据读取接口读取,缓解了下游长组合逻辑时的时序瓶颈,进一步提高了系统整体运行速度和性能。Based on the above-mentioned defects, the present application provides a multi-port synchronous FIFO timing optimization method. Compared with the related technology, the technical solution in the present application can determine the target address in advance based on the read enable signal and the current status information of the FIFO when multiple read ports trigger data read requests in parallel, so that the corresponding target data can be directly selected from the register stack or write port data, avoiding the large MUX delay problem caused by the increase in FIFO depth in traditional designs, and performing a beat operation according to the target data through the register to read through the data read interface, alleviating the timing bottleneck in the downstream long combinational logic, and further improving the overall operation speed and performance of the system.
请参见图3,本申请实施例提供的一例计算机设备的结构示意图。如图3所示,该计算机设备包括通过系统总线连接的处理器、存储器、网络接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质例如可以为磁盘。非易失性存储介质中存储有文件(可以为待处理的文件,也可以为处理后的文件)、操作系统和计算机程序等。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种多口同步FIFO数据读取方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。Please refer to Figure 3, which is a schematic diagram of the structure of an example computer device provided in an embodiment of the present application. As shown in Figure 3, the computer device includes a processor, memory, a network interface, a display screen, and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium may be, for example, a magnetic disk. The non-volatile storage medium stores files (which may be files to be processed or processed files), an operating system, and computer programs. The internal memory provides an environment for the operating system and computer programs in the non-volatile storage medium to run. The network interface of the computer device is used to communicate with an external terminal via a network connection. When executed by the processor, the computer program implements a multi-port synchronous FIFO data reading method. The display screen of the computer device may be a liquid crystal display or an electronic ink display. The input device of the computer device may be a touch layer covering the display screen, or may be buttons, a trackball, or a touchpad provided on the computer device housing, or may be an external keyboard, touchpad, or mouse.
请参见图4,以下实施例以上述计算机设备为执行主体,将本申请实施例提供的多口同步FIFO数据读取方法应用于上述计算机设备来进行数据读取为例进行具体说明。本申请实施例提供的多口同步FIFO数据读取包括如下步骤201-步骤204:Please refer to Figure 4. The following embodiment uses the above-mentioned computer device as the execution subject and applies the multi-port synchronous FIFO data reading method provided in the embodiment of the present application to the above-mentioned computer device to perform data reading as an example for specific description. The multi-port synchronous FIFO data reading provided in the embodiment of the present application includes the following steps 201 to 204:
步骤201、当多个读口并行触发对应的数据读取请求时,获取每个读口对应的读使能信号和FIFO的当前状态信息;读使能信号用于指示读口是否进行读操作。Step 201: When multiple read ports trigger corresponding data read requests in parallel, obtain the read enable signal corresponding to each read port and the current status information of the FIFO; the read enable signal is used to indicate whether the read port performs a read operation.
需要说明的是,上述每个读口(rport1-N)对应一个读使能信号(RE1 - REN),当某个读口的读使能信号有效时,表明该读口需要进行数据读取。FIFO的当前状态信息可以包括空状态、满状态、接近空状态、接近满状态。It should be noted that each read port (rport1-N) corresponds to a read enable signal (RE1-REN). When the read enable signal of a read port is valid, it indicates that the read port needs to read data. The current status information of the FIFO can include empty state, full state, nearly empty state, and nearly full state.
在获取上述读使能信号的过程中,可以是适用组合逻辑将FIFO的空状态和外部的读请求信号相结合,当FIFO非空且有存在数据读取请求时,读使能信号有效,例如,使用逻辑与门,将非空信号和外部数据读取请求作为输入,输出即为读使能信号。In the process of obtaining the above-mentioned read enable signal, combinational logic can be applied to combine the empty state of the FIFO and the external read request signal. When the FIFO is not empty and there is a data read request, the read enable signal is valid. For example, a logic AND gate is used with the non-empty signal and the external data read request as input, and the output is the read enable signal.
上述FIFO结构中可以包括写指针和读指针,写指针用于跟踪数据写入的位置,读指针用于跟踪数据读取的位置。FIFO的工作原理是数据从一端写入从另一端读出。写指针指向的是下一个要写入数据的位置,读指针指向的是下一个要读出数据的位置。The FIFO structure described above includes a write pointer and a read pointer. The write pointer tracks where data is written, while the read pointer tracks where data is read. The FIFO operates by writing data at one end and reading it at the other. The write pointer points to the next location where data is to be written, and the read pointer points to the next location where data is to be read.
当写操作比读操作快时,写指针会逐渐向前移动并接近读指针。当写指针追赶上读指针,即两者指向同一个位置,这意味着FIFO中所有的存储单元读已经被写入了数据,没有空闲的空间来存储新的数据了,所以此时FIFO处于满状态。When write operations are faster than read operations, the write pointer will gradually move forward and approach the read pointer. When the write pointer catches up with the read pointer, that is, they point to the same position, it means that all storage units in the FIFO have been written to and there is no free space to store new data, so the FIFO is full.
正常情况下,读指针会随着数据的读出而向前移动,写指针会随着数据的写入而向前移动。当读操作比写操作快时,读指针会逐渐拉开与写指针的距离。当读指针和写指针再次相等时,有两种可能情况。一种是FIFO从未进行过写入操作,此时FIFO自然为空;另一种是FIFO曾经有过数据,但经过一系列的读写操作后,所有的数据都被读出了,此时虽然FIFO非空(因为曾经有过数据),但实际上已经没有数据可供读取了,所以也表示FIFO为空。Under normal circumstances, the read pointer advances as data is read, and the write pointer advances as data is written. When reads outpace writes, the read pointer gradually distances itself from the write pointer. When the read and write pointers become equal again, there are two possible scenarios. One is that the FIFO has never been written to, in which case the FIFO is naturally empty. The other is that the FIFO once had data, but after a series of read and write operations, all the data has been read. In this case, although the FIFO is not empty (because it once had data), there is actually no data left to read, indicating that the FIFO is empty.
步骤202、对于每个读口,根据读使能信号和FIFO的当前状态信息确定目标地址;目标地址用于表征数据读取地址的标识。Step 202: For each read port, determine a target address according to the read enable signal and the current state information of the FIFO; the target address is used to identify the data read address.
上述目标地址是指需要读取数据的地址,其作用是为了提前确定下一次读操作的地址,以便更高效地进行数据读取。FIFO中不同的当前状态信息,对应选择的目标地址也不同。The target address is the address from which data is to be read. This is used to determine the address for the next read operation in advance, allowing for more efficient data reading. Different current state information in the FIFO corresponds to different target addresses.
可以理解的是,在确定目标地址的过程中,除了读使能信号,还需要考虑 FIFO的当前状态信息,该当前状态信息还可以包括当前的写指针位置、FIFO的深度等,这些信息可以帮助确定读口应该从寄存器堆或者从写口数据中读取数据。It is understandable that in the process of determining the target address, in addition to the read enable signal, the current status information of the FIFO needs to be considered. The current status information may also include the current write pointer position, the depth of the FIFO, etc. This information can help determine whether the read port should read data from the register stack or from the write port data.
步骤203、根据目标地址,通过多路复用器从寄存器堆中或写口数据中选择目标数据;写口数据是指当前正在写入FIFO的数据。Step 203: Select target data from the register file or the write port data through a multiplexer according to the target address; the write port data refers to the data currently being written into the FIFO.
需要说明的是,上述目标数据是指需要读取的数据。目标数据可以是以不同的数据形式表示,例如可以是通过以表格、图片、文本、音视频或其他形式表示。目标数据可以为一个、两个或多个。对于每个写口均对应有一个多路复用器,当该多口并行FIFO中包含N个读口(rport1-N)、N个写口时,其对应也包含N个多路复用器,每个多路复用器用于执行选择操作。It should be noted that the target data referred to above refers to the data to be read. The target data can be represented in various data formats, such as a table, image, text, audio, video, or other formats. The target data can be one, two, or more. Each write port corresponds to a multiplexer. When the multi-port parallel FIFO includes N read ports (rport1-N) and N write ports, it also includes N multiplexers, each of which is used to perform a selection operation.
具体地,在获取到目标地址后,对于每个读口,可以根据目标地址,通过多路复用器从寄存器堆中获取目标数据或从写口数据中选择目标数据,该多路复用器具有选择功能,能够从该两种情况中选择其中一种情况选择目标数据,该目标数据是与目标地址对应的数据。Specifically, after obtaining the target address, for each read port, the target data can be obtained from the register stack or selected from the write port data through a multiplexer according to the target address. The multiplexer has a selection function and can select the target data from one of the two situations. The target data is the data corresponding to the target address.
步骤204、将目标数据通过输入口输入寄存器执行打拍操作并通过FIFO对应的数据读取接口执行读取操作。Step 204: input the target data into the register through the input port to perform a beat operation and perform a read operation through the data read interface corresponding to the FIFO.
可以理解的是,上述寄存器可以为D型触发器(DFF)。多口并行FIFO中存在多个寄存器,每个多路复用器对应有一个寄存器,且对应有多个输入口,每个输入口对应一个读口和一个写口。该多口并行FIFO中还可以包括数据读取接口,通过该数据读取接口可以输出读取的目标数据。It is understood that the registers described above may be D-type flip-flops (DFFs). A multi-port parallel FIFO contains multiple registers, one corresponding to each multiplexer, and multiple corresponding input ports, each corresponding to a read port and a write port. The multi-port parallel FIFO may also include a data read interface, through which the read target data can be output.
具体地,在通过多路复用器选择好目标数据后,将目标数据输送入寄存器(DFF,D型触发器)进行打拍操作。打拍操作的主要目的是对数据进行同步处理。在数字电路中,由于不同路径上的信号传输延迟可能不同,数据到达的时间可能会不一致,这可能会导致数据不稳定或者错误。通过将数据暂存一拍(即一个时钟周期),使得数据在寄存器中稳定下来,确保在下一个时钟周期数据能够被正确地处理和传输。Specifically, after the target data is selected by the multiplexer, it is fed into a register (DFF, D-type flip-flop) for a tap operation. The primary purpose of the tap operation is to synchronize data processing. In digital circuits, due to varying signal transmission delays along different paths, data arrival times may be inconsistent, potentially leading to data instability or errors. By temporarily storing the data for one tap (i.e., one clock cycle), the data stabilizes in the register, ensuring that it can be correctly processed and transmitted in the next clock cycle.
本申请实施例中提供了一种多口同步FIFO数据读取方法,该方法包括:当多个读口并行触发对应的数据读取请求时,获取每个读口对应的读使能信号和FIFO的当前状态信息,并对于每个读口,根据读使能信号和FIFO的当前状态信息确定目标地址,并根据目标地址,通过多路复用器从寄存器堆中或写口数据中选择目标,将目标数据通过输入口输入寄存器执行打拍操作并通过FIFO对应的数据读取接口执行读取操作。本申请中的技术方案对于多个读口并行触发数据读取请求时,能够根据获取读使能信号和FIFO的当前状态信息,提前确定出目标地址,从而能够直接从寄存器堆或者写口数据中选择对应的目标数据,避免了传统设计中因FIFO深度增加导致的大MUX延时问题,并通过寄存器根据目标数据执行打拍操作以通过数据读取接口读取,缓解了下游长组合逻辑时的时序瓶颈,进一步提高了系统整体运行速度和性能。In an embodiment of the present application, a multi-port synchronous FIFO data reading method is provided, the method comprising: when multiple read ports trigger corresponding data read requests in parallel, obtaining a read enable signal corresponding to each read port and the current status information of the FIFO, and for each read port, determining a target address according to the read enable signal and the current status information of the FIFO, and according to the target address, selecting a target from a register stack or write port data through a multiplexer, inputting the target data into a register through an input port to perform a beat operation, and performing a read operation through a data read interface corresponding to the FIFO. The technical solution in the present application can determine the target address in advance according to the obtained read enable signal and the current status information of the FIFO when multiple read ports trigger data read requests in parallel, so that the corresponding target data can be directly selected from the register stack or the write port data, avoiding the large MUX delay problem caused by the increase in FIFO depth in traditional designs, and performing a beat operation according to the target data through the register to read through the data read interface, alleviating the timing bottleneck in the downstream long combinational logic, and further improving the overall operating speed and performance of the system.
在本申请一个可选实施例中,本申请实施例提供了根据读使能信号和FIFO的当前状态信息确定目标地址的具体实现方式,该方法包括:In an optional embodiment of the present application, the embodiment of the present application provides a specific implementation method for determining the target address according to the read enable signal and the current state information of the FIFO, the method comprising:
当FIFO的当前状态信息为满状态时,根据读使能信号生成对应的当拍读地址,并将当拍读地址作为目标地址;当FIFO的当前状态信息为空状态且检测到写口对应的数据写入请求触发时,根据读使能信号,确定写口地址并将其作为目标地址。When the current status information of the FIFO is full, the corresponding current read address is generated according to the read enable signal, and the current read address is used as the target address; when the current status information of the FIFO is empty and the data write request corresponding to the write port is detected, the write port address is determined according to the read enable signal and used as the target address.
需要说明的是,在多口同步FIFO发生多读口请求时,按照现有的经典FIFO设计方案是通过每个读口的读使能信号(RE1-N)计算出对应的读地址(Read Pointer1~N),再用对应的读地址(Read Pointer1~N)去选寄存器堆(Register File)中的数据。而本申请实施例中,通过每个读口(rport1-N)的读使能信号(RE1-N)计算出每个读口对应的当拍读地址(Read Pointer Next1 - N),并将该当拍读地址作为目标地址,该当拍读地址能够直接从寄存器堆(Register File)中选出每个读口的当拍读寄存器堆数据(rport(1-N)_data_reg),通过这种方式提前获取了数据。It should be noted that when multiple read port requests occur in a multi-port synchronous FIFO, according to the existing classic FIFO design, the corresponding read address (Read Pointer 1~N) is calculated using the read enable signal (RE1-N) of each read port, and then the corresponding read address (Read Pointer 1~N) is used to select data in the register file. In the embodiment of the present application, the read enable signal (RE1-N) of each read port (rport1-N) is used to calculate the current read address (Read Pointer Next1-N) corresponding to each read port, and this current read address is used as the target address. This current read address can directly select the current read register file data (rport(1-N)_data_reg) of each read port from the register file, thereby obtaining data in advance.
在获取到读使能信号和FIFO的状态信息之后,根据读使能信号和FIFO的状态信息,通过特定的地址计算逻辑来生成当拍读地址(Read Pointer Next1 - N)。这个计算逻辑可能是一个复杂的组合电路,它会根据不同的输入信号进行相应的运算,以确定每个读口的正确读地址。After obtaining the read enable signal and FIFO status information, a specific address calculation logic is used to generate the current read address (Read Pointer Next1 - N) based on the read enable signal and FIFO status information. This calculation logic may be a complex combinational circuit that performs corresponding operations based on different input signals to determine the correct read address for each read port.
例如,一种可能的计算方式是当读使能信号有效时,将当前的写指针位置加上一个偏移量,这个偏移量可能与读口的编号、FIFO的深度等因素有关,从而得到当拍读地址。这样,通过这个当拍读地址就可以直接从寄存器堆中选出每个读口的当拍读寄存器堆数据(rport(1 - N)_data_reg)。For example, one possible calculation method is to add an offset to the current write pointer position when the read enable signal is valid. This offset may be related to factors such as the read port number and the FIFO depth, thereby obtaining the current read address. In this way, the current read register file data (rport(1-N)_data_reg) for each read port can be directly selected from the register file using this current read address.
当FIFO的当前状态信息为空状态且检测到写口对应的数据写入请求触发时,根据读使能信号,确定每个读口的当拍读地址,并根据每个读口的当拍读地址和写数据地址(Write Pointer(1 -N)进行比较逻辑判断,从而根据比较结果确定写口地址并将其作为目标地址。When the current status information of the FIFO is empty and the data write request corresponding to the write port is detected, the current read address of each read port is determined according to the read enable signal, and a comparison logic judgment is performed based on the current read address of each read port and the write data address (Write Pointer (1-N), so as to determine the write port address according to the comparison result and use it as the target address.
本申请实施例中通过根据读使能信号和FIFO的当前状态信息,读使能信号决定了读操作是否被允许,而FIFO的当前状态信息反映了FIFO中数据的存储情况。通过综合这两个因素来确定目标地址,可以避免在FIFO为空时进行读操作导致的数据下溢,以及在FIFO不满时错误地认为已满而停止读操作,从而保证了每次读取的数据都是有效的,提高了数据处理的准确性。In the embodiments of the present application, the read enable signal determines whether a read operation is permitted based on the read enable signal and the current state information of the FIFO, while the current state information of the FIFO reflects the storage status of the data in the FIFO. By combining these two factors to determine the target address, data underflow caused by performing a read operation when the FIFO is empty and the error of terminating the read operation due to the FIFO being full when not full can be avoided, thereby ensuring that the data read each time is valid and improving the accuracy of data processing.
在本申请一个可选实施例中,请参见图5所示,当FIFO的当前状态信息为空状态且检测到写口对应的数据写入请求触发时,根据读使能信号,生成对应的目标地址,包括:In an optional embodiment of the present application, as shown in FIG5 , when the current status information of the FIFO is empty and a data write request corresponding to the write port is detected, a corresponding target address is generated according to a read enable signal, including:
步骤301、当FIFO的当前状态信息为空状态、读口对应的数据读取请求和写口对应的数据写入请求同时发生且读口和写口数量相同时,根据读使能信号确定每个读口的当拍读地址。Step 301: When the current status information of the FIFO is empty, a data read request corresponding to a read port and a data write request corresponding to a write port occur simultaneously, and the number of read ports and write ports is the same, determine the current read address of each read port according to a read enable signal.
步骤302、获取FIFO当前已有的写数据地址。Step 302: Obtain the current write data address of the FIFO.
步骤303、根据每个读口的当拍读地址和写数据地址进行比较逻辑判断,从所有写口的数据中选择目标地址;写数据地址用于表征FIFO当前已有的数据地址。Step 303: Perform a comparison logic judgment based on the current read address and write data address of each read port, and select a target address from the data of all write ports; the write data address is used to represent the current data address of the FIFO.
需要说明的是,当FIFO为空状态,读请求和写请求同时发生并且读写数量一致时,会出现一些问题。其中,读写口数量一致用于指示写口和读口的数量相同。例如,FIFO有1个写口数据同时有1个读口请求读数据,或者有2个写口数据同时有2个读口请求读数据...直至有N个写口数据同时有N个读口请求读数据的情况。在这些情况下,由于数据还未来得及写进寄存器堆,不能直接从寄存器堆中读取数据,否则会读到错误数据或无数据可读。It's important to note that when the FIFO is empty and read and write requests occur simultaneously, and the number of read and write requests is the same, some problems may arise. The term "the number of read and write ports is the same" indicates that the number of write and read ports is the same. For example, a FIFO may have one write port with data and one read port with data requesting to read it simultaneously, or two write ports with data and two read ports with data requesting to read it simultaneously, and so on, up to the point where there are N write ports with data and N read ports with data requesting to read it simultaneously. In these cases, because the data has not yet been written to the register file, it cannot be directly read from the register file. Otherwise, incorrect data will be read or no data will be available.
为了解决上述问题,需要获取写数据地址,并对每个读口的当拍读地址和当前FIFO中已有的写数据地址(Write Pointer(1 -N))进行比较逻辑判断。通过这个判断得到N组选择信号,这些信号用于控制一个N选1的多路复用器(MUX),从写口数据(wport(1-N)_data)中选择出相应的数据,将其直接送入DFF(触发器)的输入口(port(1 - N)_data_nxt)。然后再通过一个2选1的MUX,最终得到当拍读FIFO数据(rport(1 - N)_data_nxt),从而确保在特殊情况下也能获取到正确的读数据。To address this issue, it's necessary to obtain the write data address and perform a logical comparison between each read port's current read address and the existing write data address in the FIFO (Write Pointer (1-N)). This comparison generates N sets of selection signals, which control an N-to-1 multiplexer (MUX). This selects the appropriate data from the write port data (wport (1-N)_data) and directly feeds it into the DFF (flip-flop) input port (port (1-N)_data_nxt). This data is then passed through a 2-to-1 multiplexer to obtain the current read FIFO data (rport (1-N)_data_nxt), ensuring accurate read data even in exceptional circumstances.
其中,在多口同步FOFO中,可以利用写指针获取FIFO当前已有的写数据地址。写指针在FIFO中用于指示下一个要写入数据的位置,在正常的写入操作流程中,写指针会依次指向FIFO存储单元的各个地址,每完成一次写入操作,写指针就会更新到下一个存储单元的地址。所以,通过记录写指针的值,就能得到当前已有的写数据地址。In a multi-port synchronous FIFO, the write pointer can be used to obtain the address of the current write data in the FIFO. The write pointer indicates the location of the next data to be written in the FIFO. During a normal write operation, the write pointer points to each address of the FIFO storage unit in sequence. After each write operation, the write pointer is updated to the address of the next storage unit. Therefore, by recording the value of the write pointer, the address of the current write data can be obtained.
示例性地,在硬件设计里,写指针通常由计数器来实现。当写使能信号有效时,计数器会在时钟信号的驱动下进行计数操作,其计数值就代表了写指针的地址。For example, in hardware design, the write pointer is usually implemented by a counter. When the write enable signal is valid, the counter will perform a counting operation driven by the clock signal, and the count value represents the address of the write pointer.
本实施例中当FIFO的当前状态信息为空状态、读口对应的数据读取请求和写口对应的数据写入请求同时发生且读口和写口数量相同时,能够综合考虑每个读口的当拍读地址和写数据地址,从而确保了在数据未完全写入寄存器堆是也能正确获取读数据,克服了传统设计中因FIFO深度增加导致的大MUX 延时问题,加快了读数据输出速度。In this embodiment, when the current status information of the FIFO is empty, the data read request corresponding to the read port and the data write request corresponding to the write port occur simultaneously, and the number of read ports and write ports is the same, the current read address and write data address of each read port can be comprehensively considered, thereby ensuring that the read data can be correctly obtained even when the data is not completely written to the register stack, overcoming the large MUX delay problem caused by the increase in FIFO depth in traditional designs, and speeding up the read data output speed.
在本申请一个可选实施例中,上述根据每个读口的当拍读地址和写数据地址进行比较逻辑判断,从所有写口的数据中选择目标地址,包括如下方法步骤:In an optional embodiment of the present application, the above-mentioned comparison and logical judgment based on the current read address and write data address of each read port to select the target address from the data of all write ports includes the following method steps:
将每个读口的当拍读地址与写数据地址按位进行比较,得到比较结果;比较结果用于表征当拍读地址与写数据地址是否一致;若当拍读地址与写数据地址一致时,将写数据地址作为目标地址。The current read address of each read port is compared bit by bit with the write data address to obtain a comparison result; the comparison result is used to indicate whether the current read address is consistent with the write data address; if the current read address is consistent with the write data address, the write data address is used as the target address.
具体地,对于每个读口,将其当拍读地址(Read Pointer Next1-N)与FIFO中已有的写数据地址(Write Pointer(1-N)进行逐一比较,得到比较结果。这种比较方式通常是按位进行的,从最高位开始比较,直到找到不同的位或者所有位都比较完。Specifically, for each read port, its current read address (Read Pointer Next1-N) is compared one by one with the existing write data address (Write Pointer (1-N)) in the FIFO to obtain the comparison result. This comparison method is usually performed bit by bit, starting from the highest bit, until a different bit is found or all bits are compared.
例如,如果读口1的当拍读地址是0101,而FIFO中写口1对应的写数据地址是0110,那么从最高位开始逐个比较,第一位都是0,第二位也都是1,则第一位和第二位均相等,第三位不同,读口对应的当拍读地址是0,写口对应的写数据地址是1,此时就可以判断出读口1的地址与写口1的地址不同。然后根据地址比较的结果生成选择信号。For example, if the current read address of read port 1 is 0101, and the write data address corresponding to write port 1 in the FIFO is 0110, then starting from the highest bit, if the first bit is always 0 and the second bit is always 1, then the first and second bits are equal, but the third bit is different. The current read address corresponding to the read port is 0, and the write data address corresponding to the write port is 1. At this time, it can be determined that the address of read port 1 is different from the address of write port 1. Then, a selection signal is generated based on the result of the address comparison.
如果读口的当拍读地址与某个写数据地址相等,那么对应的选择信号就被置为有效(通常为高电平1),表示该写口的数据是需要被选择的,并将该写口对应的写数据地址作为目标地址;如果不相等,选择信号则置为无效(通常为低电平0)。If the current read address of the read port is equal to a certain write data address, the corresponding selection signal is set to valid (usually high level 1), indicating that the data of the write port needs to be selected, and the write data address corresponding to the write port is used as the target address; if they are not equal, the selection signal is set to invalid (usually low level 0).
例如,经过比较后发现读口2的当拍读地址与写口3的写数据地址相等,那么选择信号组中对应写口3的信号就被置为1,其他写口对应的选择信号则为0。这样就得到了N组选择信号,每组信号对应一个写口。将这N组选择信号作为N选1的多路复用器MUX的控制信号,MUX的输入是各个写口的数据(wport(1-N)_data)。For example, if the current read address of read port 2 is found to be equal to the write data address of write port 3, the select signal corresponding to write port 3 in the select signal group is set to 1, and the select signals corresponding to the other write ports are set to 0. This results in N groups of select signals, each corresponding to a write port. These N groups of select signals serve as control signals for an N-to-1 multiplexer (MUX), whose input is the data from each write port (wport(1-N)_data).
本实施例中通过将每个读口的当拍读地址与写数据地址按位进行比较,能够判断每个读口的当拍读地址是否与写数据地址相匹配。当两者地址完全一致时,确定出目标地址,这样就能准确地从多个写数据中筛选出与读口需求对应的有效数据。对于多口FIFO而言,多个读口可能会同时发起读请求,通过按位比较可以并行处理每个读口的地址比较操作,使得每个读口都能独立、快速地找到对应的写数据,从而支持多端口的并发读写操作,提高FIFO的数据处理效率。In this embodiment, by comparing each read port's current read address with the write data address bit by bit, it is possible to determine whether the current read address of each read port matches the write data address. When the two addresses are completely consistent, the target address is determined, which accurately filters out valid data corresponding to the read port's needs from multiple write data. For a multi-port FIFO, multiple read ports may initiate read requests simultaneously. By performing bit-by-bit comparison, the address comparison operation of each read port can be processed in parallel, allowing each read port to independently and quickly find the corresponding write data, thereby supporting concurrent read and write operations on multiple ports and improving the data processing efficiency of the FIFO.
在本申请一个可选实施例中,上述根据目标地址,通过多路复用器从寄存器堆中或写口数据中选择目标数据,包括如下方法步骤:In an optional embodiment of the present application, the method of selecting target data from a register file or write port data through a multiplexer according to the target address includes the following method steps:
当目标地址为当拍读地址时,从寄存器堆中选择每个读口对应的当拍读寄存器堆数据作为目标数据;When the target address is the current read address, the current read register file data corresponding to each read port is selected from the register file as the target data;
当目标地址为写数据地址时,从写口数据中选择写数据地址对应的数据作为目标数据。When the target address is a write data address, data corresponding to the write data address is selected from the write port data as the target data.
作为一种可实现方式,如果目标地址为当拍读地址,则根据该当拍读地址直接从寄存器堆中选择对应的当拍读寄存器堆数据作为目标数据。As an implementable manner, if the target address is a current read address, corresponding current read register file data is directly selected from the register file according to the current read address as the target data.
作为另一种可实现方式,目标地址为写口地址时,可以根据当拍读地址与写数据地址生成的选择信号,根据选择信号,通过多路复用器MUX会选择对应的写口数据作为目标数据,将其送进DFF寄存器的输入口(port(1-N)_data_nxt)。As another possible implementation method, when the target address is a write port address, the selection signal generated by the current read address and the write data address can be used to select the corresponding write port data as the target data through the multiplexer MUX and send it to the input port (port (1-N)_data_nxt) of the DFF register.
示例性地,当选择信号表明写口3的写口数据被选中,那么N选1的MUX就会将写口3的数据wport3_data输出到寄存器的输入口port(1-N)_data_nxt 中对应的位置,其他写口的数据则被忽略。For example, when the selection signal indicates that the write port data of write port 3 is selected, the N-to-1 MUX will output the write port 3 data wport3_data to the corresponding position in the input port port(1-N)_data_nxt of the register, and the data of other write ports will be ignored.
进一步地,在得到DFF输入口的数据后,还需要通过2选1的多路复用器MUX来最终确定当拍读FIFO数据(rport(1-N)_data_nxt)。这里的2选1通常是在从寄存器堆中直接读取的数据(rport(1-N)_data_reg)和经过N选1的MUX选择后从写口得到的写口数据(port(1-N)_data_nxt)之间进行选择。其中,选择的依据可以是根据FIFO的状态等其他条件。例如,如果FIFO不为空且没有出现读写冲突(即数据已经写进寄存器堆),那么2选1的MUX会选择从寄存器堆中读取的数据作为当拍读FIFO数据;如果出现了读写冲突,即数据还没写进寄存器堆,那么就选择经过N选1的MUX处理后从写口得到的数据作为当拍读FIFO数据,该当拍读FIFO数据为目标数据。After receiving the data from the DFF input port, a 2-to-1 multiplexer (MUX) is used to determine the current read FIFO data (rport(1-N)_data_nxt). This 2-to-1 selection typically involves selecting between data directly read from the register file (rport(1-N)_data_reg) and data from the write port (port(1-N)_data_nxt) after selection by the N-to-1 MUX. This selection can be based on other conditions, such as the FIFO status. For example, if the FIFO is not empty and there is no read/write conflict (i.e., the data has been written to the register file), the 2-to-1 MUX selects the data read from the register file as the current read FIFO data. If a read/write conflict occurs (i.e., the data has not yet been written to the register file), the data from the write port after processing by the N-to-1 MUX is selected as the current read FIFO data, with the current read FIFO data being the target data.
本实施例中根据目标地址,能够准确地选择是否从寄存器堆中或者写口数据中选择对应的数据,提高了数据获取的灵活性,确保了在合适的时机选择正确的数据,避免因数据冲突而导致的错误,同时避免了不必要的数据传输和处理过程,从而减少了数据的延迟。In this embodiment, based on the target address, it is possible to accurately select whether to select the corresponding data from the register stack or the write port data, thereby improving the flexibility of data acquisition, ensuring that the correct data is selected at the right time, avoiding errors caused by data conflicts, and avoiding unnecessary data transmission and processing processes, thereby reducing data delays.
在本申请一个可选实施例中,上述方法还包括:In an optional embodiment of the present application, the above method further includes:
当FIFO为空状态且存在写使能信号有效时,将每个写口的数据作为目标数据分别赋值至寄存器的每个输入口。When the FIFO is in an empty state and the write enable signal is valid, the data of each write port is assigned as the target data to each input port of the register.
当FIFO中有一个存储数据且存在读使能信号有效时,将每个写口的数据作为目标数据分别赋值至寄存器的每个输入口。When there is a stored data in the FIFO and the read enable signal is valid, the data of each write port is assigned to each input port of the register as the target data.
当FIFO中有两个存储数据且存在读使能信号有效时,将从FIFO中读取的数据作为目标数据赋值至寄存器中第一个输入口,并将其他写口的数据作为目标数据依次赋值为寄存器的其余输入口;其他写口是指所有写口中除第一个写口之外的写口。When there are two stored data in the FIFO and the read enable signal is valid, the data read from the FIFO is assigned to the first input port in the register as the target data, and the data of the other write ports are assigned to the remaining input ports of the register in sequence as the target data; the other write ports refer to all the write ports except the first write port.
当FIFO中有n个存储数据且存在读使能信号有效时,将从FIFO中读取的数据作为目标数据依次赋值为寄存器中前n-1个输入口,并将写口的数据作为目标数据赋值为寄存器的最后一个输入口,n≥1。When there are n stored data in the FIFO and the read enable signal is valid, the data read from the FIFO is assigned as the target data to the first n-1 input ports of the register in sequence, and the data written to the port is assigned as the target data to the last input port of the register, n≥1.
具体地,在多口同步FIFO中,可以根据FIFO不同的状态、存在的存储项(空、有不同数量的存储项)以及读写操作情况,来选择更新寄存器(DFF)输入口的数据的规则,该规则包括如下具体内容。Specifically, in a multi-port synchronous FIFO, the rules for updating the data at the register (DFF) input port can be selected based on the different states of the FIFO, the existing storage items (empty, with different numbers of storage items), and the read and write operations. The rules include the following specific contents.
作为一种可选的实现方式,当FIFO为空状态且存在写操作更新DFF输入口的数据时,可以通过如下文本结构表示:As an optional implementation, when the FIFO is empty and there is a write operation to update the data at the DFF input port, it can be represented by the following text structure:
condi = empty&wencondi = empty&wen
rdata_nxt_p1 = wdata_p1;rdata_nxt_p1 = wdata_p1;
rdata_nxt_p2 = wdata_p2;rdata_nxt_p2 = wdata_p2;
......
rdata_nxt_pn = wdata_pn;rdata_nxt_pn = wdata_pn;
需要说明的是,上述文本结构表明:只有在FIFO为空(empty信号有效)且写使能(wen信号有效)时才更新DFF输入口的数据,这意味着当FIFO中没有数据并且有新的数据要写入时,会触发后续的DFF数据更新操作。在数据更新的过程中,是将每个写口的数据(wdata_p1-wdata_pn)分别赋值给对应的DFF的输入口(rdata_nxt_p1-rdata_nxt_pn),即将写口1的数据wdata_p1赋值给DFF中第一个输入口1的数据rdata_nxt_p1,将写口2的数据wdata_p2赋值给DFF中第二个输入口2的数据rdata_nxt_p2,...,将写口n的数据wdata_pn赋值给DFF中最后一个输入口n的数据rdata_nxt_pn。这样做的目的是在FIFO为空时,如果有写操作,就直接将新写入的数据准备好作为下一个时刻可以读取的数据,提前进行数据的传递和准备。It should be noted that the above text structure indicates that the data on the DFF input port is updated only when the FIFO is empty (the empty signal is active) and write is enabled (the wen signal is active). This means that when there is no data in the FIFO and new data is to be written, the subsequent DFF data update operation is triggered. During the data update process, the data from each write port (wdata_p1-wdata_pn) is assigned to the corresponding DFF input port (rdata_nxt_p1-rdata_nxt_pn). That is, the data wdata_p1 from write port 1 is assigned to the data rdata_nxt_p1 of the first input port 1 in the DFF, the data wdata_p2 from write port 2 is assigned to the data rdata_nxt_p2 of the second input port 2 in the DFF, and so on. The data wdata_pn from write port n is assigned to the data rdata_nxt_pn of the last input port n in the DFF. The purpose of this is that when the FIFO is empty, if there is a write operation, the newly written data is directly prepared as the data that can be read at the next moment, and the data is transferred and prepared in advance.
作为另一种可选的实现方式,当FIFO中有1个存储项且有读操作更新DFF输入口的数据时,可以通过如下文本结构表示:As another optional implementation, when there is one storage item in the FIFO and a read operation updates the data at the DFF input port, it can be represented by the following text structure:
condi = 1entry&rencondi = 1entry&ren
rdata_nxt_p1 = wdata_p1;rdata_nxt_p1 = wdata_p1;
rdata_nxt_p2 = wdata_p2;rdata_nxt_p2 = wdata_p2;
......
rdata_nxt_pn = wdata_pn;rdata_nxt_pn = wdata_pn;
需要说明的是,上述文本结构表明:在FIFO中只有1个存储项(1entry信号有效)且有读使能信号(ren信号有效)时成立。即当FIFO中只有一个数据且有读请求时,需要对DFF数据进行更新。在数据更新的过程中,同样将每个写口的数据赋值给对应的DFF的输入口,即将写口1的数据wdata_p1赋值给DFF中第一个输入口1的数据rdata_nxt_p1,将写口2的数据wdata_p2赋值给DFF中第二个输入口2的数据rdata_nxt_p1,...,将写口n的数据wdata_pn赋值给DFF中最后一个输入口n的数据rdata_nxt_pn。这是因为当FIFO中只有一个数据且要进行读操作时,可能需要将新写入的数据提前准备好,以满足连续读写的需求,避免数据传输的延迟。It should be noted that the above text structure indicates that this condition holds true when there is only one entry in the FIFO (the 1entry signal is active) and the read enable signal (the ren signal is active). That is, when there is only one entry in the FIFO and a read request is received, the DFF data must be updated. During the data update process, the data from each write port is assigned to the corresponding DFF input port. Specifically, data from write port 1 (wdata_p1) is assigned to the data on the first input port 1 of the DFF (rdata_nxt_p1), data from write port 2 (wdata_p2) is assigned to the data on the second input port 2 of the DFF (rdata_nxt_p1), and so on. Data from write port n (wdata_pn) is assigned to the data on the last input port n of the DFF (rdata_nxt_pn). This is because when there is only one entry in the FIFO and a read operation is required, the newly written data may need to be prepared in advance to meet continuous reading and writing requirements and avoid data transmission delays.
作为又一种可选的实现方式,当FIFO有2个存储项且有读操作时更新DFF输入口的数据时,可以通过如下文本结构表示:As another optional implementation, when the FIFO has two storage items and the data at the DFF input port is updated during a read operation, the following text structure can be used to represent it:
condi = 2entry&rencondi = 2entry&ren
rdata_nxt_p1 = fifo_r;rdata_nxt_p1 = fifo_r;
rdata_nxt_p2 = wdata_p1;rdata_nxt_p2 = wdata_p1;
......
rdata_nxt_pn = wdata_pn;rdata_nxt_pn = wdata_pn;
需要说明的是,上述文本结构表明:在FIFO中有2个存储项(2entry信号有效)且有读使能(ren信号有效)时才更新DFF输入口的数据。在数据更新的过程中,第一个输入口1的数据rdata_nxt_p0被赋值为fifo_r,fifo_r是代表从FIFO中读出的数据。而其他端口(rdata_nxt_p1-rdata_nxt_pn)仍然赋值为写口的数据(wdata_p1-wdata_pn),即将从FIFO中读出的数据fifo_r赋值给DFF中第一个输入口1的数据rdata_nxt_p1,将写口1的数据wdata_p1赋值给DFF中第二个输入口2的数据rdata_nxt_p2,...,将写口n的数据wdata_pn赋值给DFF中最后一个输入口n的数据rdata_nxt_pn。这可能是因为当FIFO中有两个数据时,第一个读口可以直接从FIFO中读取数据,而其他端口可能还需要等待新写入的数据或者按照特定的顺序进行数据处理。It should be noted that the above text structure indicates that the DFF input port data is updated only when there are two entries in the FIFO (the 2entry signal is active) and the read enable is active (the ren signal is active). During the data update process, the data on the first input port, rdata_nxt_p0, is assigned to fifo_r, which represents the data read from the FIFO. The other ports (rdata_nxt_p1-rdata_nxt_pn) continue to be assigned to the data on the write ports (wdata_p1-wdata_pn). Specifically, the data read from the FIFO, fifo_r, is assigned to the data on the first input port, rdata_nxt_p1, on the DFF. The data on write port 1, wdata_p1, is assigned to the data on the second input port, rdata_nxt_p2, on the DFF. Finally, the data on write port n, wdata_pn, is assigned to the data on the last input port, rdata_nxt_pn, on the DFF. This may be because when there are two data in the FIFO, the first reading port can read the data directly from the FIFO, while other ports may need to wait for the newly written data or process the data in a specific order.
作为再一种可选的实现方式,当FIFO有N个存储项且有读操作时更新DFF输入口的数据时,可以通过如下文本结构表示:As another optional implementation, when the FIFO has N storage items and the data at the DFF input port is updated during a read operation, the following text structure can be used to represent it:
condi = Nentry&rencondi = Nentry&ren
rdata_nxt_p1 = fifo_r;rdata_nxt_p1 = fifo_r;
rdata_nxt_p2 = fifo_r;rdata_nxt_p2 = fifo_r;
......
rdata_nxt_pn = wdata_pn;rdata_nxt_pn = wdata_pn;
需要说明的是,上述文本结构表明:在FIFO中有N个存储项(Nentry信号有效)且有读使能(ren信号有效)时才更新DFF输入口的数据。在数据更新的过程中,数据更新:前n-1个DFF输入口的数据(rdata_nxt_p1-rdata_nxt_p(n - 1))被赋值为fifo_r,即从FIFO中读出的数据。而最后一个输入口n(rdata_nxt_pn)赋值为写口的数据(wdata_pn),即将FIFO中读出的数据fifo_r赋值给DFF中第一个输入口1的数据rdata_nxt_p1,将FIFO中读出的数据fifo_r赋值给DFF中第二个输入口2的数据rdata_nxt_p2,...,将写口n的数据wdata_pn赋值给DFF中最后一个输入口n的数据rdata_nxt_pn。这是根据FIFO的存储情况和读写规则,前n-1个输入口可以直接从FIFO中读取已有的数据,而最后一个输入口需要准备新写入的数据,以保证数据的连续性和正确性。It should be noted that the above text structure indicates that the DFF input data is updated only when there are N items in the FIFO (the Nentry signal is active) and the read enable is active (the ren signal is active). During the data update process, the data from the first n-1 DFF input ports (rdata_nxt_p1 - rdata_nxt_p(n - 1)) is assigned to fifo_r, which is the data read from the FIFO. The last input port n (rdata_nxt_pn) is assigned to the data from the write port (wdata_pn). That is, the data read from the FIFO (fifo_r) is assigned to the data of the first DFF input port 1 (rdata_nxt_p1). The data read from the FIFO (fifo_r) is assigned to the data of the second DFF input port 2 (rdata_nxt_p2), and so on. Finally, the data from write port n (wdata_pn) is assigned to the data of the last DFF input port n (rdata_nxt_pn). This is based on the storage situation and read-write rules of the FIFO. The first n-1 input ports can directly read existing data from the FIFO, while the last input port needs to prepare newly written data to ensure data continuity and correctness.
本实施例中根据FIFO不同的状态和读写操作情况,能够合理地选择和更新DFF输入口的数据,确保数据在FIFO中的读写操作能够高效、准确地进行,消除了输出数据的组合逻辑延时。In this embodiment, the data of the DFF input port can be reasonably selected and updated according to the different states and read and write operations of the FIFO, ensuring that the read and write operations of the data in the FIFO can be performed efficiently and accurately, eliminating the combinational logic delay of the output data.
应该理解的是,虽然流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that, although the various steps in the flowchart are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps may be performed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily performed at the same time, but may be performed at different times. The execution order of these sub-steps or stages is not necessarily to be performed in sequence, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
另一方面,本申请还提供了多口同步FIFO数据读取装置,请参见图6所示,该装置包括:On the other hand, the present application also provides a multi-port synchronous FIFO data reading device, as shown in FIG6 , which includes:
获取模块810,用于当多个读口并行触发对应的数据读取请求时,获取每个读口对应的读使能信号和FIFO的当前状态信息;读使能信号用于指示读口是否进行读操作;The acquisition module 810 is used to obtain the read enable signal corresponding to each read port and the current status information of the FIFO when multiple read ports trigger corresponding data read requests in parallel; the read enable signal is used to indicate whether the read port performs a read operation;
确定模块820,用于对于每个读口,根据读使能信号和FIFO的当前状态信息确定目标地址;目标地址用于表征数据读取地址的标识;The determination module 820 is used to determine the target address for each read port according to the read enable signal and the current state information of the FIFO; the target address is used to represent the identifier of the data read address;
选择模块830,用于通过目标地址,通过多路复用器从寄存器堆中或写口数据中选择目标数据;写口数据是指当前正在写入FIFO的数据;The selection module 830 is used to select target data from the register file or the write port data through the multiplexer according to the target address; the write port data refers to the data currently being written into the FIFO;
读取模块840,用于将目标数据通过寄存器执行打拍操作并通过多口同步FIFO数据读取接口执行读取操作。The reading module 840 is used to perform a beat operation on the target data through a register and perform a read operation through a multi-port synchronous FIFO data reading interface.
上述多口同步FIFO数据读取装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。Each module in the multi-port synchronous FIFO data reading device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
本申请实施例提供的多口同步FIFO数据读取装置,对于多个读口并行触发数据读取请求时,能够根据获取读使能信号和FIFO的当前状态信息,提前确定出目标地址,从而能够直接从寄存器堆或者写口数据中选择对应的目标数据,避免了传统设计中因FIFO深度增加导致的大MUX延时问题,并通过寄存器根据目标数据执行打拍操作以通过数据读取接口读取,缓解了下游长组合逻辑时的时序瓶颈,进一步提高了系统整体运行速度和性能。The multi-port synchronous FIFO data reading device provided in the embodiment of the present application can determine the target address in advance based on the read enable signal and the current status information of the FIFO when multiple read ports trigger data read requests in parallel, so that the corresponding target data can be directly selected from the register stack or write port data, avoiding the large MUX delay problem caused by the increase in FIFO depth in traditional designs, and performing a beat operation according to the target data through the register to read through the data read interface, alleviating the timing bottleneck in the downstream long combinational logic, and further improving the overall operation speed and performance of the system.
另一方面,本申请还提供了多口同步FIFO数据读取系统,请参见图7所示,该系统包括:寄存器堆、多个多路复用器、多个寄存器、多个读指针、多个读口,每个多路复用器与对应的寄存器建立通信连接,数据读取接口分别与每个寄存器、每个读指针建立通信连接。On the other hand, the present application also provides a multi-port synchronous FIFO data reading system, as shown in Figure 7. The system includes: a register stack, multiple multiplexers, multiple registers, multiple read pointers, and multiple read ports. Each multiplexer establishes a communication connection with the corresponding register, and the data reading interface establishes a communication connection with each register and each read pointer respectively.
每个读指针用于:当多个读口并行触发对应的数据读取请求时,获取读口对应的读使能信号和FIFO的当前状态信息并发送至对应的多路复用器;读使能信号用于指示读口是否进行读操作;每个多路复用器用于:对于每个读口,根据读使能信号和FIFO的当前状态信息确定目标地址;根据目标地址,从寄存器堆中或写口数据中选择目标数据;目标地址用于表征数据读取地址的标识;写口数据是指当前正在写入FIFO的数据;每个寄存器用于:对目标数据执行打拍操作,并将目标数据传输至数据读取接口;数据读取接口用于:对目标数据执行读取操作。Each read pointer is used to: when multiple read ports trigger corresponding data read requests in parallel, obtain the read enable signal corresponding to the read port and the current status information of the FIFO and send them to the corresponding multiplexer; the read enable signal is used to indicate whether the read port performs a read operation; each multiplexer is used to: for each read port, determine the target address based on the read enable signal and the current status information of the FIFO; based on the target address, select the target data from the register stack or the write port data; the target address is used to represent the identifier of the data read address; the write port data refers to the data currently being written to the FIFO; each register is used to: perform a beat operation on the target data and transmit the target data to the data read interface; the data read interface is used to: perform a read operation on the target data.
具体地,上述寄存器堆(Register File)用于存储数据,是多口同步FIFO中存储数据的核心部分,有多个端口,包括多个写口(wport)和多个读口(rport),可实现并行读写操作。Specifically, the register file is used to store data and is the core part of the multi-port synchronous FIFO for storing data. It has multiple ports, including multiple write ports (wports) and multiple read ports (rports), which can realize parallel read and write operations.
上述系统还可以包括多个比较逻辑模块(Compare Logic),以N个比较逻辑模块为例,例如分别为:比较逻辑1(Compare Logic1)、比较逻辑2(Compare Logic2)、...、比较逻辑N(Compare LogicN),用于将写指针(write pointer)和读指针(read pointer)等相关信号进行比较,以判断 FIFO(先进先出队列)的状态,如满(full)或空(empty)。The system may further include multiple comparison logic modules (Compare Logic). For example, N comparison logic modules may be Compare Logic 1, Compare Logic 2, ..., Compare Logic N. These modules are configured to compare relevant signals, such as a write pointer and a read pointer, to determine a FIFO (first-in-first-out) queue status, such as full or empty.
上述系统还可以包括多个读指针,以N个读指针(读指针1、读指针2、...、读指针N)为例,由N个读使能信号(RE)控制更新,例如分别为:读使能信号1(RE1)、读使能信号2(RE2)、...、读使能信号N(REN),每个读指针用于指示从寄存器堆中读取数据的位置。系统还包括多个写指针,以N个写指针(写指针1、写指针2、...、写指针N)为例,由N个写使能信号(WE)控制更新,对应写使能信号分别为:写使能信号1(WE1)、写使能信号2(WE2)、...、写使能信号N(WEN),每个写指针用于指示数据写入寄存器堆的位置。The above system may also include multiple read pointers. For example, N read pointers (read pointer 1, read pointer 2, ..., read pointer N) are controlled for updating by N read enable signals (RE), such as read enable signal 1 (RE1), read enable signal 2 (RE2), ..., and read enable signal N (REN). Each read pointer indicates the location from which data is read from the register file. The system may also include multiple write pointers. For example, N write pointers (write pointer 1, write pointer 2, ..., write pointer N) are controlled for updating by N write enable signals (WE), such as write enable signal 1 (WE1), write enable signal 2 (WE2), ..., and write enable signal N (WEN). Each write pointer indicates the location from which data is written to the register file.
多个多路复用器MUX用于根据读使能信号和FIFO的当前状态信息确定目标地址,根据目标地址从寄存器堆中或写口数据中选择目标数据。The multiplexers MUX are used to determine a target address according to a read enable signal and current status information of the FIFO, and select target data from a register file or write port data according to the target address.
上述多个寄存器例如为N个DFF,例如分别为寄存器1(DFF1)、寄存器2(DFF2)..、寄存器N(DFFN),每个寄存器将目标数据执行打拍操作后发送至数据读取接口,使得通过数据读取接口执行读取操作。The above-mentioned multiple registers are, for example, N DFFs, such as register 1 (DFF1), register 2 (DFF2), register N (DFFN). Each register performs a beat operation on the target data and sends it to the data read interface, so that a read operation is performed through the data read interface.
在写操作过程中,写口(wport)接收写使能信号(WEN)、写指针(write pointer)和写数据(wport_data),数据经处理后写入寄存器堆。在写使能信号有效时,在时钟作用下将数据存入对应地址。在读操作过程中,读口(rport)有各自的读指针(read pointer),经比较逻辑处理后,通过多路复用器选择从寄存器堆读取数据(rport_data)输出,每个读口可独立进行读操作。During a write operation, the write port (wport) receives the write enable signal (WEN), the write pointer (write pointer), and the write data (wport_data). After processing, the data is written to the register file. When the write enable signal is active, the clock is used to store the data at the corresponding address. During a read operation, the read port (rport) has its own read pointer (read pointer). After comparison logic processing, the multiplexer selects the data (rport_data) to be read from the register file and output. Each read port can perform read operations independently.
可选的,上述系统还具有状态检测,当写操作频繁,写指针追赶到读指针一定程度,比较逻辑判断后输出满信号,表明寄存器堆无空闲空间,则表征为满(full)状态。若读操作快于写操作,读指针和写指针相等且满足特定条件,比较逻辑输出空信号,表示无有效数据可读,即表为空(empty)状态。其中,有效(valid)用于指示数据的有效性,就绪(ready)用于指示这些信号和端口的准备状态,帮助协调读写操作。Optionally, the system also features state detection. When write operations are frequent and the write pointer catches up to the read pointer to a certain extent, the comparison logic outputs a full signal after judgment, indicating that there is no free space in the register stack, which represents a full state. If the read operation is faster than the write operation, the read pointer and the write pointer are equal and meet specific conditions, the comparison logic outputs an empty signal, indicating that there is no valid data to read, that is, the state is empty. Among them, valid is used to indicate the validity of the data, and ready is used to indicate the readiness status of these signals and ports, helping to coordinate read and write operations.
本申请实施例中提供的多口同步FIFO的数据读取系统,对于多个读口并行触发数据读取请求时,能够根据获取读使能信号和FIFO的当前状态信息,提前确定出目标地址,从而能够直接从寄存器堆或者写口数据中选择对应的目标数据,避免了传统设计中因FIFO深度增加导致的大MUX延时问题,并通过寄存器根据目标数据执行打拍操作以通过数据读取接口读取,缓解了下游长组合逻辑时的时序瓶颈,进一步提高了系统整体运行速度和性能。The data reading system of the multi-port synchronous FIFO provided in the embodiment of the present application can determine the target address in advance based on the read enable signal and the current status information of the FIFO when multiple read ports trigger data read requests in parallel, so that the corresponding target data can be directly selected from the register stack or write port data, avoiding the large MUX delay problem caused by the increase in FIFO depth in traditional designs, and performing a beat operation according to the target data through the register to read through the data read interface, alleviating the timing bottleneck in the downstream long combinational logic, and further improving the overall operation speed and performance of the system.
在一个实施例中,提供了一种计算机设备,该计算机设备的内部结构图可以如图3所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现如上的一种多口同步FIFO数据读取方法。包括:包括存储器和处理器,存储器存储有计算机程序,处理器执行计算机程序时实现如上多口同步FIFO数据读取方法中的任一步骤。In one embodiment, a computer device is provided, and the internal structure diagram of the computer device can be shown in Figure 3. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, it implements a multi-port synchronous FIFO data reading method as described above. It includes: a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements any step in the multi-port synchronous FIFO data reading method as described above.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时可以实现如上多口同步FIFO数据读取方法中的任一步骤。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any step in the above multi-port synchronous FIFO data reading method can be implemented.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。This application is described with reference to the flowcharts and/or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the application. It should be understood that each process and/or block in the flowchart and/or block diagram, as well as the combination of processes and/or blocks in the flowchart and/or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate a device for implementing the functions specified in one or more processes in the flowchart and/or one or more blocks in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.
Claims (9)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202510510276.2A CN120045140B (en) | 2025-04-22 | 2025-04-22 | Multi-port synchronous FIFO data reading method, device, system, equipment and medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202510510276.2A CN120045140B (en) | 2025-04-22 | 2025-04-22 | Multi-port synchronous FIFO data reading method, device, system, equipment and medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN120045140A CN120045140A (en) | 2025-05-27 |
| CN120045140B true CN120045140B (en) | 2025-08-15 |
Family
ID=95748175
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202510510276.2A Active CN120045140B (en) | 2025-04-22 | 2025-04-22 | Multi-port synchronous FIFO data reading method, device, system, equipment and medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN120045140B (en) |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104407809A (en) * | 2014-11-04 | 2015-03-11 | 盛科网络(苏州)有限公司 | Multi-channel FIFO (First In First Out) buffer and control method thereof |
| CN104778025A (en) * | 2015-04-16 | 2015-07-15 | 浪潮电子信息产业股份有限公司 | Circuit structure of first-in first-out memory based on random access memory |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6754741B2 (en) * | 2001-05-10 | 2004-06-22 | Pmc-Sierra, Inc. | Flexible FIFO system for interfacing between datapaths of variable length |
| EP1416373A3 (en) * | 2002-10-31 | 2005-01-05 | STMicroelectronics Pvt. Ltd | Method and apparatus to reduce access time in synchronous fifos with zero latency overhead |
| US7136309B2 (en) * | 2004-08-02 | 2006-11-14 | Texas Instruments Incorporated | FIFO with multiple data inputs and method thereof |
| CN112650468B (en) * | 2020-12-03 | 2022-02-22 | 北京博雅慧视智能技术研究院有限公司 | Zero-delay FIFO circuit and electronic equipment |
-
2025
- 2025-04-22 CN CN202510510276.2A patent/CN120045140B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104407809A (en) * | 2014-11-04 | 2015-03-11 | 盛科网络(苏州)有限公司 | Multi-channel FIFO (First In First Out) buffer and control method thereof |
| CN104778025A (en) * | 2015-04-16 | 2015-07-15 | 浪潮电子信息产业股份有限公司 | Circuit structure of first-in first-out memory based on random access memory |
Also Published As
| Publication number | Publication date |
|---|---|
| CN120045140A (en) | 2025-05-27 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5931926A (en) | Method and apparatus for dynamically calculating degrees of fullness of a synchronous FIFO | |
| US7694035B2 (en) | DMA shared byte counters in a parallel computer | |
| US9842067B2 (en) | Processor communications | |
| TW201248503A (en) | Detecting potential access errors in a multi-threaded application | |
| US6226698B1 (en) | Method and apparatus for dynamically calculating degrees of fullness of a synchronous FIFO | |
| CN118550857B (en) | Data transmission method, device, electronic device and storage medium | |
| CN118796272B (en) | A memory access method, processor, electronic device and readable storage medium | |
| CN114490439A (en) | Data writing, reading and communication method based on lock-free ring shared memory | |
| CN117217977B (en) | GPU data access processing method, device and storage medium | |
| US7844752B2 (en) | Method, apparatus and program storage device for enabling multiple asynchronous direct memory access task executions | |
| CN117132446A (en) | GPU data access processing method, device and storage medium | |
| CN110618950B (en) | Asynchronous FIFO read-write control circuit and method, readable storage medium and terminal | |
| CN120045140B (en) | Multi-port synchronous FIFO data reading method, device, system, equipment and medium | |
| CN101963896B (en) | Memory device with quadratic index structure and operation method thereof | |
| CN118885218A (en) | Instruction processing method and device for out-of-order multi-issue processor | |
| CN116955226A (en) | Buffer data processing method, device, buffer, equipment and storage medium | |
| CN116909485A (en) | Data write-back method and device, electronic equipment and computer readable storage medium | |
| EP0752642B1 (en) | Method and apparatus for dynamically calculating degrees of fullness of a synchronous fifo | |
| KR19980056298A (en) | Apparatus and method for transmitting dynamic data block using annular queue | |
| US7620798B1 (en) | Latency tolerant pipeline synchronization | |
| CN120371255A (en) | Data reading method, device, system, equipment and medium of FIFO | |
| WO2021037124A1 (en) | Task processing method and task processing device | |
| US20250199566A1 (en) | Reduced latency clock domain crossing circuit | |
| JP7419944B2 (en) | Semiconductor device and synchronization method | |
| CN119782253B (en) | Data processing method, system, device and readable storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |