A dual-end access method, system, main controller card and daughter card
Through the block table communication mechanism, the read and write conflict problem of the main controller card and the child card when accessing the same address unit of the dual-port memory is solved, data consistency and real-timeness are achieved, hardware requirements and costs are reduced, and the main is decoupled. Communication between controller card and daughter card.
Patent Information
- Application Number
- CN202411131908.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-08-19
AI Technical Summary
In the prior art, when the main controller card and the child card are accessed simultaneously on the same address unit of the dual-port memory, read and write conflicts are prone to occur, resulting in data inconsistency and real-time problems, and the existing solutions are inefficient or at risk of blockage.
The block table communication mechanism is adopted, and table entries are used as the basic unit of data read and write operations. The cyclic coverage mechanism is used to write data. The write pointer always points to the latest table entry index value of the sending end that completed the write operation at the latest, and the total number of table items is set. It satisfies that the sender will not perform a write operation until the receiver has read the current table entry data.
The main controller card and the child card simultaneously read and write the same address unit of the dual-port memory without conflict, ensuring data consistency and real-time, reducing hardware requirements, reducing costs, and in time and space The communication between the main controller card and the daughter card is decoupled.
Smart Images

Figure CN118642669B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of memory access, and in particular to a dual-end access method, system, main controller card and daughter card. Background Art
[0002] In the prior art, the situation where two ends simultaneously access a dual-port memory mainly involves four situations of operating the same main memory:
[0003] ① The two ports do not access data to the same address unit at the same time.
[0004] ②The two ports read data from the same address unit at the same time.
[0005] ③The two ports write data to the same address unit at the same time.
[0006] ④ Two ports operate on the same address unit at the same time, one writes data and the other reads data.
[0007] There will be no errors in the first and second cases, but the third case will cause a write error and the fourth case will cause a read error.
[0008] This solution is aimed at the fourth situation. When two boards need to access the same address unit of a dual-port memory at the same time, one of the boards writes data through one port of the dual-port memory, and the other board tries to read the data of the corresponding address unit through the other port of the dual-port memory. At this time, the data read may be old data or a mixture of part of the new data and part of the old data. There is a read-write conflict, resulting in inconsistent read and write data.
[0009] To solve the above problem of inconsistent read and write data, there are three common improvement methods:
[0010] The first solution is through the bus protocol, such as Figure 1As shown, the main controller card and the daughter card are connected through the backplane bus. The service provided by the bus protocol enables the main controller card to access the DPRAM (dual-port random access memory or storage medium) of the daughter card through the backplane bus, and the daughter card accesses the DPRAM through the internal bus, but the bus protocol cannot guarantee the data consistency when both ends access the same address unit of the DPRAM at the same time; the second solution is to use lock control. Specifically, the lock control includes setting the BUSY flag. When a data conflict is detected, the "busy" signal is set to 0, and the judgment logic determines to temporarily close a port (that is, it is delayed). The ports that are not closed are accessed normally, and the closed ports are accessed after a very short period of time. In this way, the consistency and integrity of the data can be ensured, but this method reduces the efficiency of each end in obtaining data and increases the time cost; the third solution is to use a ring queue communication mechanism to solve the problem, but this method has obvious disadvantages: the ring queue communication mechanism implements the first-in-first-out rule. When the queue data is full, subsequent data cannot be written in. Blockage will cause untimely data updates, and ultimately the receiving end cannot read the latest data. Summary of the invention
[0011] The purpose of the present invention is to overcome the problem in the prior art that when a main controller card and a daughter card simultaneously access the same address unit of a dual-port memory, there is a read-write conflict, resulting in inconsistent data read and write and non-real-time data. A dual-end access method, system, main controller card and daughter card are provided to enable the main controller card and the daughter card to simultaneously perform read operations and write operations on the same address unit of the dual-port memory without conflict, thereby ensuring data consistency and real-time performance when the main controller card and the daughter card simultaneously access the same address unit of the dual-port memory.
[0012] The objective of the present invention is achieved through the following technical solutions:
[0013] In a first aspect, a dual-end access method is provided, the method comprising:
[0014] The main controller card and the daughter card simultaneously access the same address unit of the dual-port memory through a block table communication mechanism, and the block table communication mechanism includes:
[0015] The table entry is used as the basic unit of data reading and writing operations; the block table adopts a circular overwrite mechanism to write data, and the write pointer always points to the table entry index value of the latest write operation completed by the sending end; the sending end is a main controller card or a subcard;
[0016] The total number of entries in the block table is set to satisfy:
[0017] The sender will not write data to the current entry before the receiver has finished reading the current entry data.
[0018] In some embodiments, the space of the dual-port memory is divided into a header information area and a data area, the header information area includes a subcard basic information area and a subcard special configuration area, and the data area includes a block table communication area; wherein the block table communication area includes a block table receiving area and a block table sending area, the block table receiving area is used for the subcard to receive data sent by the main controller card, and the block table sending area is used for the subcard to send data to the main controller card.
[0019] Preferably, the logical structures of the block table receiving area and the block table sending area both include the total number of table entries, the length of the table entries, the base address of the table entries, and the write pointer of the table entries.
[0020] Preferably, the block table receiving area and the block table sending area are both controlled by a plurality of registers, and the plurality of registers include a block table length information register, a block table base address register and a block table write pointer register.
[0021] In some embodiments, the total number of entries in the block table is calculated as follows:
[0022] WTime*(N-1)>RTime
[0023] Wherein, N is the total number of table entries, WTime is the time for the sender to write a table entry, and RTime is the time for the receiver to read a table entry.
[0024] In some embodiments, the step of the main controller card and the daughter card simultaneously accessing the same address unit of the dual-port memory through the block table communication mechanism includes:
[0025] S1, the main controller card and the sub-card are powered on and initialized, and the block table information is configured in the main controller card and the sub-card respectively;
[0026] S2, the main controller card and the sub-card perform handshake activation to ensure that the block table configuration information configured in the main controller card and the sub-card is consistent;
[0027] S3. After activation, normal communication between the main controller card and the sub-card is performed.
[0028] Preferably, the main controller card and the sub-card are powered on and initialized by:
[0029] S11, the daughter card is powered on to initialize the logical structure of the block table of the local end and the physical space managed by the block table;
[0030] S12, after the sub-card is initialized, it enters the handshake-ready state;
[0031] S13, the main controller card can successfully obtain the sub-card header information area data through the backplane bus, initialize the local block table logical structure of the main controller card according to the block table information in the header information area data, and complete the preparation work for sending and receiving data through the block table.
[0032] In a second aspect, a dual-port access system is provided, the system comprising a main controller card and a daughter card, the main controller card and the daughter card are connected via a backplane bus, the main controller card and the daughter card simultaneously access the same address unit of the dual-port memory via a block table communication mechanism, the block table communication mechanism comprising:
[0033] The table entry is used as the basic unit of data reading and writing operations; the block table adopts a circular overwrite mechanism to write data, and the write pointer always points to the table entry index value of the latest write operation completed by the sending end; the sending end is a main controller card or a subcard;
[0034] The total number of entries in the block table is set to satisfy:
[0035] The sender will not write data to the current entry before the receiver has finished reading the current entry data.
[0036] In a third aspect, a main controller card is provided, wherein the main controller card is connected to a daughter card via a backplane bus, and the main controller card accesses a dual-port memory via a block table communication mechanism, wherein the block table communication mechanism includes:
[0037] The table entry is used as the basic unit of data reading and writing operations; the block table adopts a circular overwrite mechanism to write data, and the write pointer always points to the table entry index value of the latest write operation completed by the sender; the main controller card is the sender or the receiver;
[0038] The total number of entries in the block table is set to satisfy:
[0039] The sender will not write data to the current entry before the receiver has finished reading the current entry data.
[0040] In a fourth aspect, a daughter card is provided, wherein the daughter card is connected to a main controller card via a backplane bus, and the daughter card accesses a dual-port memory via a block table communication mechanism, wherein the block table communication mechanism includes:
[0041] The table entry is used as the basic unit of data reading and writing operations; the block table adopts a circular overwrite mechanism to write data, and the write pointer always points to the table entry index value of the latest write operation completed by the sender; the subcard is a sender or a receiver;
[0042] The total number of entries in the block table is set to satisfy:
[0043] The sender will not write data to the current entry before the receiver has finished reading the current entry data.
[0044] It should be further explained that the technical features corresponding to the above options can be combined or replaced with each other to form a new technical solution if there is no conflict.
[0045] Compared with the prior art, the present invention has the following beneficial effects:
[0046] (1) The main controller card and the subcard of the present invention simultaneously access the same address unit of the dual-port memory through the block table communication mechanism. Through the customized block table communication mechanism and the reasonable setting of the total number of table items in the block table, the sending end (main controller card or subcard) will not write data to the current table item before the receiving end (main controller card or subcard) finishes reading the current table item data, so that the main controller card and the subcard can simultaneously perform read and write operations on the same address unit of the dual-port memory without conflict, solve the problem of data consistency when the main controller card and the subcard simultaneously access the same address unit of the dual-port memory, and improve the real-time performance of the data. The communication between the main controller card and the subcard can be decoupled in time and space, and data transmission and control command interaction between the main controller card and the subcard can be realized, reducing the complexity of the upper-layer application design.
[0047] (2) In some examples, the block table uses a circular overwrite mechanism to write data, and the write pointer always points to the table entry index value of the sender's most recent write operation, so that the receiver can only read the most recent data written by the sender each time, and other non-latest data will be ignored.
[0048] (3) In some examples, under the custom block table communication mechanism, the communication between the sender and the receiver is non-blocking, that is, the sender can write data at any time, and the receiver can read data at any time without being blocked by the other party's operation.
[0049] (4) In some examples, the block table communication mechanism of the present invention can ensure efficient, unified, and lock-free information exchange when two ends simultaneously access the same address unit of the dual-port memory. It has no hardware requirements, reduces hardware purchase costs and R&D costs, and facilitates the promotion and implementation of R&D products. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A schematic diagram of a communication architecture between a main controller card and a sub-card according to an embodiment of the present invention;
[0051] Figure 2 A schematic diagram of the block table communication principle shown in an embodiment of the present invention;
[0052] Figure 3A schematic diagram of the DPRAM space partition of a daughter card shown in an embodiment of the present invention;
[0053] Figure 4 Four read and write scenarios of registers in the daughter card DPRAM are shown in the embodiment of the present invention;
[0054] Figure 5 A schematic diagram of the division of the communication area of the block table according to an embodiment of the present invention;
[0055] Figure 6 A timing diagram of power-on handshake between a main controller card and a daughter card shown in an embodiment of the present invention;
[0056] Figure 7 The process of block table communication between the main controller card and the daughter card shown in the embodiment of the present invention;
[0057] Figure 8 This is a schematic diagram of the physical space status of the daughter card at times T1 and T3 according to an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The technical solution of the present invention is clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the accompanying drawings can be arranged and designed in various configurations. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0059] It should be noted that the defects existing in the solutions in the above-mentioned prior art are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above-mentioned problems and the solutions proposed in the embodiments of the present application for the above-mentioned problems below should all be the contributions made by the inventor to the present application in the process of invention and creation, and should not be understood as technical contents known to technical personnel in this field.
[0060] Based on the above related statements, since this embodiment involves technologies related to memory access, in order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the following explains the relevant professional terms that may be involved in the present invention:
[0061] 1. DPRAM: It is a dual-port random access memory or storage medium. DPRAM has two sets of read and write addresses. These two sets of read and write addresses can perform read and write operations separately.
[0062] 2. MLVDS bus: The Chinese name is multi-point low voltage differential signal bus, which is a high-speed system bus for multi-node applications. It has many advantages, such as high communication rate, low power consumption, strong anti-interference ability, long transmission distance (up to 40m), simple network topology (bus topology), etc. It gradually replaces RS485 bus and is widely used in the industrial field. In recent years, the military field has used MLVDS to build system-level buses for command and data transmission.
[0063] 3. ISA bus: The English name is Industry Standard Architecture, also known as industrial standard architecture. It is a bus standard developed for PC / AT computers. It is a 16-bit architecture that can only support 16-bit I / O devices and has a data transfer rate of about 16MB / S. It is also called AT standard.
[0064] 4. AT96 bus: The AT96 bus European card standard was initiated by the German SIEMENS company, which applied ISA bus PCs in harsh industrial environments. It has high performance and high reliability and can be used on moving targets.
[0065] In view of the technical problems pointed out in the background technology, the embodiments provided by the present invention are as follows:
[0066] In an exemplary embodiment, a dual-port memory connected to a daughter card (hereinafter referred to as daughter card DPRAM) is used as an example to provide a dual-port access method. Figure 1 The architecture shown in the figure, in which the main controller card and the daughter card are connected through the backplane bus, the daughter card DPRAM is the storage medium, and the bus protocol provides the specifications of the physical layer and the data link layer. The bus protocol can be any protocol that can realize two-end communication, such as the MLVDS bus protocol, the AT96 bus protocol, or the ISA bus protocol, and is not specifically limited here. This method defines a daughter card DPRAM and application interface protocol based on the bus protocol, stipulates the communication mode and control rules between the main controller card and the daughter card, and other application layer protocols are application layer protocols defined according to specific application requirements.
[0067] Specifically, the daughter card DPRAM and application interface protocol designs an access method between the main controller card and the daughter card using a block table communication mechanism and a set of registers to achieve data consistency when both ends simultaneously access the same address unit of the DPRAM. The method includes:
[0068] The main controller card and the daughter card simultaneously access the same address unit of the daughter card DPRAM through a block table communication mechanism, and the rule definition of the block table communication mechanism includes:
[0069] The table entry is used as the basic unit of data reading and writing operations; the block table uses a circular overwrite mechanism to write data, such as Figure 2 , when the write pointer points to the last table entry N-1, after writing is completed, the next pointer will point to table entry 0, and then write the latest data in sequence to cyclically overwrite the aforementioned existing table entry data. And the write pointer always points to the table entry index value of the latest write operation completed by the sender, that is, the write pointer is updated only after the table entry writing action is completed; the sender is a main controller card or a subcard, when the sender is a main controller card, the subcard is the receiving end, when the sender is a subcard, the main controller card is the receiving end.
[0070] The total number of entries in the block table is set to satisfy:
[0071] The sender will not write data to the current entry before the receiver has finished reading the current entry data.
[0072] The main controller card and the subcard of the present invention simultaneously access the same address unit of the subcard DPRAM through a block table communication mechanism. Through a customized block table communication mechanism and a reasonable setting of the total number of table items in the block table, the sending end does not write data to the current table item before the receiving end finishes reading the current table item data, so that the main controller card and the subcard can simultaneously perform read and write operations on the same address unit of the subcard DPRAM without conflict, solve the problem of data consistency when the main controller card and the subcard both simultaneously access the same address unit of the subcard DPRAM, and improve the real-time performance of the data. The communication between the main controller card and the subcard can be decoupled in time and space, data transmission and control command interaction between the main controller card and the subcard can be realized, and the complexity of upper-layer application design is reduced.
[0073] Furthermore, the block table communication mechanism of the present invention is applicable to distributed control systems, the Internet of Things, and multi-card computing structures. The block table communication mechanism can ensure efficient, unified, and lock-free information exchange when both ends simultaneously access the same address unit of the dual-port memory.
[0074] It should be noted that the dual-port memory can be connected to the main control card to become the main card DPRAM, and can also be connected to the daughter card to become the daughter card DPRAM, that is, the memory of the present invention should be understood as any memory or storage medium that can realize dual-port communication, and the memory can be connected to the main controller card and / or the daughter card according to actual design requirements.
[0075] In another exemplary embodiment, based on the inventive concept of Example 1, this embodiment details the design process of the block table communication mechanism under the daughter card DPRAM and application interface protocol. The daughter card DPRAM and application interface protocol are composed of a storage medium (daughter card DPRAM) and a method for managing the storage medium (block table communication mechanism).
[0076] Reference Figure 3 The space of the daughter card DPRAM is divided into a header information area, a data area and a reserved area. The header information area includes a daughter card basic information area and a daughter card special configuration area. The daughter card basic information area is used to store the daughter card's identity information and interactive control information, and the daughter card special configuration area is used to store some configuration information written by the main controller card to the daughter card; the data area includes a block table communication area, and the block table communication area is a physical area managed by the block table communication mechanism.
[0077] The block table communication area in the daughter card DPRAM is further subdivided into a block table receiving area and a block table sending area. The block table receiving area is used by the daughter card to receive data sent by the main controller card, and the block table sending area is used by the daughter card to send data to the main controller card.
[0078] Among them, the space size of the daughter card DPRAM and the size of each area can be reasonably planned according to the actual usage scenario. The actual size of the data area is limited by the DPRAM hardware and is not limited here. For example, in some scenarios, the total space size of the daughter card DPRAM is 32KB, the header information area occupies 2KB, the daughter card basic information area occupies 256 bytes, the daughter card special configuration area occupies 7*256 bytes, the data area and the reserved area occupy 30KB in total, and a certain reserved area is also set in the data area. The size of the reserved area in the data area is 256 bytes, and the block table receiving area and the block table sending area both occupy 6*256 bytes.
[0079] Furthermore, the register architecture of the header information area is constructed. The following content clearly defines the fields in each sub-partition in the header information area space, describes the field name, field verification method, read and write permissions, and the length of the space occupied. See Table 1 for details. The contents in the table follow the following conventions:
[0080] Memory check: Parity check - data is parity checked; NA - no requirement;
[0081] Read and write permissions: S-daughter card; M-main controller card; R-read; W-write (for example: SR daughter card read permission); NA-undefined; NA-not used.
[0082] Data type: U32 - unsigned 32-bit integer; NA - not used or not required.
[0083] Endian: Little endian - little endian storage; NA - not used or not required.
[0084] Table 1 Subcard basic information area - partial field definition
[0085] Serial number Offset Field Tags Field Name Field validation Read and write permissions Space occupied Data Types Endian 1 008h REGVersion Register Version Parity SR / SW / MR X bytes U32 Little Endian 2 020h Reserve Reserve none none X bytes none none 3 024h Reserve Reserve none none X bytes none none 4 028h Reserve Reserve none none X bytes none none 5 02Ch Reserve Reserve none none X bytes none none 6 030h TXBlockLenthInfo Subcard block table sending area length information Parity SW / MR X bytes U32 Little Endian 7 034h TXBlockBase Subcard block table sending area base address Parity SW / MR X bytes U32 Little Endian 8 038h RXBlockLengthInfo Subcard block table receiving area length information Parity SW / MR X bytes U32 Little Endian 9 03Ch RXBlockBase Subcard block table receiving area base address Parity SW / MR X bytes U32 Little Endian 10 040h Reserve Reserve none none X bytes none none 11 054h TXBlockWrite Subcard block table send area write pointer Parity SW / MR X bytes U32 Little Endian 12 058h SelfCheckInfo_1 Subcard self-test information register 1 Parity SW / MR X bytes U32 Little Endian 13 05Ch SelfCheckInfo_2 Subcard self-test information register 2 Parity SW / MR X bytes U32 Little Endian 14 060h FaultState1 Error Status Register 1 Parity SR / SW / MR X bytes U32 Little Endian 15 064h FaultState2 Error Status Register 2 Parity SR / SW / MR X bytes U32 Little Endian 16 068h FaultCount1 Error Counter Register 1 Parity SR / SW / MR X bytes U32 Little Endian 17 06Ch FaultCount2 Error Counter Register 2 Parity SR / SW / MR X bytes U32 Little Endian 18 070h Reserve Reserve none none X bytes none none 19 074h Reserve Reserve none none X bytes none none 20 078h Reserve Reserve none none X bytes none none 21 088h RXBlockWrite Subcard block table receiving area write pointer Parity SW / SR / MW X bytes U32 Little Endian 22 090h Reserve Reserve none none X bytes none none 23 094h Reserve Reserve none none X bytes none none 24 098h ReserveSpace Reserved space, not used. NA NA X bytes NA NA
[0086] Further, the registers are defined in detail. The following content clearly defines the bit fields and value meanings of each register, as shown in Table 2 below:
[0087] The contents in the table follow the following conventions:
[0088] Value: NA - determined by each daughter card; b - binary value; d - decimal value; h - hexadecimal value; other - any other value.
[0089] Table 2 Subcard basic information area - definition of some field values
[0090] Serial number Field Tags Field value definitions and descriptions 1 REGVersion 31-30 bits: The domain name is described as parity check, with a value of NA. The two values are calculated by the parity check algorithm; 29-25 bits: The domain name is described as reserved, with a value of 0d; 24-16 bits: The domain name is described as the major version number, with a value of NA. This value is set by each subcard and ranges from 0 to 255d; 15-8 bits: The domain name is described as the minor version number, with a value of NA. This value is set by each subcard and ranges from 0 to 255d; 7-0 bits: The domain name is described as the minor version number, with a value of NA. This value is set by each subcard and ranges from 0 to 255d. 2 Reserve Reserved. 3 Reserve Reserved. 4 Reserve Reserved. 5 Reserve Reserved. 6 TXBlockLenthInfo 31-30 bits: the domain name is described as parity check, the value is NA, and the two values are calculated by the parity check algorithm; 29-16 bits: the domain name is described as reserved, the value is NA, and the default value is 0; 15-8 bits: the domain name is described as the total number of table entries, the value is NA, representing the total number of table entries in the block table, the value range is: 0<number of table entries≤0xFF. (limited by practical hardware design); 7-0 bits: the domain name is described as the length of the table entry, the value is NA, representing the length of a single table entry in the block table, unit: 4 bytes, the value range is: 0<table entry length≤0xFF. (limited by practical hardware design). 7 TXBlockBase 31-30 bits: The domain name is described as parity check, the value is NA, and the two-bit value is calculated by the parity check algorithm; 29-0 bits: The domain name is described as the block table base address, the value is NA, and this item indicates the block table sending area base address. The value range is 0~3FFFFFFFh. 8 RXBlockLengthInfo 31-30 bits: the domain name is described as parity check, the value is NA, and the two values are calculated by the parity check algorithm; 29-16 bits: the domain name is described as reserved, the value is NA, and the default value is 0; 15-8 bits: the domain name is described as the total number of table entries, the value is NA, representing the total number of table entries in the block table, the value range is: 0<number of table entries≤0xFF. (limited by practical hardware design); 7-0 bits: the domain name is described as the length of the table entry, the value is NA, representing the length of a single table entry in the block table, unit: 4 bytes, the value range is: 0<table entry length≤0xFF. (limited by practical hardware design). 9 RXBlockBase 31-30 bits: The domain name is described as parity check, the value is NA, and the two-bit value is calculated by the parity check algorithm; 29-0 bits: The domain name is described as the block table base address, the value is NA, and this item indicates the block table sending area base address. The value range is 0~3FFFFFFFh. 10 Reserve reserve. 11 TXBlockWrite Bits 31-30: The domain name is described as parity check, and the value is NA. The two-bit value is calculated by the parity check algorithm. Bits 29-0: The domain name is described as block table write pointer, and the value is NA. This item is the write pointer of the block table sending area, and the value range is 0~3FFFFFFFh. 12 SelfCheckInfo_1 Bits 31-30: The domain name is described as parity check, and the value is NA. The two-bit value is calculated by the parity check algorithm. Bits 29-0: The domain name is described as self-test status, and the value is NA, indicating that the subcard indicates the current self-test status, and the value range is 0~3FFFFFFFh; the specific definition is determined by each subcard. 13 SelfCheckInfo_2 Bits 31-30: The domain name is described as parity check, and the value is NA. The two-bit value is calculated by the parity check algorithm. Bits 29-0: The domain name is described as self-test status, and the value is NA, indicating that the subcard indicates the current self-test status, and the value range is 0~3FFFFFFFh; the specific definition is determined by each subcard. 14 FaultState_1 Bits 31-30: The domain name is described as a parity check, and the value is NA. The two-bit value is calculated by the parity check algorithm. Bits 29-0: The domain name is described as an error state, and the value is NA. This value is used to store the error state bit by bit, and the value range is 0~3FFFFFFFh. 15 FaultState_2 Bits 31-30: The domain name is described as a parity check, and the value is NA. The two-bit value is calculated by the parity check algorithm. Bits 29-0: The domain name is described as an error state, and the value is NA. This value is used to store the error state bit by bit, and the value range is 0~3FFFFFFFh. 16 FaultCount_1 31-30 bits: The domain name is described as parity check, the value is NA, and the two-bit value is calculated by the parity check algorithm; 29-0 bits: The domain name is described as error count, the value is NA, and the value is used to record the number of errors. The value range is 0~3FFFFFFFh. 17 FaultCount_2 31-30 bits: The domain name is described as parity check, the value is NA, and the two-bit value is calculated by the parity check algorithm; 29-0 bits: The domain name is described as error count, the value is NA, and the value is used to record the number of errors. The value range is 0~3FFFFFFFh. 18 Reserve Reserved. 19 Reserve Reserved. 20 Reserve Reserved. 21 RXBlockWrite Bits 31-30: The domain name is described as parity check, and the value is NA. The two-bit value is calculated by the parity check algorithm. Bits 29-0: The domain name is described as block table write pointer, and the value is NA. This item is the write pointer of the block table sending area, and the value range is 0~3FFFFFFFh. 22 Reserve Reserved. 23 Reserve Reserved. 24 ReserveSpace Reserve space.
[0091] Furthermore, in register access management, the main controller card and the daughter card are allowed to access one or more continuous DPRAM double-word spaces at a time, and the specific restrictions on accessing multiple DPRAM double-word spaces are specified by the bus protocol.
[0092] The specific process of accessing registers in DPRAM is as follows Figure 4 As shown, there are four scenarios, among which cross-board access requires bus protocol to provide access services, and local access is accessed through the internal bus. For access details, please refer to the relevant bus protocol specifications, which will not be described in detail in this protocol. The specific scenarios are as follows:
[0093] Scenario 1: The main controller card reads the daughter card DPRAM register
[0094] The registers in the daughter card DPRAM have the master controller card read (MR) permission, and the master controller card can read and access them through the process shown in the figure. When reading, the master controller card first initiates the read request, and the daughter card hardware automatically replies with the pre-read value.
[0095] Scenario 2: The main controller card writes the daughter card DPRAM register
[0096] The registers in the daughter card DPRAM that have write (MW) permissions for the main controller card can be accessed by the main controller card through the process shown in the figure. When writing, the main controller card sends data to the daughter card, and the daughter card hardware automatically writes the value to the specified DPRAM register.
[0097] Scenario 3: Subcard reads local DPRAM register
[0098] The daughter card has the daughter card read (SR) permission in the daughter card DPRAM register, which the daughter card can read and access through the process shown in the figure. The daughter card directly reads the specified DPRAM register value through the internal bus.
[0099] Scenario 4: Subcard writes local DPRAM register
[0100] The daughter card has write (SW) permissions for the registers in the daughter card DPRAM. The daughter card can access the registers by writing through the process shown in the figure. The daughter card directly writes the value to the specified DPRAM register through the internal bus.
[0101] Furthermore, the block table communication mechanism is described in detail below.
[0102] The data area sub-partitions are defined as shown in Table 3 below:
[0103] The contents in the table follow the following conventions:
[0104] Offset: NA - determined by each daughter card, not limited by this protocol;
[0105] Read and write permissions: S-subcard M-main controller card R-read W-write (e.g. SR subcard read permission);
[0106] Space occupied: NA - determined by each daughter card and not limited by this protocol.
[0107] Table 3 Division of the DPRAM data area of the daughter card
[0108] Serial number Offset Field Name Read and write permissions Space occupied 1 0x0800 Block table sending area SW / MR 6*256 bytes 2 0x0E00 Block table receiving area SR / MW 6*256 bytes 3 0x1400 Reserved Area NA 256 bytes
[0109] In the above table, the "block table sending area" is used by the sub-card to send data to the main controller card, and the "block table receiving area" is used by the sub-card to receive data sent by the main controller card.
[0110] The block table communication mechanism consists of a storage medium and a logical data structure that manages the storage medium. The logical data structure is referred to as the "block table", and the storage medium is a physical space in the DPRAM called the "block table communication area". The specific definition is as follows Figure 5 As shown, the block table communication area is further divided into a block table sending area and a block table receiving area. The block table sending area and the block table receiving area are both controlled by three registers, which are an independent block table length information register (including the number of table entries and the length of table entries), a block table base address register, and a block table write pointer register.
[0111] Furthermore, the block table communication principle of the present invention is as follows:
[0112] A block table communication channel consists of the receiving end block table logical structure, the sending end block table logical structure and the "physical" storage area. The logical structure of the block table consists of the total number of table entries, table entry length, table entry base address, and table entry write pointer. The specific design is as follows Figure 2 As shown. In the figure, the "block table sending area" is used to introduce the principle, and the receiving area is similar and will not be described in detail. The figure shows the definition of the physical space used for block table communication, and also shows the logical data structure "block table" used to manage the physical space.
[0113] Furthermore, the "solid arrow" in the figure always points to the latest entry 2 that has completed the write operation, and the "dummy arrow" always points to the entry that is currently being written or will be written next. Only the "solid arrow" is visible to the receiving end, and the receiving end reads the entry pointed to by the "solid arrow" when receiving. When the following relationship is satisfied, the block entry can completely avoid the simultaneous occurrence of read and write operations in terms of time, ensuring data consistency.
[0114] WTime*(N-1)>RTime
[0115] Among them, N is the total number of table entries, WTime is the time for the sender to write a table entry. When data is sent periodically, this time can refer to the sending cycle time + the table entry writing time, and RTime is the time for the receiver to read a table entry. After transformation, the above formula can be obtained:
[0116] N>RTime / WTime+1
[0117] It can be known from the calculation formula of the total number of table items that the total number of table items is related to the time to write a table item and the time to read a table item. In practice, under the premise that the time for the sender to write a table item is fixed, the longer the time for the receiver to read a table item, the larger the total number of table items should be set. Otherwise, the total number of table items can be appropriately reduced. Under the premise that the time for the receiver to read a table item is fixed, the longer the time for the sender to write a table item, the smaller the total number of table items should be set. Otherwise, the total number of table items can be appropriately increased. In short, it is ensured that the write pointer of the corresponding table item will not be specified before the currently received table item data is received, that is, it is ensured that the table item will not be written before reading is completed.
[0118] When actually using block table communication, it is necessary to calculate the minimum value of N according to the actual reading and writing time in the system. Under the setting of the total number of table items, the receiving end can only read the latest data written by the sending end each time, and other non-latest data will be ignored. At the same time, the communication between the sending end and the receiving end is non-blocking, that is, the sending end can write data at any time, and the receiving end can read data at any time without being blocked by the other party's operation. Whether the data in the block table changes is provided by other protocols in the application layer and is not within the scope of the DPRAM and application interface protocol specification.
[0119] Furthermore, the block table rule definition in the block table communication mechanism also includes:
[0120] A 32-bit cyclic redundancy check algorithm is used in the block table to ensure the data integrity of the "table item". Here, the cyclic redundancy check algorithm can be adaptively replaced with a check algorithm of other bits according to the actual scenario or demand, and it is not interpreted as a limitation of this application. Specifically, the DPRAM and application interface protocol provide basic data integrity detection functions. In each table item, the data format is as follows:
[0121]
X bytes
[0122]
X bytes
[0123]
X bytes
[0124]
X bytes
[0125] Users who use this communication mechanism can only obtain the data segments in the table entries, and other information in the table entries is only used for data integrity verification by the block table communication mechanism itself.
[0126] Furthermore, a scenario in which a daughter card writes data and a main controller card receives data is selected to describe the specific process of communicating through the block table.
[0127] <1> Power-on initialization stage: The main controller card and the sub-card are powered on and initialized, and the block table information is configured in the main controller card and the sub-card respectively;
[0128] like Figure 6 As shown, regardless of the order in which the main controller card and the daughter card are powered on and initialized, the main controller card and the daughter card can communicate through the block table only after they complete the handshake. The steps for initializing the handshake are as follows:
[0129] 1) The daughter card is powered on to initialize the logical structure of the local block table and the physical space managed by the block table.
[0130] 2) After the daughter card is initialized, it enters the handshake-able state (backplane communication is enabled and the main controller card can access the daughter card DPRAM physical medium).
[0131] 3) At this time, the main controller card can successfully obtain the data in the header information area of the daughter card through the backplane bus. According to the block table information in the header information, the local block table logical structure of the main controller card is initialized to complete the preparation work of sending and receiving data through the block table.
[0132] <2> Handshake activation stage: The main controller card and the sub-card perform handshake activation to ensure that the block table configuration information configured in the main controller card and the sub-card is consistent; the handshake activation steps are as follows:
[0133] 4) If Figure 6 As shown, after the main controller card completes initializing the logical structure of the block table, it activates the handshake process, sends configuration information to the daughter card, and notifies the daughter card that the configuration is completed.
[0134] 5) The daughter card detects the configuration completion flag, sets the handshake completion flag after performing relevant actions, and starts to execute normal working tasks.
[0135] Through the above steps, the main controller card and the daughter card ensure the consistency of the management information of the logical structure of the block table in the main controller card and the daughter card during the initialization phase.
[0136] <3> Formal communication stage: After activation, normal communication between the main controller card and the sub-card is carried out.
[0137] like Figure 7 As shown in FIG. 1 , the process of block table communication between the main controller card and the daughter card is shown, and the physical space status of the daughter card at time T1 and T3 is also shown. Figure 8 , the specific process is as follows:
[0138] Step ①: The main controller card requests to write the pointer position at time T0.
[0139] Step ②: The main controller card receives it at time T2.
[0140] The "write pointer" of the subcard at time T1 points to "entry 2".
[0141] Step 3: The main controller card requests the data of "Table Item 2", and the daughter card responds at time T3. At this time, the daughter card is writing to "Table Item 5" and does not overwrite the data of "Table Item 2".
[0142] Step ④: The main controller card receives the "entry 2" data at time T4.
[0143] The figure is only for showing the principle. In order to ensure that the table items being read by the main controller card do not have read-write conflicts during the reading process, the total number of table items in the block table is limited to a minimum value in the block table communication principle to avoid the above access conflicts.
[0144] The present invention adopts a self-developed block table communication mechanism to solve the problem of data consistency when the main controller card and the sub-card both access the same address unit of the DPRAM at the same time. The block table communication mechanism ensures that the data read by the receiving end each time is the latest data written by the sending end. This communication mechanism improves the real-time performance of the data while ensuring data consistency, so that the communication between the main controller card and the sub-card can be decoupled in time and space, realizing data transmission and control command interaction between the main and sub-cards, and reducing the complexity of the upper-layer application design.
[0145] In another exemplary embodiment, the above method is applied to input and output cards. For input cards, the main controller card only cares about the latest data collected by the input card and is not interested in historical data. For output cards, the output card only cares about the latest output instruction sent by the main controller card and is not interested in historical output instructions.
[0146] In another exemplary embodiment, based on the same inventive concept as that of embodiment 1, a dual-end access system is provided, the system comprising a main controller card and a daughter card, the main controller card and the daughter card are connected via a backplane bus, the main controller card and the daughter card simultaneously access the same address unit of the daughter card DPRAM via a block table communication mechanism, the block table communication mechanism comprising:
[0147] The table entry is used as the basic unit of data reading and writing operations; the block table adopts a circular overwrite mechanism to write data, and the write pointer always points to the table entry index value of the latest write operation completed by the sending end; the sending end is a main controller card or a subcard;
[0148] The total number of entries in the block table is set to satisfy:
[0149] The sender will not write data to the current entry before the receiver has finished reading the current entry data.
[0150] When the system performs dual-end access, it implements the same functions as the corresponding parts in the method, which will not be described in detail here.
[0151] In another exemplary embodiment, based on the same inventive concept as that of embodiment 1, a main controller card is provided, wherein the main controller card is connected to a daughter card via a backplane bus, and the main controller card accesses the daughter card DPRAM via a block table communication mechanism, wherein the block table communication mechanism includes:
[0152] The table entry is used as the basic unit of data reading and writing operations; the block table adopts a circular overwrite mechanism to write data, and the write pointer always points to the table entry index value of the latest write operation completed by the sender;
[0153] The total number of entries in the block table is set to satisfy:
[0154] The sender will not write data to the current entry before the receiver has finished reading the current entry data.
[0155] Furthermore, the main controller card can be a transmitting end or a receiving end. When the main controller card is a transmitting end, data is written to the daughter card DPRAM through a block table communication mechanism; when the main controller card is a receiving end, data is read from the daughter card DPRAM through a block table communication mechanism. The process of the main controller card reading and writing data to the daughter card DPRAM using the block table communication mechanism is the same as the method part embodiment, and will not be repeated here.
[0156] In addition, the main controller card can be used in conjunction with any daughter card that meets the bus communication and block table communication mechanisms to achieve simultaneous access to the same address unit of the daughter card DPRAM.
[0157] In another exemplary embodiment, based on the same inventive concept as that of embodiment 1, a daughter card is provided, wherein the daughter card is connected to a main controller card via a backplane bus, and the daughter card accesses the daughter card DPRAM via a block table communication mechanism, wherein the block table communication mechanism includes:
[0158] The table entry is used as the basic unit of data read and write operations; the block table uses a circular overwrite mechanism to write data, and the write pointer always points to the index value of the table entry where the sender has completed the most recent write operation; the total number of table entries in the block table is set to meet the following conditions:
[0159] The sender will not write data to the current entry before the receiver has finished reading the current entry data.
[0160] Furthermore, the daughter card can be a transmitting end or a receiving end. When the daughter card is a transmitting end, data is written to the daughter card DPRAM through the block table communication mechanism; when the daughter card is a receiving end, data is read from the daughter card DPRAM through the block table communication mechanism. The process of the daughter card reading and writing data to the daughter card DPRAM using the block table communication mechanism is the same as the method part embodiment, and will not be repeated here.
[0161] In addition, the daughter card can be used in conjunction with any main controller card that meets the bus communication and block table communication mechanisms to achieve simultaneous access to the same address unit of the daughter card DPRAM.
[0162] It should be noted that the above-mentioned main control card and sub-card are not interpreted as limiting the primary and secondary status of the two. In practical applications, any two boards based on the above-mentioned communication mechanism are within the protection scope of this application.
[0163] The above specific implementation methods are detailed descriptions of the present invention. It cannot be determined that the specific implementation methods of the present invention are limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions and substitutions can be made without departing from the concept of the present invention, which should be regarded as belonging to the protection scope of the present invention.
Claims
1. A dual-end access method, characterized in that: The method comprises: The main controller card and the daughter card simultaneously access the same address unit of the dual-port memory through a block table communication mechanism, and the block table communication mechanism includes: The table entry is used as the basic unit of data reading and writing operations; the block table adopts a circular overwrite mechanism to write data, and the write pointer always points to the table entry index value of the latest write operation completed by the sending end; the sending end is a main controller card or a subcard; The total number of entries in the block table is set to satisfy: Before the receiving end finishes reading the current table entry data, the sending end will not write data to the current table entry; the total number of table entries in the block table is calculated as follows: WTime*(N-1)>RTime Wherein, N is the total number of table entries, WTime is the time for the sender to write a table entry, and RTime is the time for the receiver to read a table entry.
2. The dual-end access method according to claim 1, characterized in that: The space of the dual-port memory is divided into a header information area and a data area, the header information area includes a subcard basic information area and a subcard special configuration area, and the data area includes a block table communication area; wherein the block table communication area includes a block table receiving area and a block table sending area, the block table receiving area is used for the subcard to receive data sent by the main controller card, and the block table sending area is used for the subcard to send data to the main controller card.
3. The dual-end access method according to claim 2, characterized in that: The logical structures of the block table receiving area and the block table sending area both include the total number of table entries, the length of the table entries, the base address of the table entries, and the write pointer of the table entries.
4. The dual-end access method according to claim 2, characterized in that: The block table receiving area and the block table sending area are both controlled by a plurality of registers, and the plurality of registers include a block table length information register, a block table base address register, and a block table write pointer register.
5. The dual-end access method according to claim 1, characterized in that: The steps of the main controller card and the daughter card simultaneously accessing the same address unit of the dual-port memory through the block table communication mechanism include: S1, the main controller card and the sub-card are powered on and initialized, and the block table information is configured in the main controller card and the sub-card respectively; S2, the main controller card and the sub-card perform handshake activation to ensure that the block table configuration information configured in the main controller card and the sub-card is consistent; S3. After activation, normal communication between the main controller card and the sub-card is performed.
6. The dual-end access method according to claim 5, characterized in that: The main controller card and the sub-card perform power-on initialization specifically including: S11, the daughter card is powered on to initialize the logical structure of the block table of the local end and the physical space managed by the block table; S12, after the sub-card is initialized, it enters the handshake-ready state; S13, the main controller card can successfully obtain the sub-card header information area data through the backplane bus, initialize the local block table logical structure of the main controller card according to the block table information in the header information area data, and complete the preparation work for sending and receiving data through the block table.
7. A dual-end access system, characterized in that: The system includes a main controller card and a daughter card, the main controller card and the daughter card are connected via a backplane bus, the main controller card and the daughter card simultaneously access the same address unit of the dual-port memory via a block table communication mechanism, and the block table communication mechanism includes: The table entry is used as the basic unit of data reading and writing operations; the block table adopts a circular overwrite mechanism to write data, and the write pointer always points to the table entry index value of the latest write operation completed by the sending end; the sending end is a main controller card or a subcard; The total number of entries in the block table is set to satisfy: Before the receiving end finishes reading the current table entry data, the sending end will not write data to the current table entry; the total number of table entries in the block table is calculated as follows: WTime*(N-1)>RTime Wherein, N is the total number of table entries, WTime is the time for the sender to write a table entry, and RTime is the time for the receiver to read a table entry.
8. A main controller card, characterized in that: The main controller card is connected to the daughter card via a backplane bus, and the main controller card accesses the dual-port memory via a block table communication mechanism, wherein the block table communication mechanism includes: The table entry is used as the basic unit of data reading and writing operations; the block table adopts a circular overwrite mechanism to write data, and the write pointer always points to the table entry index value of the latest write operation completed by the sender; the main controller card is the sender or the receiver; The total number of entries in the block table is set to satisfy: Before the receiving end finishes reading the current table entry data, the sending end will not write data to the current table entry; the total number of table entries in the block table is calculated as follows: WTime*(N-1)>RTime Wherein, N is the total number of table entries, WTime is the time for the sender to write a table entry, and RTime is the time for the receiver to read a table entry.
9. A daughter card, characterized in that: The daughter card is connected to the main controller card via a backplane bus, and the daughter card accesses the dual-port memory via a block table communication mechanism, wherein the block table communication mechanism includes: The table entry is used as the basic unit of data reading and writing operations; the block table adopts a circular overwrite mechanism to write data, and the write pointer always points to the table entry index value of the latest write operation completed by the sender; the subcard is a sender or a receiver; The total number of entries in the block table is set to satisfy: Before the receiving end finishes reading the current table entry data, the sending end will not write data to the current table entry; the total number of table entries in the block table is calculated as follows: WTime*(N-1)>RTime Wherein, N is the total number of table entries, WTime is the time for the sender to write a table entry, and RTime is the time for the receiver to read a table entry.
