CN113778684A - Multi-information-source-oriented FPGA and CPU data synchronization device and method - Google Patents
Multi-information-source-oriented FPGA and CPU data synchronization device and method Download PDFInfo
- Publication number
- CN113778684A CN113778684A CN202111077137.3A CN202111077137A CN113778684A CN 113778684 A CN113778684 A CN 113778684A CN 202111077137 A CN202111077137 A CN 202111077137A CN 113778684 A CN113778684 A CN 113778684A
- Authority
- CN
- China
- Prior art keywords
- interrupt
- cpu
- data
- fpga
- signal
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 23
- 238000004891 communication Methods 0.000 claims abstract description 10
- 230000003993 interaction Effects 0.000 claims abstract description 8
- 230000007274 generation of a signal involved in cell-cell signaling Effects 0.000 claims abstract description 6
- 238000006243 chemical reaction Methods 0.000 claims description 3
- 230000003247 decreasing effect Effects 0.000 claims description 3
- 230000003139 buffering effect Effects 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Hardware Redundancy (AREA)
Abstract
The invention discloses a multi-information-source-oriented FPGA and CPU data synchronization device and a method, wherein the device comprises an FPGA unit and a CPU, data interaction is carried out between the FPGA unit and the CPU through a communication bus, and a certain IO pin of the FPGA unit is connected with an interrupt special pin of the CPU; the FPGA unit comprises n data cache regions, a change judgment module, a change mark interval timing convergence module, interrupt clearing logic, an interrupt register counter, interrupt shielding logic, an interrupt signal generation module and bus interface logic; the bus interface is used for realizing the function of data interaction with the CPU, on one hand, the data of the data cache region is reported to the CPU through the bus interface, and on the other hand, the command of the CPU can also be issued to the FPGA through the bus interface. Compared with the traditional method, the synchronization method reduces the number of the interrupt pins of the CPU, reduces the times of generating the interrupt signals, improves the efficiency of the CPU, ensures that the interrupt signals are not lost, and further ensures the integrity of data.
Description
Technical Field
The invention belongs to the technical field of FPGA and embedded technology, in particular to a multi-information-source-oriented FPGA and CPU data synchronization device and method.
Background
At present, most embedded systems are designed by adopting an architecture of FPGA + CPU, and methods for synchronizing data of FPGA and CPU mainly comprise a query-based mode and an interrupt-based mode. The mode based on the query is that a CPU periodically accesses a data cache region in the FPGA, and the mode has low efficiency and cannot realize real-time data synchronization. The interruption-based mode is that interruption is generated when the data of the FPGA changes, and the CPU accesses the data cache region in the FPGA after receiving an interruption signal, so that the working efficiency of the CPU is improved, and the real-time performance of data synchronization is higher. As embedded systems become more complex in design, more and more information sources are needed for data acquisition. In the traditional interrupt-based FPGA and CPU data synchronization method, an interrupt pin is configured for each information source, and after the CPU receives an interrupt signal, a data cache region corresponding to the interrupt is accessed, so that data synchronization is realized. When the number of information sources needing data acquisition is large, the traditional method has two problems. On one hand, the number of interrupt pins of the CPU is limited, and when there are many information sources, one interrupt pin cannot be configured for each information source. On the other hand, the data of each information source has the characteristics of burstiness, randomness and independence, so that the CPU frequently enters an interrupt processing program, the efficiency of the CPU is reduced, and the interrupt loss is easy to generate.
Disclosure of Invention
The invention provides a multi-information-source-oriented FPGA and CPU data synchronization device and method aiming at the defects of the prior art, is applied to a multi-information-source data acquisition system, realizes data synchronization of the FPGA and the CPU, and solves the problems of insufficient number of interrupt pins and too frequent interrupt triggering in the traditional method.
The invention relates to a multi-information-source-oriented FPGA and CPU data synchronization device, which comprises an FPGA unit and a CPU, wherein the FPGA unit and the CPU carry out data interaction through a communication bus, and a certain IO pin of the FPGA unit is connected with an interrupt special pin of the CPU.
The FPGA unit comprises n data cache regions, a change judgment module, a change mark interval timing convergence module, interrupt clearing logic, an interrupt register counter, interrupt shielding logic, an interrupt signal generation module and a bus interface;
the data buffer area is used for buffering the data reported by each information source;
the change judgment module is used for judging the data in the data cache region in real time and generating a corresponding change mark when the data changes;
the interval timing convergence module detects whether the change marks from the n data cache regions are effective or not in a time interval delta t, and if one or more change marks are effective, corresponding interrupt marks are generated at the tail of the time interval delta t;
the interrupt clear logic is used for receiving an interrupt clear command sent by the CPU and generating a corresponding interrupt clear mark;
after the CPU finishes an interrupt processing program, an interrupt clearing command is sent through a bus interface;
the interrupt register counter is used for registering the interrupt mark, 1 is added to the interrupt register counter when the interval timing convergence module generates one interrupt mark, and 1 is subtracted from the interrupt register counter when the interrupt clear logic generates one interrupt clear mark;
the interrupt shielding logic is used for interrupt shielding control, the CPU enters an interrupt service processing program after receiving an interrupt signal, and simultaneously sends an interrupt shielding command through a bus interface, and the interrupt shielding signal is effective; after the CPU finishes the interrupt service processing program, an interrupt shielding removing command is sent through the bus interface, and at the moment, an interrupt shielding signal is invalid;
the interrupt signal generating module is used for generating an interrupt signal which meets the time sequence requirement of the CPU, and generating the interrupt signal when the interrupt shielding signal is invalid and the interrupt register counter is not zero;
the bus interface is used for realizing the function of data interaction with the CPU, on one hand, the data of the data cache region is reported to the CPU through the bus interface, and on the other hand, the command of the CPU can also be issued to the FPGA through the bus interface.
The invention also aims to provide a multi-information-source-oriented FPGA and CPU data synchronization method, which comprises an FPGA processing flow and a CPU processing flow.
The FPGA processing flow comprises the following steps:
s101, caching data of an external information source by a data cache region of the FPGA, and for n information sources, allocating n data cache regions;
s102, carrying out change judgment on data in a data cache region in real time, and generating a corresponding change mark for the cache region with data conversion;
s103, setting a certain time intervalIf one or more change marks are detected to be effective in the time interval delta t, an interruption mark is generated at the end of the time interval delta t, and if the change marks are not detected to be effective, the method continues to wait until the change marks are effective;
s104, registering the generated interrupt marks, wherein each time one interrupt mark is generated, the interrupt register counter is increased by 1;
s105, if the interrupt mask signal is invalid and the value of the interrupt register counter is nonzero, generating an interrupt signal, if the interrupt mask signal is valid, suspending the interrupt signal generation process and waiting for the interrupt mask signal to be invalid;
s106, the FPGA receives the CPU interrupt shielding command, the interrupt shielding signal becomes effective, and the CPU is waited to finish the interrupt processing program;
s107, after the FPGA receives the interrupt clearing command, the interrupt clearing logic generates an interrupt clearing mark, an interrupt register counter is decreased by 1, and the current interrupt is cleared;
and S108, after the FPGA receives the command of releasing the interrupt shielding, the interrupt shielding signal output by the interrupt shielding logic becomes invalid.
The CPU processing flow comprises the following steps:
s201, after receiving an interrupt signal, a CPU sends an interrupt shielding command through a communication bus and forbids an FPGA from generating the interrupt signal during the interrupt processing service program;
s202, the CPU enters an interrupt service program, and reads data in n data cache regions through a communication bus to realize data synchronization of the FPGA and the CPU;
s203, after finishing the interrupt processing service program, the CPU sends an interrupt clearing command to the FPGA;
and S204, sending an interrupt mask removing command to the FPGA.
The synchronization device of the invention carries out interval timing convergence on the change marks from a plurality of information sources, and combines a plurality of change marks in each interval into a single interrupt mark, thereby solving the problem of data synchronization of the FPGA and the CPU under the condition of a plurality of information sources. Compared with the traditional method, the synchronization method reduces the number of the interrupt pins of the CPU, reduces the times of generating the interrupt signals, improves the efficiency of the CPU, ensures that the interrupt signals are not lost, and further ensures the integrity of data.
Drawings
FIG. 1 is a schematic diagram of an FPGA and CPU data synchronization device according to the present invention;
FIG. 2 is a FPGA processing flow chart of the FPGA and CPU data synchronization method of the present invention;
FIG. 3 is a CPU processing flow chart of the FPGA and CPU data synchronization method of the present invention;
fig. 4 is a schematic diagram of the time of change of the source data and the time of occurrence of each change flag and interrupt flag in the embodiment.
Detailed Description
The present invention will be further described with reference to the following examples and drawings, but the present invention is not limited thereto.
Examples
A multi-information source oriented FPGA and CPU data synchronizer is shown in figure 1 and comprises an FPGA unit and a CPU, wherein the FPGA unit and the CPU carry out data interaction through a communication bus, and a certain IO pin of the FPGA unit is connected with an interrupt special pin of the CPU;
the FPGA unit comprises n data cache regions, a change judgment module, a change mark interval timing convergence module, interrupt clearing logic, an interrupt register counter, interrupt shielding logic, an interrupt signal generation module and bus interface logic;
the bus interface is used for realizing the function of data interaction with the CPU, on one hand, the data of the data cache region is reported to the CPU through the bus interface, and on the other hand, the command of the CPU can also be issued to the FPGA through the bus interface.
In this embodiment, assuming that the number of information sources n =5, a time interval is setIs assumed to beIn the interval, the data of the information source 1, the information source 2, the information source 3, and the information source 5 are changed, and the time when the data are changed is as shown in fig. 4, it is assumed that the current interrupt register counter has a value of 0.
The invention relates to a multi-information-source-oriented FPGA and CPU data synchronization method, which comprises an FPGA processing flow and a CPU processing flow. As shown in fig. 2, the FPGA processing flow includes the following specific steps:
s101, caching data of an external information source by a data cache region of the FPGA, and allocating 5 data cache regions for 5 information sources;
s102, carrying out change judgment on data in the data buffer area in real time, generating corresponding change marks for the buffer area with data conversion, and carrying out change judgment at time intervalsWhen data of the internal information source 1, the information source 2, the information source 3 and the information source 5 changes, the change flag 1 is valid at the time of data change of the information source 1, the change flag 2 is valid at the time of data change of the information source 2, the change flag 3 is valid at the time of data change of the information source 3, and the change flag 5 is valid at the time of data change of the information source 5. Data of the information source 4 at time intervalsIf there is no change, the change flag 4 is invalid, as shown in fig. 4;
s103, in time intervalIn the time interval, if 4 change flags are detected to be validThe tail end of the internal circuit generates an interrupt mark;
s104, registering the generated interrupt marks, wherein when one interrupt mark is generated, the interrupt register counter is increased by 1, the value of the interrupt register counter is changed into 1, and 1 interrupt signal needs to be generated and processed;
s105, if the CPU does not enter the interrupt service program, the interrupt mask signal is invalid, and the value of the interrupt register counter is 1, which is a non-zero value, the interrupt signal generating module generates an interrupt signal meeting the time sequence requirement of the CPU;
s106, the FPGA receives the CPU interrupt shielding command, the interrupt shielding signal becomes effective, and the CPU is waited to finish the interrupt processing program;
s107, after the FPGA receives the interrupt clear command, the interrupt clear logic generates an interrupt clear mark, the interrupt register counter is decreased by 1, the current interrupt is cleared, the value of the interrupt register counter is changed into 0, and the fact that no interrupt signal needs to be generated currently is indicated;
and S108, after the FPGA receives the command of releasing the interrupt shielding, the interrupt shielding signal output by the interrupt shielding logic becomes invalid.
The CPU processing flow, as shown in fig. 3, includes the following specific steps:
s201, after receiving an interrupt signal, a CPU sends an interrupt shielding command through a communication bus and forbids an FPGA from generating the interrupt signal during the interrupt processing service program;
s202, the CPU enters an interrupt service program, and reads data in 5 data cache regions through a communication bus to realize data synchronization of the FPGA and the CPU;
s203, after finishing the interrupt processing service program, the CPU sends an interrupt clearing command to the FPGA;
and S204, sending an interrupt mask removing command to the FPGA.
The data synchronization method of the invention gathers the data change marks of a plurality of information sources into an interrupt source by adopting interval timing, thereby reducing the occupation of the number of CPU interrupt pins, reducing the times of CPU entering interrupt and improving the working efficiency of the CPU.
Claims (3)
1. The utility model provides a FPGA and CPU data synchronizer towards many information sources, includes FPGA unit and CPU, its characterized in that:
the FPGA unit and the CPU carry out data interaction through a communication bus; one IO pin of the FPGA unit is connected with an interrupt special pin of the CPU;
the FPGA unit comprises n data cache regions, a change judgment module, a change mark interval timing convergence module, interrupt clearing logic, an interrupt register counter, interrupt shielding logic, an interrupt signal generation module and a bus interface;
the bus interface is used for realizing the function of data interaction with the CPU, and on one hand, the data of the data cache region is reported to the CPU through the bus interface; on the other hand, the command of the CPU can also be issued to the FPGA through the bus interface.
2. The FPGA and CPU data synchronization device of claim 1, wherein:
the data buffer area of the FPGA unit is used for buffering the data reported by each information source;
the change judgment module is used for judging the data in the data cache region in real time and generating a corresponding change mark when the data changes; the interval timing convergence module detects whether the change marks from the n data cache regions are effective or not within a time interval delta t, and if one or more change marks are effective, corresponding interrupt marks are generated at the tail of the time interval delta t;
the interrupt clear logic is used for receiving an interrupt clear command sent by the CPU and generating a corresponding interrupt clear mark;
after the CPU completes an interrupt processing program, an interrupt clearing command is sent through an interface bus;
the interrupt register counter is used for registering the interrupt mark, 1 is added to the interrupt register counter when the interval timing convergence module generates one interrupt mark, and 1 is subtracted from the interrupt register counter when the interrupt clear logic generates one interrupt clear mark;
interrupt mask logic is used for interrupt mask control;
after receiving the interrupt signal, the CPU enters an interrupt service processing program and simultaneously sends an interrupt shielding command through a bus interface, wherein the interrupt shielding signal is effective;
after the CPU finishes the interrupt service processing program, an interrupt shielding removing command is sent through the bus interface, and at the moment, an interrupt shielding signal is invalid;
the interrupt signal generating module is used for generating an interrupt signal which meets the time sequence requirement of the CPU, and generating the interrupt signal when the interrupt shielding signal is invalid and the interrupt register counter is not zero.
3. The data synchronization method of the FPGA and CPU data synchronization device according to any one of claims 1-2, characterized in that:
the method comprises an FPGA processing flow and a CPU processing flow;
the FPGA processing flow comprises the following steps:
s101, caching data of an external information source by a data cache region of the FPGA, and for n information sources, allocating n data cache regions;
s102, carrying out change judgment on data in a data cache region in real time, and generating a corresponding change mark for the cache region with data conversion;
s103, setting a certain time interval, generating an interruption mark at the end of the time interval if one or more change marks are detected to be effective in the time interval, and continuing waiting until the change marks are effective if the change marks are not detected to be effective;
s104, registering the generated interrupt marks, wherein each time one interrupt mark is generated, the interrupt register counter is increased by 1;
s105, if the interrupt mask signal is invalid and the value of the interrupt register counter is nonzero, generating an interrupt signal, if the interrupt mask signal is valid, suspending the interrupt signal generation process and waiting for the interrupt mask signal to be invalid;
s106, the FPGA receives the CPU interrupt shielding command, the interrupt shielding signal becomes effective, and the CPU is waited to finish the interrupt processing program;
s107, after the FPGA receives the interrupt clearing command, the interrupt clearing logic generates an interrupt clearing mark, an interrupt register counter is decreased by 1, and the current interrupt is cleared;
s108, after the FPGA receives the command of releasing the interrupt shielding, the interrupt shielding signal output by the interrupt shielding logic becomes invalid;
the CPU processing flow comprises the following steps:
s201, after receiving an interrupt signal, a CPU sends an interrupt shielding command through a communication bus and forbids an FPGA from generating the interrupt signal during the interrupt processing service program;
s202, the CPU enters an interrupt service program, and reads data in n data cache regions through a communication bus to realize data synchronization of the FPGA and the CPU;
s203, after finishing the interrupt processing service program, the CPU sends an interrupt clearing command to the FPGA;
and S204, sending an interrupt mask removing command to the FPGA.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111077137.3A CN113778684A (en) | 2021-09-15 | 2021-09-15 | Multi-information-source-oriented FPGA and CPU data synchronization device and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111077137.3A CN113778684A (en) | 2021-09-15 | 2021-09-15 | Multi-information-source-oriented FPGA and CPU data synchronization device and method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113778684A true CN113778684A (en) | 2021-12-10 |
Family
ID=78843717
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111077137.3A Pending CN113778684A (en) | 2021-09-15 | 2021-09-15 | Multi-information-source-oriented FPGA and CPU data synchronization device and method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113778684A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102760111A (en) * | 2012-06-27 | 2012-10-31 | 浙江大学 | FPGA-based (Field Programmable Gate Array) extended multi-serial port device and data receiving-transmitting method thereof |
CN104021106A (en) * | 2014-06-19 | 2014-09-03 | 哈尔滨工业大学 | DSP interrupt extension logic system based on FPGA and DSP interrupt extension method based on FPGA |
CN105117319A (en) * | 2015-08-25 | 2015-12-02 | 烽火通信科技股份有限公司 | Method for realizing real-time monitoring of multi-channel MDIO (Management Data Input Output) devices based on FPGA |
CN105677474A (en) * | 2016-04-06 | 2016-06-15 | 福建星网智慧科技股份有限公司 | Interruption polymerization device and method based on FPGA |
CN109343950A (en) * | 2018-10-16 | 2019-02-15 | 南京国电南自维美德自动化有限公司 | A kind of interruption universal process method suitable for Xilinx soft-core processor |
-
2021
- 2021-09-15 CN CN202111077137.3A patent/CN113778684A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102760111A (en) * | 2012-06-27 | 2012-10-31 | 浙江大学 | FPGA-based (Field Programmable Gate Array) extended multi-serial port device and data receiving-transmitting method thereof |
CN104021106A (en) * | 2014-06-19 | 2014-09-03 | 哈尔滨工业大学 | DSP interrupt extension logic system based on FPGA and DSP interrupt extension method based on FPGA |
CN105117319A (en) * | 2015-08-25 | 2015-12-02 | 烽火通信科技股份有限公司 | Method for realizing real-time monitoring of multi-channel MDIO (Management Data Input Output) devices based on FPGA |
CN105677474A (en) * | 2016-04-06 | 2016-06-15 | 福建星网智慧科技股份有限公司 | Interruption polymerization device and method based on FPGA |
CN109343950A (en) * | 2018-10-16 | 2019-02-15 | 南京国电南自维美德自动化有限公司 | A kind of interruption universal process method suitable for Xilinx soft-core processor |
Non-Patent Citations (1)
Title |
---|
吴志勇 等: "基于FPGA的中断控制器设计", 《通信技术》, vol. 51, no. 11, pages 2 - 4 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20110202788A1 (en) | Method and device for clock gate controlling | |
WO2021056632A1 (en) | Host device data transmission extension method based on axi bus | |
EP0551191B1 (en) | Apparatus and method for transferring data to and from host system | |
CN101901200B (en) | Method for realizing double advanced high-performance bus (AHB) Master interface-based on-chip direct memory access (DMA) controller | |
JPS62262160A (en) | Writing buffer unit | |
CN101866328A (en) | Automatically accessed serial bus read/write control method | |
US8698756B2 (en) | Interrupt reduction method in touch screen controller | |
CN101853149A (en) | Method and device for processing single-producer/single-consumer queue in multi-core system | |
US9239811B2 (en) | Data processing apparatus and data processing method | |
CN104714918B (en) | The reception of high speed FC bus datas and way to play for time under hosted environment | |
CN110442321B (en) | Prefetch FIFO circuit and method | |
CN100378687C (en) | A cache prefetch module and method thereof | |
CN110188059A (en) | The flow control type FIFO buffer structure and method of the unified configuration of data valid bit | |
CN111666248A (en) | RS422 serial port communication control system and method based on FPGA | |
CN109067399B (en) | Method for realizing ADC controller with multiple sampling rates | |
CN111274171B (en) | Data transmission device and method | |
CN113778684A (en) | Multi-information-source-oriented FPGA and CPU data synchronization device and method | |
CN105487989A (en) | Interruption controller and interruption control method for reducing response delay and improving system efficiency | |
CN110764926B (en) | 1553B bus RT (reverse transcription) end message stack serial-parallel cross query method | |
CN112749106A (en) | FPGA-based interrupt management method | |
CN101667158B (en) | High speed cache system for stream context | |
CN209118264U (en) | A kind of high-speed data real-time exchange processing unit | |
CN111694773A (en) | AXI-Stream interface write control circuit and method | |
US7552252B2 (en) | Memory interface circuit and method | |
CN203057362U (en) | Dynamically fall backing code stream buffer module system |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20211210 |
|
RJ01 | Rejection of invention patent application after publication |