CN116915368B - Encoding and decoding method and device for data stream conforming to futures transaction data exchange protocol - Google Patents

Encoding and decoding method and device for data stream conforming to futures transaction data exchange protocol Download PDF

Info

Publication number
CN116915368B
CN116915368B CN202311187059.1A CN202311187059A CN116915368B CN 116915368 B CN116915368 B CN 116915368B CN 202311187059 A CN202311187059 A CN 202311187059A CN 116915368 B CN116915368 B CN 116915368B
Authority
CN
China
Prior art keywords
data
category
byte
target
encoding
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
Application number
CN202311187059.1A
Other languages
Chinese (zh)
Other versions
CN116915368A (en
Inventor
郭国峰
崔书龙
祝磊
王梅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Huayun Information System Technology Co ltd
Original Assignee
Shenzhen Huayun Information System Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shenzhen Huayun Information System Technology Co ltd filed Critical Shenzhen Huayun Information System Technology Co ltd
Priority to CN202311187059.1A priority Critical patent/CN116915368B/en
Publication of CN116915368A publication Critical patent/CN116915368A/en
Application granted granted Critical
Publication of CN116915368B publication Critical patent/CN116915368B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0015Systems modifying transmission characteristics according to link quality, e.g. power backoff characterised by the adaptation strategy
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0033Systems modifying transmission characteristics according to link quality, e.g. power backoff arrangements specific to the transmitter
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0036Systems modifying transmission characteristics according to link quality, e.g. power backoff arrangements specific to the receiver
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/26Special purpose or proprietary protocols or architectures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The embodiment of the application relates to a coding and decoding method, a device, electronic equipment and a storage medium of a data stream conforming to a futures trade data exchange protocol, wherein the coding method of the data stream conforming to the futures trade data exchange protocol comprises the following steps: acquiring a target data stream; the target data stream is scattered and divided into byte data, and a first byte data sequence is obtained; determining a data category of byte data in the first byte data sequence; adopting a first coding algorithm to code byte data belonging to the first category to obtain a first code; adopting a second coding algorithm to code byte data belonging to the second category to obtain a second code, wherein the first coding algorithm and the second coding algorithm are executed in parallel; based on the first encoding and the second encoding, encoded data of the target data stream is generated. Thus, the coding efficiency of the data conforming to the futures trade data exchange protocol can be improved.

Description

Encoding and decoding method and device for data stream conforming to futures transaction data exchange protocol
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for encoding and decoding a data stream according to a futures transaction data exchange protocol, an electronic device, and a storage medium.
Background
FTD (Futures Trading Data Exchange Protocol, futures exchange data exchange protocol), which is a basic protocol for exchange of exchange information between exchanges and brokerage firms, was developed to provide better service to members and investors in remote exchanges to ensure safe, reliable and stable operation of remote exchanges, to improve production efficiency, and to improve the level of futures technical systems and computer applications.
The FTD message consists of a header, an extended header and an information body. Header describes the overall information of the data packet; the extended header provides link management functions; the FTD message content is the content of specific individual domains.
In the prior art, the encoding and decoding process of the FTD data is realized by adopting a C language and is processed by single byte 8 bits, if the bit width of a data bus is 16 bits, 32 bits, 64 bits, 128 bits, 256 bits and the like, the encoding and decoding efficiency can be reduced by times along with the double expansion of the bit width.
It can be seen that how to improve the encoding and/or decoding efficiency of data conforming to the futures trade data exchange protocol (FTD) is a technical problem of concern.
Disclosure of Invention
In view of this, in order to solve some or all of the above technical problems, embodiments of the present application provide a method, an apparatus, an electronic device, and a storage medium for encoding and decoding a data stream according with a futures transaction data exchange protocol.
In a first aspect, an embodiment of the present application provides a method for encoding a data stream conforming to a futures trade data exchange protocol, the method including:
obtaining a target data stream, wherein the target data stream accords with the futures transaction data exchange protocol;
the target data stream is scattered and divided into byte data, and a first byte data sequence is obtained;
determining a data category of byte data in the first byte data sequence, wherein the data category comprises a first category and a second category;
adopting a first coding algorithm to code byte data belonging to the first category to obtain a first code;
adopting a second coding algorithm to code byte data belonging to the second category to obtain a second code, wherein the first coding algorithm and the second coding algorithm are executed in parallel;
based on the first encoding and the second encoding, encoded data of the target data stream is generated.
In one possible embodiment, the data category further includes a third category; and
before the generating of the encoded data of the target data stream based on the first encoding and the second encoding, the method further comprises:
adopting a third coding algorithm to code byte data belonging to the third category to obtain a third code, wherein the first coding algorithm, the second coding algorithm and the third coding algorithm are executed in parallel; and
the generating encoded data of the target data stream based on the first encoding and the second encoding includes:
encoded data of the target data stream is generated based on the first encoding, the second encoding, and the third encoding.
In one possible implementation manner, the generating the encoded data of the target data stream based on the first encoding, the second encoding and the third encoding includes:
aligning the first code, the second code and the third code according to the coding time of byte data to obtain an alignment result;
and generating the coded data of the target data stream based on the alignment result.
In one possible embodiment, the first class represents byte data of 00, the second class represents byte data of greater than or equal to e0 and less than or equal to ef, the third class represents byte data of a class other than the first class and the second class, the first code is 1 byte in length, the second code is 2 bytes in length, and the third code is 1 byte in length; the alignment result includes first data corresponding to the first code, second data corresponding to the second code, and third data corresponding to the third code; in the case that there is no first code corresponding to the target coding time, using 00 to represent the first data corresponding to the target coding time; in the case where there is no second code corresponding to the target code time, the second data corresponding to the target code time is represented by 0000; in the case that there is no third code corresponding to the target coding time, representing the third data corresponding to the target coding time by 00; and
The generating the encoded data of the target data stream based on the alignment result includes:
performing bit OR operation on the first data, the second data and the third data to obtain an operation result;
and generating the coded data of the target data stream based on the operation result.
In one possible implementation manner, the generating the encoded data of the target data stream based on the operation result includes:
splicing the obtained operation results to obtain a spliced result;
and generating the coded data of the target data stream based on the splicing result.
In one possible implementation manner, the generating the encoded data of the target data stream based on the splicing result includes:
and extracting effective data from the splicing result to obtain the coded data of the target data stream.
In one possible embodiment, the target data stream includes first unit data and second unit data, the first unit data and the second unit data are adjacent in position in the target data stream, and the first unit data is located before the second unit data, the last byte data of the first unit data is 00, and the first byte data of the second unit data is 00; and
The step of scattering and splitting the target data stream into byte data to obtain a first byte data sequence includes:
the first unit data are scattered and divided into byte data, and a first byte data sequence corresponding to the first unit data is obtained;
the second unit data are scattered and split into byte data, and a first byte data sequence corresponding to the second unit data is obtained; and
the step of encoding the byte data belonging to the first category by adopting a first encoding algorithm to obtain a first encoding, comprising:
determining whether a preset number of adjacent byte data belonging to the first category exist in a first byte data sequence corresponding to the first unit data;
and under the condition that the preset number of adjacent byte data belonging to the first category exists in the first byte data sequence, adopting the first coding algorithm to code the first byte data sequence corresponding to the first unit data and the byte data belonging to the first category in the first byte data sequence corresponding to the second unit data, so as to obtain a first code.
In a second aspect, an embodiment of the present application provides a method for decoding a data stream conforming to a futures trade data exchange protocol, the method including:
Obtaining target coded data, wherein the target coded data is obtained by coding data conforming to the futures transaction data exchange protocol;
the target coding data are scattered and divided into byte data, and a second byte data sequence is obtained;
determining a data class of the byte data in the second byte data sequence, wherein the data class comprises a fourth class and a fifth class, the fourth class corresponds to the first class, and the fifth class corresponds to the second class;
adopting a first decoding algorithm to decode byte data belonging to the fourth category to obtain fourth data;
adopting a second decoding algorithm to decode byte data belonging to the fifth category to obtain fifth data, wherein the first decoding algorithm and the second decoding algorithm are executed in parallel, the first decoding algorithm is the inverse operation of a first encoding algorithm, and the second decoding algorithm is the inverse operation of a second encoding algorithm;
and generating decoding data of the target encoding data based on the fourth data and the fifth data.
In a third aspect, embodiments of the present application provide an encoding apparatus for a data stream conforming to a futures trade data exchange protocol, the apparatus comprising:
In a fourth aspect, embodiments of the present application provide a decoding apparatus for a data stream conforming to a futures trade data exchange protocol, the apparatus comprising:
a second obtaining unit, configured to obtain target encoded data, where the target encoded data is obtained by encoding data that conforms to the futures transaction data exchange protocol;
the second shunt unit is used for scattering and shunting the target coded data into byte data to obtain a second byte data sequence;
a second determining unit, configured to determine, for byte data in the second byte data sequence, a data class of the byte data, where the data class includes a fourth class and a fifth class, the fourth class corresponds to the first class, and the fifth class corresponds to the second class;
the first decoding unit is used for decoding byte data belonging to the fourth category by adopting a first decoding algorithm to obtain fourth data;
the second decoding unit is used for decoding byte data belonging to the fifth category by adopting a second decoding algorithm to obtain fifth data, wherein the first decoding algorithm and the second decoding algorithm are executed in parallel, the first decoding algorithm is the inverse operation of the first encoding algorithm, and the second decoding algorithm is the inverse operation of the second encoding algorithm;
And a second generation unit configured to generate decoded data of the target encoded data based on the fourth data and the fifth data.
In a fifth aspect, an embodiment of the present application provides an FPGA, where the FPGA is configured to implement the method of any one of the encoding method of the data stream conforming to the futures trade data exchange protocol of the first aspect or the decoding method of the data stream conforming to the futures trade data exchange protocol of the second aspect.
In a sixth aspect, an embodiment of the present application provides an electronic device, including:
a memory for storing a computer program;
a processor, configured to execute a computer program stored in the memory, where the computer program is executed to implement a method according to any embodiment of the encoding method of a data stream according to a futures trade data exchange protocol of the first aspect or the decoding method of a data stream according to a futures trade data exchange protocol of the second aspect of the present application.
In a seventh aspect, embodiments of the present application provide a computer readable storage medium, on which a computer program is stored, where the computer program is executed by a processor, to implement a method according to any embodiment of the encoding method of a data stream according to a futures trade data exchange protocol of the first aspect or the decoding method of a data stream according to a futures trade data exchange protocol of the second aspect.
In an eighth aspect, embodiments of the present application provide a computer program comprising computer readable code which, when run on a device, causes a processor in the device to implement a method according to any one of the embodiments of the encoding method of a data stream conforming to a futures trade data exchange protocol of the first aspect or the decoding method of a data stream conforming to a futures trade data exchange protocol of the second aspect described above.
According to the method for encoding the data stream according to the futures transaction data exchange protocol, the target data stream can be obtained, wherein the target data stream accords with the futures transaction data exchange protocol so as to carry out encoding processing on the target data stream, then the target data stream is scattered and divided into byte data to obtain a first byte data sequence so as to obtain a plurality of byte data, then the byte data in the first byte data sequence is determined, the data category comprises a first category and a second category so as to classify the scattered and divided byte data, then a first encoding algorithm is adopted to encode the byte data belonging to the first category so as to obtain a first encoding, and a second encoding algorithm is adopted to encode the byte data belonging to the second category so as to obtain a second encoding, wherein the first encoding algorithm and the second encoding algorithm are executed in parallel so as to process the byte data of different data categories in a parallel mode, and finally the encoding algorithm is executed on the basis of the first encoding algorithm and the second encoding algorithm so as to generate encoding algorithm of the target data, and the encoding result is obtained by combining the encoding algorithm of the two types of the data. Therefore, the encoding of byte data of different categories can be realized by executing at least two different encoding algorithms in parallel, and the encoding efficiency of data conforming to futures transaction data exchange protocols is further improved.
According to the decoding method of the data stream conforming to the futures transaction data exchange protocol, target coded data can be obtained, wherein the target coded data is obtained by coding data conforming to the futures transaction data exchange protocol, so that the coded target coded data is decoded later, then the target coded data is scattered and divided into byte data to obtain a second byte data sequence, so that a plurality of byte data are obtained, then the byte data in the second byte data sequence is aimed at, the data category of the byte data is determined, the data category comprises a fourth category and a fifth category, the fourth category corresponds to the first category, the fifth category corresponds to the second category, so that the byte data obtained by scattering and dividing are classified, then a first decoding algorithm is adopted, the byte data belonging to the fourth category is decoded, so that fourth data is obtained, a second decoding algorithm is adopted, the byte data belonging to the fifth category is decoded, so that fifth data is obtained, the first decoding algorithm and the second decoding algorithm are adopted, the second decoding algorithm is not adopted, the second algorithm is adopted, and the decoding algorithm is adopted, the second algorithm is adopted, the parallel is adopted, the decoding algorithm is adopted, the second algorithm is adopted, and the decoding algorithm is not adopted, the second algorithm is adopted, and the parallel, the decoding algorithm is adopted, the second algorithm is adopted, and the decoding algorithm is the data is obtained, and the parallel, the decoding algorithm is obtained, and the data is obtained, and the decoding algorithm is the second algorithm, and the data is obtained. Therefore, decoding of byte data of different categories can be realized by executing at least two different decoding algorithms in parallel, and further decoding efficiency of data conforming to futures transaction data exchange protocols is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements, and in which the figures of the drawings are not to be taken in a limiting sense, unless otherwise indicated.
Fig. 1 is a flow chart of a coding method of a data flow according to a futures trade data exchange protocol according to an embodiment of the present application;
fig. 2 is a flow chart of a decoding method of a data flow according to a futures transaction data exchange protocol according to an embodiment of the present application;
Fig. 3A is a timing diagram of an input interface of a continuous data flow of a method for encoding and decoding a data flow according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3B is an input interface timing diagram of a discontinuous data flow according to a coding and decoding method of a data flow of a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3C is a schematic flow chart of a coding method of a continuous data flow according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3D is a schematic flow chart of a coding method of a discontinuous data stream according to a futures transaction data exchange protocol according to an embodiment of the present application;
FIG. 3E is a schematic diagram of a bitwise OR implementation for FIG. 3C or FIG. 3D;
fig. 3F is a schematic structural diagram of a data flow involved in a method for encoding and decoding a data flow according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3G is a schematic diagram of a continuous "00" coding control state machine involved in a coding method of a data stream according to a futures trade data exchange protocol according to an embodiment of the present application;
fig. 3H is a schematic diagram of an FPGA encoding process flow involved in a method for encoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application;
Fig. 3I is a schematic diagram of a reorganization process involved in a method for encoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3J is a flow chart of another decoding method of a data flow according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3K is a schematic diagram of a continuous "0xef" extension "0x00" involved in a decoding method of a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3L is a schematic diagram of an FPGA decoding process flow involved in a decoding method of a data flow according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3M is a flow chart of parallel domain data processing involved in a method for encoding and decoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3N is a schematic diagram of a parallel processing state machine involved in a method for encoding and decoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3O is a schematic diagram of an input interface and an output interface involved in a method for encoding and decoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application;
Fig. 3P is a schematic flow chart of a reorganization process involved in a method for encoding and decoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3Q is a schematic diagram of removing invalid bit data in a data stream related to a method for encoding and decoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3R is a schematic diagram of a 32bit data stream splicing simulation involved in a method for encoding and decoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 3S is a schematic diagram of 256bit data stream splicing involved in a method for encoding and decoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 4A is a schematic structural diagram of an encoding device for data flow according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 4B is a schematic structural diagram of a decoding device for a data flow according to a futures transaction data exchange protocol according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings, it being apparent that the described embodiments are some, but not all embodiments of the present application. It should be noted that: the relative arrangement of the parts and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present application unless it is specifically stated otherwise.
It will be appreciated by those skilled in the art that terms such as "first," "second," and the like in the embodiments of the present application are used merely to distinguish between different steps, devices, or modules, and do not represent any particular technical meaning or logical sequence therebetween.
It should also be understood that in this embodiment, "plurality" may refer to two or more, and "at least one" may refer to one, two or more.
It should also be appreciated that any component, data, or structure referred to in the embodiments of the present application may be generally understood as one or more without explicit limitation or the contrary in the context.
In addition, the term "and/or" in this application is merely an association relationship describing an association object, and indicates that three relationships may exist, for example, a and/or B may indicate: a exists alone, A and B exist together, and B exists alone. In this application, the character "/" generally indicates that the associated object is an or relationship.
It should also be understood that the description of the embodiments herein emphasizes the differences between the embodiments, and that the same or similar features may be referred to each other, and for brevity, will not be described in detail.
The following description of at least one exemplary embodiment is merely exemplary in nature and is in no way intended to limit the application, its application, or uses.
Techniques, methods, and apparatus known to one of ordinary skill in the relevant art may not be discussed in detail, but are intended to be part of the specification where appropriate.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further discussion thereof is necessary in subsequent figures.
It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other. For an understanding of the embodiments of the present application, the present application will be described in detail below with reference to the drawings in conjunction with the embodiments. It will be apparent that the embodiments described are some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
In order to solve the technical problem of how to improve coding and/or decoding efficiency in the prior art, the application provides a coding method of a data stream conforming to a futures trade data exchange protocol, which can improve the coding efficiency of data conforming to the futures trade data exchange protocol; in addition, the application also provides a decoding method of the data stream conforming to the futures trade data exchange protocol, which can improve the decoding efficiency of the data conforming to the futures trade data exchange protocol.
Fig. 1 is a flow chart of a coding method of a data flow according to a futures trade data exchange protocol according to an embodiment of the present application. The method can be applied to one or more electronic devices or electronic devices such as an FPGA (Field Programmable Gate Array ), a smart phone, a notebook computer, a desktop computer, a portable computer, a server and the like. The main execution body of the method may be hardware or software. When the execution body is hardware, the execution body may be one or more of the electronic device or the electronic apparatus. For example, a single electronic device may perform the method, or a plurality of electronic devices may cooperate with one another to perform the method. When the execution subject is software, the method may be implemented as a plurality of software or software modules, or may be implemented as a single software or software module. The present invention is not particularly limited herein.
As shown in fig. 1, the method specifically includes:
step 101, obtaining a target data stream, wherein the target data stream accords with the futures transaction data exchange protocol.
In this embodiment, the target data stream may be data conforming to the futures trade data exchange protocol. Here, the target data stream may be a data stream to be encoded.
Here, the bit width of the target data stream may be 128 bits, 256 bits, or the like, which is not limited in this embodiment.
The target data stream may be a continuous data stream or a discontinuous data stream.
Wherein a high-low level can be used to determine whether the data stream belongs to a continuous data stream. For example, during data reception, if it is a continuous high level, it may be determined that the received data is a continuous data stream; conversely, if during data reception there is a low level, then the received data may be determined to be a discontinuous data stream.
Step 102, breaking up and splitting the target data stream into byte data to obtain a first byte data sequence.
In this embodiment, each byte data may be data having a bit width of 1byte (byte), that is, 8 bits.
The first byte data sequence may be composed of each byte data obtained after the target data stream is broken up and split into byte data. Here, the position of each byte data in the first byte data sequence may coincide with its position in the target data stream.
As an example, if the target data stream includes "B0B 1B 2B 3B 4B 5B 6B 7B 8B 9B 10B 11B 12B 13B 14B 15", after the target data stream is split, each byte data in the obtained first byte data sequence may be: b0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15.
Step 103, determining a data category of the byte data in the first byte data sequence, wherein the data category comprises a first category and a second category.
In this embodiment, the data type may be a type of byte data.
The first category and the second category may be two different categories.
Here, the first category and the second category may be determined in a variety of ways.
As an example, a first category may represent byte data as 00 and a second category may represent byte data as non-00.
As yet another example, a first category may indicate that the byte data is greater than or equal to e0 and less than or equal to ef, and a second category may indicate that the byte data is less than e0 or greater than ef.
Step 104, adopting a first coding algorithm to code the byte data belonging to the first category to obtain a first code.
In this embodiment, the first encoding algorithm may be an algorithm for encoding the first type of byte data. For example, the first encoding algorithm may correspond to the first class.
The first encoding may be a result of encoding byte data belonging to the first category using a first encoding algorithm.
For example, in the case where the first category indicates that the byte data is 00, the first encoding algorithm may be used to count the number of 00.
For another example, where the first category indicates that the byte data is greater than or equal to e0 and less than or equal to ef, the first encoding algorithm may indicate: e0 is appended before the byte data and the byte data assignment is pulled down. For example, if the byte data belonging to the first category is "ec", the first code may be "e0ec".
For another example, in the first category: in the case where the byte data is less than e0 or greater than ef, and the byte data is not "00", the first encoding algorithm may represent: the byte data is directly pulled down to a value. For example, if the byte data belonging to the first category is "08", the first code may be "08".
And 105, encoding the byte data belonging to the second category by adopting a second encoding algorithm to obtain a second encoding, wherein the first encoding algorithm and the second encoding algorithm are executed in parallel.
In this embodiment, the second encoding algorithm may be an algorithm for encoding the second type of byte data. For example, the second encoding algorithm may correspond to a second class.
The second encoding may be a result of encoding byte data belonging to the second category using a second encoding algorithm.
For example, in the case where the second class indicates that the byte data is 00, the second encoding algorithm may be used to count the number of 00.
For another example, in the case where the second class indicates that the byte data is greater than or equal to e0 and less than or equal to ef, the second encoding algorithm may indicate that: e0 is appended before the byte data and the byte data assignment is pulled down. For example, if the byte data belonging to the second category is "ec", the second code may be "e0ec".
For another example, in the second category: in the case where the byte data is less than e0 or greater than ef, and the byte data is not "00", the second encoding algorithm may represent: the byte data is directly pulled down to a value. For example, if the byte data belonging to the second category is "08", the second code may be "08".
In addition, if the ratio of the number of byte data belonging to the second category to the number of byte data belonging to the first category in the first byte data sequence corresponding to the target data stream obtained within the target time period (for example, the preset time period) is greater than or equal to a preset threshold (for example, 1.5), then a second encoding algorithm may be further employed to encode the byte data belonging to the second category. That is, in this case, three parallel lines may be included, where one line adopts a first encoding algorithm to encode byte data belonging to the first class, and the other two lines respectively adopt a second encoding algorithm to encode byte data belonging to the second class (i.e., two second encoding algorithms and a first encoding algorithm are executed in parallel).
In some cases, the number N1 of parallel lines performing the first encoding algorithm, the number N2 of byte data belonging to the first category in the first byte data sequence corresponding to the target data stream obtained in the target period (for example, the preset period), the number N3 of parallel lines performing the second encoding algorithm, and the number N4 of byte data belonging to the second category in the first byte data sequence corresponding to the target data stream obtained in the target period (for example, the preset period) may have the following relationship: n2++n1=a x N4N 3.
Wherein a represents a ratio of an execution efficiency of the first encoding algorithm to an execution efficiency of the second encoding algorithm. The execution efficiency of the first encoding algorithm may represent a speed at which the first encoding algorithm encodes character data belonging to the first category. The execution efficiency of the second encoding algorithm may represent a speed at which the second encoding algorithm encodes character data belonging to the second category.
And 106, generating the coded data of the target data stream based on the first code and the second code.
In this embodiment, the relative positions of the first code and the second code may be determined according to the generation times of the first code and the second code, thereby obtaining the encoded data of the target data stream.
In some optional implementations of this embodiment, the data category further includes a third category.
On this basis, a third encoding algorithm may be further used to encode the byte data belonging to the third category to obtain a third encoding before performing the above step 106.
Wherein the first encoding algorithm, the second encoding algorithm, and the third encoding algorithm are executed in parallel.
The third encoding algorithm may be an algorithm for encoding byte data of a third type. For example, the third encoding algorithm may correspond to a third category.
The third encoding may be a result of encoding byte data belonging to the third category using a third encoding algorithm.
For example, in the case where the third class indicates that the byte data is 00, a third encoding algorithm may be used to count the number of 00.
For another example, in the case where the third category indicates that the byte data is greater than or equal to e0 and less than or equal to ef, the third encoding algorithm may indicate: e0 is appended before the byte data and the byte data assignment is pulled down. For example, if the byte data belonging to the third category is "ec", the third code may be "e0ec".
For another example, in a third category: in the case where the byte data is less than e0 or greater than ef, and the byte data is not "00", the third encoding algorithm may represent: the byte data is directly pulled down to a value. For example, if the byte data belonging to the third category is "08", the third code may be "08".
Further, on this basis, encoded data of the target data stream may be generated based on the first encoding and the second encoding in the following manner:
encoded data of the target data stream is generated based on the first encoding, the second encoding, and the third encoding.
Here, the relative positions of the first code, the second code, and the third code may be determined according to the generation times of the first code, the second code, and the third code, thereby obtaining the encoded data of the target data stream.
It can be appreciated that in the above alternative implementation manner, the encoding of the byte data of different types can be implemented by executing three different encoding algorithms in parallel, so as to improve the encoding efficiency of the data conforming to the futures trade data exchange protocol.
Further, if the ratio of the number of the byte data belonging to the second category to the number of the byte data belonging to the first category is greater than or equal to a preset threshold (e.g., 1.5) in the first byte data sequence corresponding to the target data stream obtained in the target period (e.g., preset period), and the ratio of the number of the byte data belonging to the second category to the number of the byte data belonging to the third category is greater than or equal to a preset threshold (e.g., 1.5) in the first byte data sequence corresponding to the target data stream obtained in the target period (e.g., preset period), the second encoding algorithm may be further employed to encode the byte data belonging to the second category. That is, in this case, four parallel lines may be included, where one line adopts a first encoding algorithm to encode the byte data belonging to the first class, the other line adopts a third encoding algorithm to encode the byte data belonging to the third class, and the other two lines respectively adopt second encoding algorithms to encode the byte data belonging to the second class (that is, two second encoding algorithms are executed in parallel with a first encoding algorithm and a third encoding algorithm).
In some cases, the number N1 of parallel lines performing the first encoding algorithm, the number N2 of byte data belonging to the first category in the first byte data sequence corresponding to the target data stream obtained in the target period (e.g., the preset period), the number N3 of parallel lines performing the second encoding algorithm, the number N4 of byte data belonging to the second category in the first byte data sequence corresponding to the target data stream obtained in the target period (e.g., the preset period), the number N5 of parallel lines performing the third encoding algorithm, and the number N6 of byte data belonging to the third category in the first byte data sequence corresponding to the target data stream obtained in the target period (e.g., the preset period) may have the following relationship: n2++n1= AXN4/A n3=b×n6++n5.
Wherein a represents a ratio of an execution efficiency of the first encoding algorithm to an execution efficiency of the second encoding algorithm. The execution efficiency of the first encoding algorithm may represent a speed at which the first encoding algorithm encodes character data belonging to the first category. The execution efficiency of the second encoding algorithm may represent a speed at which the second encoding algorithm encodes character data belonging to the second category. B represents the ratio of the execution efficiency of the first encoding algorithm to the execution efficiency of the third encoding algorithm. The execution efficiency of the first encoding algorithm may represent a speed at which the first encoding algorithm encodes character data belonging to the first category. The execution efficiency of the third encoding algorithm may represent a speed at which the third encoding algorithm encodes character data belonging to the third category.
In some application scenarios in the above alternative implementations, the method may further include generating encoded data of the target data stream based on the first encoding, the second encoding, and the third encoding in the following manner:
the first step, aligning the first code, the second code and the third code according to the code time of byte data to obtain an alignment result.
The alignment result may include the first code, the second code, the third code, and the code time information of the three codes.
And a second step of generating the coded data of the target data stream based on the alignment result.
As an example, the first code, the second code, and the third code in the alignment result may be arranged according to the sequence of the code times, so as to generate the code data of the target data stream.
In addition, the second step may be performed in other manners, which will be described later herein for brevity.
It can be appreciated that in the above application scenario, the encoded data of the target data stream may be generated by encoding time, first encoding, second encoding, and third encoding of byte data.
In some cases of the above application scenario, the first class indicates that the byte data is 00. The second class indicates that byte data is greater than or equal to e0 and less than or equal to ef. The third category represents that byte data is a category other than the first category and the second category. The first code has a length of 1 byte. The length of the second code is 2 bytes, and the length of the third code is 1 byte. The alignment result includes first data corresponding to the first code, second data corresponding to the second code, and third data corresponding to the third code. In the case where there is no first code corresponding to the target code time, the first data corresponding to the target code time is represented by 00. In the case where there is no second code corresponding to the target code time, 0000 is used to represent the second data corresponding to the target code time. In the case where there is no third code corresponding to the target code time, the third data corresponding to the target code time is represented by 00.
The target encoding time may be any encoding time. For example, the encoding time of each byte data in the first byte data sequence may be sequentially set as the target encoding time.
Here, since each byte data can only belong to one of the above-described first category, second category, and third category, for two categories to which the byte data does not belong, if the first category is included in the two categories (i.e., the byte data does not belong to the first category), the first data corresponding to the first encoding of the byte data is represented by 00; if the two categories include a third category (i.e., the byte data does not belong to the third category), then using 00 to represent third data corresponding to a third encoding of the byte data; the two categories include a second category (i.e., the byte data does not belong to the second category), then 0000 is used to represent the second data corresponding to the second encoding of the byte data. Furthermore, for the category to which the byte belongs, if the category is a first category (i.e., the byte data belongs to the first category), then the first data corresponding to the first encoding of the byte data may be the first encoding of the byte data; if the class is a second class (i.e., the byte data belongs to a second class), then the second data corresponding to the second encoding of the byte data may be the second encoding of the byte data; if the category is a third category (i.e., the byte data belongs to a third category), then the third data corresponding to the third encoding of the byte data may be the third encoding of the byte data.
On this basis, the following manner may be adopted to generate the encoded data of the target data stream based on the alignment result:
firstly, performing bit OR operation on the first data, the second data and the third data to obtain an operation result.
The operation result may be a result obtained by performing a bitwise or operation on the first data, the second data, and the third data.
And then, based on the operation result, generating the coded data of the target data stream.
As an example, the valid data in the operation result may be first taken as encoded data of the target data stream.
Wherein, whether the data in the operation result is valid data can be determined by the indication signal.
In addition, other manners may be adopted to generate the encoded data of the target data stream based on the operation result, and the description is omitted herein for brevity.
It will be appreciated that in the above case, the encoded data of the target data stream may be obtained by bitwise or operations.
In some examples of the above cases, the encoded data of the target data stream may be generated based on the operation result in the following manner:
Firstly, splicing the obtained operation results to obtain a spliced result.
The splicing result may represent a result obtained by splicing the obtained operation results.
And then, based on the splicing result, generating the coded data of the target data stream.
As an example, the splice result may be directly used as encoded data of the target data stream.
In addition, other manners may be adopted to generate the encoded data of the target data stream based on the splicing result, and the detailed description is omitted herein.
It will be appreciated that in the above example, the encoded data of the target data stream may be obtained based on the splice result.
In some of the above examples, the following manner may be further adopted to generate the encoded data of the target data stream based on the splicing result:
and extracting effective data from the splicing result to obtain the coded data of the target data stream.
As an example, the valid data in the splicing result may be immediately adjacent first, for example, the valid data in the splicing result may be placed at a start position or an end position of the intermediate data, and then, invalid bytes in the intermediate data are emptied, thereby obtaining encoded data of the target data stream.
Here, whether the data in the splicing result is valid data may be determined by the indication flag, so that the valid data in the splicing result is extracted, and the extracted valid data is used as encoded data of the target data stream.
It can be appreciated that in the above scheme, the effective data may be extracted from the splicing result, so as to obtain the encoded data of the target data stream.
In some alternative implementations of the present embodiment, the target data stream includes first unit data and second unit data. The first unit data and the second unit data are adjacent in position in the target data stream, and the first unit data is located before the second unit data, the last byte data of the first unit data is 00, and the first byte data of the second unit data is 00.
On this basis, the target data stream can be broken up and split into byte data to obtain a first byte data sequence in the following manner:
and the first step is to scatter and split the first unit data into byte data to obtain a first byte data sequence corresponding to the first unit data.
The first byte data sequence corresponding to the first unit data may be composed of each byte data obtained after the first unit data is broken up and split into the byte data. Here, the position of each byte data in the first byte data sequence corresponding to the first unit data may coincide with its position in the first unit data.
And secondly, scattering and splitting the second unit data into byte data to obtain a first byte data sequence corresponding to the second unit data.
The first byte data sequence corresponding to the second unit data may be composed of each byte data obtained after the second unit data is broken up and split into byte data. Here, the position of each byte data in the first byte data sequence corresponding to the second unit data in the second byte data sequence may coincide with the position thereof in the second unit data.
Further, on this basis, the byte data belonging to the first category may be encoded by using a first encoding algorithm, resulting in a first encoding:
firstly, determining whether a preset number of adjacent byte data belonging to the first category exists in a first byte data sequence corresponding to the first unit data.
As an example, since the maximum value of 1 byte of data is ff, the above-mentioned preset number may be 15.
And then, under the condition that the preset number of adjacent byte data belonging to the first category exists in the first byte data sequence, adopting the first coding algorithm to code the first byte data sequence corresponding to the first unit data and the byte data belonging to the first category in the first byte data sequence corresponding to the second unit data, so as to obtain a first code.
Wherein the first category may represent byte data of 00.
It can be understood that according to the CTP (Comprehensive Transaction Platform) coding principle, when the input/output data processing bit width of the coding module is 128 bits, that is, 16 bytes, if all consecutive 15 bytes are "00", the 00 distribution condition decision processing of two consecutive adjacent 128bit data needs to be combined, so that the data needs to be registered in the next 128 bits to form new data.
According to the method for encoding the data stream according to the futures transaction data exchange protocol, the target data stream can be obtained, wherein the target data stream accords with the futures transaction data exchange protocol so as to carry out encoding processing on the target data stream, then the target data stream is scattered and divided into byte data to obtain a first byte data sequence so as to obtain a plurality of byte data, then the byte data in the first byte data sequence is determined, the data category comprises a first category and a second category so as to classify the scattered and divided byte data, then a first encoding algorithm is adopted to encode the byte data belonging to the first category so as to obtain a first encoding, and a second encoding algorithm is adopted to encode the byte data belonging to the second category so as to obtain a second encoding, wherein the first encoding algorithm and the second encoding algorithm are executed in parallel so as to process the byte data of different data categories in a parallel mode, and finally the encoding algorithm is executed on the basis of the first encoding algorithm and the second encoding algorithm so as to generate encoding algorithm of the target data, and the encoding result is obtained by combining the encoding algorithm of the two types of the data. Thus, the coding efficiency of the data conforming to the futures trade data exchange protocol can be improved.
Fig. 2 is a flow chart of a decoding method of a data flow according to a futures trade data exchange protocol according to an embodiment of the present application. As shown in fig. 2, the method specifically includes:
step 201, obtaining target encoded data, wherein the target encoded data is obtained by encoding data conforming to the futures trade data exchange protocol.
In this embodiment, the target encoded data may be obtained by encoding data according to the futures trade data exchange protocol by using the encoding method of the data stream according to the futures trade data exchange protocol. Or, the target coded data can also be obtained by coding the data conforming to the futures trade data exchange protocol in a serial coding mode by adopting a C language.
In this embodiment, for the encoding method of the data stream conforming to the futures trade data exchange protocol, please refer to the above description, and the description is omitted here.
Step 202, breaking up and splitting the target encoded data into byte data to obtain a second byte data sequence.
In this embodiment, each byte data may be data having a bit width of 1byte (byte), that is, 8 bits.
The second byte data sequence may be composed of individual byte data obtained after the target encoded data is broken up and split into byte data. Here, the position of each byte data in the second byte data sequence may coincide with its position in the target encoded data.
As an example, if the target encoded data includes "B0B 1B 2B 3B 4B 5B 6B 7B 8B 9B 10B 11B 12B 13B 14B 15", then after performing the break-up and stream, each byte data in the obtained second byte data sequence may be respectively: b0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15.
Step 203, determining a data class of the byte data in the second byte data sequence, wherein the data class comprises a fourth class and a fifth class.
In this embodiment, the data type may be a type of byte data.
The fourth category corresponds to the first category and the fifth category corresponds to the second category.
For the description of the first category and the second category, please refer to the above, and the description is omitted herein.
Here, the first category and the second category may be determined in a variety of ways.
As an example, the fourth category may be a category of data obtained by encoding byte data belonging to the first category (i.e., the above-described first encoding).
The fifth category may be a category of data obtained by encoding byte data belonging to the second category (i.e., the second encoding).
And 204, decoding byte data belonging to the fourth category by adopting a first decoding algorithm to obtain fourth data.
In this embodiment, the first decoding algorithm is an inverse operation of the first encoding algorithm.
The fourth data may be data obtained by decoding byte data belonging to the fourth category by using the first decoding algorithm.
And step 205, decoding the byte data belonging to the fifth category by adopting a second decoding algorithm to obtain fifth data, wherein the first decoding algorithm and the second decoding algorithm are executed in parallel.
In this embodiment, the fifth data may be data obtained by decoding byte data belonging to the fifth category using a second decoding algorithm.
The second decoding algorithm is the inverse of the second encoding algorithm.
Step 206, generating decoding data of the target coding data based on the fourth data and the fifth data.
In the present embodiment, the relative positions of the fourth data and the fifth data may be determined in accordance with the generation times of the fourth data encoding and the fifth data, thereby obtaining decoded data of the target encoded data.
In some optional implementations of this embodiment, the data category further includes a sixth category.
On this basis, a third decoding algorithm may be further used to decode the byte data belonging to the sixth category to obtain sixth data, before performing the above step 206.
Wherein the first decoding algorithm, the second decoding algorithm, and the third decoding algorithm are executed in parallel.
The third decoding algorithm may be an algorithm for decoding the byte data of the sixth type. For example, the third decoding algorithm may correspond to a sixth category.
The sixth data may be a result of decoding byte data belonging to the sixth category by using a third decoding algorithm.
Further, on this basis, decoded data of the target encoded data may be generated based on the fourth data, the fifth data, and the sixth data in the following manner:
decoding data of the target encoded data is generated based on the fourth data, the fifth data, and the sixth data.
Here, the relative positions of the fourth data, the fifth data, and the sixth data may be determined in accordance with the generation times (corresponding encoding times) of the fourth data, the fifth data, and the sixth data, thereby obtaining decoded data of the target encoded data.
In practice, the decoding method of the data stream conforming to the futures trade data exchange protocol may be the inverse operation of the encoding method of the data stream conforming to the futures trade data exchange protocol. The decoding method of the data stream according to the futures trade data exchange protocol described in the present embodiment is described below, and is not repeated here.
It should be noted that, in addition to the above descriptions, the present embodiment may further include the corresponding technical features described in the embodiment corresponding to fig. 1, so as to achieve the technical effects of the decoding method of the data stream conforming to the futures transaction data exchange protocol shown in fig. 1, and the detailed description is omitted herein for brevity.
According to the decoding method of the data stream conforming to the futures transaction data exchange protocol, target coded data can be obtained, wherein the target coded data is obtained by coding data conforming to the futures transaction data exchange protocol, so that the coded target coded data is decoded later, then the target coded data is scattered and divided into byte data to obtain a second byte data sequence, so that a plurality of byte data are obtained, then the byte data in the second byte data sequence is aimed at, the data category of the byte data is determined, the data category comprises a fourth category and a fifth category, the fourth category corresponds to the first category, the fifth category corresponds to the second category, so that the byte data obtained by scattering and dividing are classified, then a first decoding algorithm is adopted, the byte data belonging to the fourth category is decoded, so that fourth data is obtained, a second decoding algorithm is adopted, the byte data belonging to the fifth category is decoded, so that fifth data is obtained, the first decoding algorithm and the second decoding algorithm are adopted, the second decoding algorithm is not adopted, the second algorithm is adopted, and the decoding algorithm is adopted, the second algorithm is adopted, the parallel is adopted, the decoding algorithm is adopted, the second algorithm is adopted, and the decoding algorithm is not adopted, the second algorithm is adopted, and the parallel, the decoding algorithm is adopted, the second algorithm is adopted, and the decoding algorithm is the data is obtained, and the parallel, the decoding algorithm is obtained, and the data is obtained, and the decoding algorithm is the second algorithm, and the data is obtained. Thus, the decoding efficiency of the data conforming to the futures trade data exchange protocol can be improved.
The following exemplary description of the embodiments of the present application is provided, but it should be noted that the embodiments of the present application may have the features described below, and the following description should not be construed as limiting the scope of the embodiments of the present application.
The existing FTD coding and decoding related implementation is a C language coding scheme, single byte 8bit processing is adopted, if the bit width of a data bus is 16bit, 32bit, 64bit, 128bit and 256bit; as the bit width is multiplied by the bit expansion, the coding efficiency is reduced by a multiple.
The method can solve the problem of greatly reduced coding efficiency caused by bit width expansion; the method can realize the maintenance of the coding efficiency on the premise that the hardware resources are enough no matter how wide the bit is.
The method will be described with reference to fig. 3A to 3S:
ftd coding
1.1.1. Interface design
In the method, as shown in fig. 3A, fig. 3A shows an input interface timing diagram of a continuous data stream of a codec method of a data stream conforming to a futures transaction data exchange protocol; as shown in fig. 3B, fig. 3B shows an input interface timing diagram of a discontinuous data stream of a method for encoding and decoding a data stream conforming to a futures trade data exchange protocol. Here, the encoding module MSG input bit width may be 64bit,8 bytes; the MSG output bit width of the encoding module may be 256 bits, 32 bytes.
Here, whether or not it is continuous data can be judged by the high and low level between sop and eop.
The sop and eop are packet headers, packet tail indication signals, and the data_vld is a data valid indication signal.
1.1.2FTD coding-FPGA implementation flow:
for continuous data, please refer to fig. 3C for the process flow; for discontinuous data, the process flow is shown in fig. 3D.
In fig. 3C and 3D, the encoding process of a 128-bit data stream (i.e., the target data stream) is described as an example.
First, 128bit data streams (including continuous data streams and discontinuous data streams) can be split and divided to obtain 16 paths of data. For example, the data stream "B0B 1B 2B 3B 4B 5B 6B 7B 8B 9B 10B 11B 12B 13B 14B 15" with the structure shown in fig. 3F may be split into: b0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15. Then, each path of data is processed by adopting one coding algorithm of statistics of "00" (namely the first coding algorithm), e0ex bit expansion (namely the second coding algorithm) and no coding (namely the third coding algorithm). For example, each path of data may be bit-wise or processed according to the implementation manner shown in fig. 3E, so as to obtain 16 paths of data in the illustration (i.e., 16 rows of data corresponding to three paths of reorganization bit-wise or one column in the illustration). The alignment result corresponding to each path of data comprises first data, second data and third data. For example, for the 0 th path data, the corresponding alignment result includes the first data "02", the second data "0000", and the third data "00".
Next, as shown in reorganization 1 in fig. 3C and 3D, the above-mentioned alignment data is subjected to a bitwise or operation to spread the bits to 256 bits. As shown in fig. 3E, the alignment result corresponding to the 0 th path of data is bitwise or operated to obtain an operation result "0200". The high 8bit data of the operation result is effective data, and the low 8bit data is ineffective data.
Subsequently, as shown in the reorganization 2 in fig. 3C and fig. 3D, the obtained operation results corresponding to the 16 paths of data may be merged. For example, by performing splice merge on 16 paths of data in fig. 3E, "0200E200000008000400E0ece0ece0E00100030004004c00E1000200E3000000" can be obtained.
Thereafter, as shown in reorganization 3 in fig. 3C and 3D, a valid byte immediately-adjacent process may be performed, where valid data in the result obtained in reorganization 2 described above may be placed at a start position or an end position.
Then, as shown in the reorganization 4 in fig. 3C and 3D, invalid data of the result obtained in the reorganization 3 may be emptied, and valid data therein may be retained.
Alternatively, as also shown in fig. 3C and 3D, it may be determined whether FIFO bit-width conversion is performed or not, and the target bit-width of the required conversion may be determined according to actual needs. In the illustration, 128bit data is obtained by bit width conversion.
Therefore, as shown in fig. 3H, fig. 3H is a structure diagram of an FPGA encoding processing flow involved in a method for encoding and decoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application. It implements the reorganization of 128bit data stream ordering into 128bit stream data (i.e., the above encoded data) by executing the encoding "00" encoding ex (i.e., e 0-ef) in parallel and without encoding three encoding algorithms. For example, as shown in fig. 3I, in the three examples of fig. 3I, after the 16-way data obtained by the reassembly 2 is processed, the result of the reassembly 4 is "e0efe1e1e 2e2", "33ee45ea", "44ec22eb".
1.1.2.1. Single byte "00" statistics
As shown in fig. 3G, according to CTP coding principle, the input/output data processing bit width of the coding module is 128 bits, i.e. 16 bytes; when the continuous 15 bytes are all '00', the 00 distribution condition decision processing of the continuous adjacent two 128bit data is needed to be combined, so the data needs to be registered in the next 128bit to form new data.
In fig. 3G, the state machine implementation that needs to have a memory function when encoding the consecutive 15 bytes 0x00, the state machine implementation such as transition of the non-consecutive 15 bytes 00 state, the non-consecutive 15 bytes 00 state, and the consecutive 15 bytes 00 state is shown in fig. 3G, which illustrates a consecutive "00" encoding control state machine.
1.1.2.2. Bitwise or reorganization
The encoding process includes three paths of simultaneous parallel processing, wherein the first path processes bytes 0x00, the second path processes 0xe 0-0 xef, and the third path processes other data except bytes 0x00 and 0xe 0-0 xef; the three paths of coded data are aligned, and the position of a single byte coded byte in 128 bits is known, so that the three paths of coded data can be recombined into a new 128bit data stream according to the known position and the original data sequence; as shown in fig. 3H.
Furthermore, conventional "00" statistics need to be implemented based on one 128bit data stream; consecutive 15 byte "00" statistics need to be implemented based on at least two 128bit data streams.
Ftd decoding
1.2.1. Interface design
In the method, the design of the decoding interface can be consistent with the design of the encoding interface, the interface time sequence of the continuous data stream and the interface time sequence of the discontinuous data stream can be respectively shown as fig. 3A and 3B, and the input and output bit widths of the decoding module are 128 bits and 16 bytes; the internal logic handles the maximum spreading to 128 bits by 15.
The ftd decode-FPGA implementation flow is shown in fig. 3J.
1.2.2.1. Split 16-way
According to the CTP decoding principle, the input and output data processing bit width of the coding module is 128 bits, namely 16 bytes, the 16 paths of the 8 bits are split averagely and correspond to 16 paths of the always blocks to be processed in parallel, each always block processes 8 bits, and each path uses 15 bytes of bit width as a decoding processing result.
1.2.2.2. Continuous "0xef" extension "0x00"
When 16 consecutive bytes are "0xef", each corresponding 15 bytes of the way will be full, as shown in fig. 3K.
The structure of the 128bit data stream may be as shown in fig. 3F.
1.2.2.3. Consecutive 8 "0xe 0xef"
When the 128bit group is { e0, ef, e0, eb, e0, ef, e0, eb, e0, ef, e0, eb, e0, ef, e0, eb } there is one empty path of 15 bytes in the two paths;
1.2.2.4. conventional combinations, i.e. corresponding to the case of direct pull-down.
1.2.2.5. Bitwise or reorganization
The encoding process includes three paths of simultaneous parallel processing, wherein the first path processes bytes 0x00, the second path processes 0xe 0-0 xef, and the third path processes other data except bytes 0x00 and 0xe 0-0 xef; the three paths of encoded data are aligned and the position of a single byte encoded byte in 128 bits is known, so that the encoded data can be recombined into a new 128bit data stream according to the known position and the original data sequence.
Fig. 3L shows a FPGA decoding process flow architecture diagram.
Ftd domain resolution
Because the front-stage decoding 16-path parallel processing single byte, the domain analysis flow is executed sequentially, and for the extremely fast over-the-counter transaction system, the data processing is based on the principle of reducing time delay, and the caching operation is reduced as much as possible, so that the multi-path pipeline parallel processing of the large throughput data input by the front-stage is required; the flow of parallel domain data processing may be as shown in fig. 3M.
The multiple pipelines have a competition problem, and a controller is required to select a route according to the identification such as the domain id; when a first domain id is detected, data is input into a domain id processing pipeline of a first path, at the moment, the first path is not processed yet, a new domain id is detected, a data stream is selectively led into a second path, when the second path is processed not yet, the new domain id is detected, the data stream is led into a third path, and so on until the last path of pipeline, at the moment, if the new domain id appears, the first path is led, and the cycle is performed; therefore, the number of parallel pipeline paths is enough to ensure that the input domain flows are all processed in time; the state machine is shown in fig. 3N.
1.4. Data stream reorganization & elimination invalid bytes
1.4.1. Module interface definition
The input/output MSG bit width wtdh can be freely configured, the minimum displacement step is 4 bits or multiples of 4, 0, 4 and 8, and the maximum displacement step is smaller than the bit width;
here, a schematic diagram of the input interface and the output interface may be as shown in fig. 3O.
1.4.2. Recombination principle
Shifting and splicing the data stream containing invalid bytes to ensure that each byte in the data is an effective byte when the VALID signal in the data stream is effective; the concrete implementation flow is shown in fig. 3P.
1.4.3. An example of stitching is shown in fig. 3Q. Fig. 3Q shows a schematic diagram of the rejection of invalid bit data in a data stream involved in a method for encoding and decoding a data stream conforming to a futures trade data exchange protocol. Fig. 3R is a schematic diagram of 32bit data stream splicing involved in a method for encoding and decoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application. Fig. 3S is a schematic diagram of 256-bit data stream splicing involved in a method for encoding and decoding a data stream according to a futures transaction data exchange protocol according to an embodiment of the present application.
In fig. 3Q, in the case where the first beat data stream is "12300000", the effective data is 3×4 bits; under the condition that the second beat of data flow is 400300000, the effective data is 1×4bit, and the recombined data 1234 corresponding to the previous beat of data to be recombined is obtained; under the condition that the third beat of data flow is 50000000, the effective data is 1×4bit, and the reorganized data '12345' corresponding to the data to be reorganized in the previous beat is obtained; under the condition that the fourth beat of data flow is 67890000, the effective data is 4×4 bits, so as to obtain the recombined data 12345678 corresponding to the previous beat of data to be recombined, and then the recombined data is redetermined; under the condition that the fifth beat of data flow is 12345670, the effective data is 7×4 bits, so as to obtain the recombined data 91234567 corresponding to the data to be recombined in the previous beat, and then the recombined data is determined again; in the case where the sixth beat data stream is "89123456", the effective data is 8×4 bits; and obtaining the recombined data 89123456 corresponding to the data to be recombined in the previous beat in the seventh beat.
It should be noted that, in addition to the above, the present embodiment may further include the technical features described in the above embodiments, so as to achieve the technical effects of the above-described encoding method of the data stream conforming to the futures trade data exchange protocol or the above-described decoding method of the data stream conforming to the futures trade data exchange protocol, and the detailed description is omitted herein for brevity.
The encoding method and the decoding method of the data stream conforming to the futures trade data exchange protocol provided by the embodiment of the application can be freely adjusted, the encoding and decoding delay can not be limited widely, and the premise is that fpga resources are enough. The encoding or decoding is completed within 7 clk clock cycles, and no special interface conversion is included; according to the coding and decoding principle, the coding and decoding steps are separately and parallelly processed; the futures counter equipment for carrying out data interaction with the exchange in an FTD encoding and decoding mode provides a low-delay encoding and decoding scheme for improving the service data processing speed of the equipment; improving FTD codec efficiency, but not limited to specific devices; the scheme can solve the problem of greatly reduced coding efficiency caused by bit width expansion; the method can realize the maintenance of the coding efficiency on the premise that the hardware resources are enough no matter how wide the bit is.
Fig. 4A is a schematic structural diagram of a coding device for data flow according to a futures transaction data exchange protocol according to an embodiment of the present application. The method specifically comprises the following steps:
a first obtaining unit 401, configured to obtain a target data stream, where the target data stream conforms to the futures transaction data exchange protocol;
a first splitting unit 402, configured to split the target data stream into byte data to obtain a first byte data sequence;
a first determining unit 403, configured to determine, for byte data in the first byte data sequence, a data class of the byte data, where the data class includes a first class and a second class;
a first encoding unit 404, configured to encode byte data belonging to the first category by using a first encoding algorithm, to obtain a first encoding;
a second encoding unit 405, configured to encode byte data belonging to the second category by using a second encoding algorithm, so as to obtain a second encoding, where the first encoding algorithm and the second encoding algorithm are executed in parallel;
a first generating unit 406, configured to generate encoded data of the target data stream based on the first encoding and the second encoding.
In one possible embodiment, the data category further includes a third category; and
before the generating of encoded data of the target data stream based on the first encoding and the second encoding, the apparatus further comprises:
a third encoding unit (not shown in the figure) for encoding byte data belonging to the third category by using a third encoding algorithm to obtain a third encoding, wherein the first encoding algorithm, the second encoding algorithm and the third encoding algorithm are executed in parallel; and
the generating encoded data of the target data stream based on the first encoding and the second encoding includes:
encoded data of the target data stream is generated based on the first encoding, the second encoding, and the third encoding.
In one possible implementation manner, the generating the encoded data of the target data stream based on the first encoding, the second encoding and the third encoding includes:
aligning the first code, the second code and the third code according to the coding time of byte data to obtain an alignment result;
and generating the coded data of the target data stream based on the alignment result.
In one possible embodiment, the first class represents byte data of 00, the second class represents byte data of greater than or equal to e0 and less than or equal to ef, the third class represents byte data of a class other than the first class and the second class, the first code is 1 byte in length, the second code is 2 bytes in length, and the third code is 1 byte in length; the alignment result includes first data corresponding to the first code, second data corresponding to the second code, and third data corresponding to the third code; in the case that there is no first code corresponding to the target coding time, using 00 to represent the first data corresponding to the target coding time; in the case where there is no second code corresponding to the target code time, the second data corresponding to the target code time is represented by 0000; in the case that there is no third code corresponding to the target coding time, representing the third data corresponding to the target coding time by 00; and
the generating the encoded data of the target data stream based on the alignment result includes:
performing bit OR operation on the first data, the second data and the third data to obtain an operation result;
And generating the coded data of the target data stream based on the operation result.
In one possible implementation manner, the generating the encoded data of the target data stream based on the operation result includes:
splicing the obtained operation results to obtain a spliced result;
and generating the coded data of the target data stream based on the splicing result.
In one possible implementation manner, the generating the encoded data of the target data stream based on the splicing result includes:
and extracting effective data from the splicing result to obtain the coded data of the target data stream.
In one possible embodiment, the target data stream includes first unit data and second unit data, the first unit data and the second unit data are adjacent in position in the target data stream, and the first unit data is located before the second unit data, the last byte data of the first unit data is 00, and the first byte data of the second unit data is 00; and
the step of scattering and splitting the target data stream into byte data to obtain a first byte data sequence includes:
The first unit data are scattered and divided into byte data, and a first byte data sequence corresponding to the first unit data is obtained;
the second unit data are scattered and split into byte data, and a first byte data sequence corresponding to the second unit data is obtained; and
the step of encoding the byte data belonging to the first category by adopting a first encoding algorithm to obtain a first encoding, comprising:
determining whether a preset number of adjacent byte data belonging to the first category exist in a first byte data sequence corresponding to the first unit data;
and under the condition that the preset number of adjacent byte data belonging to the first category exists in the first byte data sequence, adopting the first coding algorithm to code the first byte data sequence corresponding to the first unit data and the byte data belonging to the first category in the first byte data sequence corresponding to the second unit data, so as to obtain a first code.
The encoding device for the data stream according to the futures trade data exchange protocol provided in this embodiment may be the encoding device for the data stream according to the futures trade data exchange protocol shown in fig. 4A, and all the steps of the encoding method for the data stream according to the futures trade data exchange protocol described above may be executed, so as to achieve the technical effects of the encoding method for the data stream according to the futures trade data exchange protocol described above, and specific reference is made to the above related description, which is omitted herein for brevity.
Fig. 4B is a schematic structural diagram of a decoding device for a data flow according to a futures transaction data exchange protocol according to an embodiment of the present application. The method specifically comprises the following steps:
a second obtaining unit 411, configured to obtain target encoded data, where the target encoded data is obtained by encoding data conforming to the futures transaction data exchange protocol;
a second branching unit 412, configured to scatter and branch the target encoded data into byte data, to obtain a second byte data sequence;
a second determining unit 413, configured to determine, for the byte data in the second byte data sequence, a data class of the byte data, where the data class includes a fourth class and a fifth class, the fourth class corresponds to the first class, and the fifth class corresponds to the second class;
a first decoding unit 414, configured to decode byte data belonging to the fourth category by using a first decoding algorithm to obtain fourth data;
a second decoding unit 415, configured to decode byte data belonging to the fifth category by using a second decoding algorithm, to obtain fifth data, where the first decoding algorithm and the second decoding algorithm are executed in parallel, the first decoding algorithm is an inverse operation of the first encoding algorithm, and the second decoding algorithm is an inverse operation of the second encoding algorithm;
A second generating unit 416 for generating decoded data of the target encoded data based on the fourth data and the fifth data.
The decoding device for the data stream according to the futures trade data exchange protocol provided in this embodiment may be a decoding device for the data stream according to the futures trade data exchange protocol as shown in fig. 4B, and may perform all the steps of the decoding method for the data stream according to the futures trade data exchange protocol described above, so as to achieve the technical effects of the decoding method for the data stream according to the futures trade data exchange protocol described above, and the detailed description is omitted herein for brevity.
The embodiment of the application also provides an FPGA, which is used for implementing the encoding method of the data stream conforming to the futures trade data exchange protocol of the first aspect or the decoding method of the data stream conforming to the futures trade data exchange protocol of the second aspect.
For example, the FPGA may include, for example, method steps provided by the method embodiments:
obtaining a target data stream, wherein the target data stream accords with the futures transaction data exchange protocol;
The target data stream is scattered and divided into byte data, and a first byte data sequence is obtained;
determining a data category of byte data in the first byte data sequence, wherein the data category comprises a first category and a second category;
adopting a first coding algorithm to code byte data belonging to the first category to obtain a first code;
adopting a second coding algorithm to code byte data belonging to the second category to obtain a second code, wherein the first coding algorithm and the second coding algorithm are executed in parallel;
based on the first encoding and the second encoding, encoded data of the target data stream is generated.
Or,
obtaining target coded data, wherein the target coded data is obtained by coding data conforming to the futures transaction data exchange protocol;
the target coding data are scattered and divided into byte data, and a second byte data sequence is obtained;
determining a data class of the byte data in the second byte data sequence, wherein the data class comprises a fourth class and a fifth class, the fourth class corresponds to the first class, and the fifth class corresponds to the second class;
Adopting a first decoding algorithm to decode byte data belonging to the fourth category to obtain fourth data;
adopting a second decoding algorithm to decode byte data belonging to the fifth category to obtain fifth data, wherein the first decoding algorithm and the second decoding algorithm are executed in parallel, the first decoding algorithm is the inverse operation of a first encoding algorithm, and the second decoding algorithm is the inverse operation of a second encoding algorithm;
and generating decoding data of the target encoding data based on the fourth data and the fifth data.
The FPGA provided in this embodiment may obtain a target data stream, where the target data stream conforms to the futures transaction data exchange protocol, so as to perform encoding processing on the target data stream subsequently, then break up and split the target data stream into byte data to obtain a first byte data sequence, so as to obtain a plurality of byte data, then determine a data class of the byte data with respect to the byte data in the first byte data sequence, where the data class includes a first class and a second class, so as to classify the byte data obtained by breaking up and split, then encode the byte data belonging to the first class by using a first encoding algorithm to obtain a first encoding, and encode the byte data belonging to the second class by using a second encoding algorithm to obtain a second encoding, where the first encoding algorithm and the second encoding algorithm are executed in parallel, so as to process the byte data of different data classes in parallel by using different encoding algorithms, and finally generate the data of the target data stream based on the first encoding algorithm and the second encoding algorithm, so as to obtain the encoding result of the encoded data of the target stream. Therefore, the encoding of byte data of different categories can be realized by executing two different encoding algorithms in parallel, and the encoding efficiency of data conforming to futures transaction data exchange protocols is further improved.
Or,
the FPGA provided in this embodiment may obtain target encoded data, where the target encoded data is obtained by encoding data conforming to the futures transaction data exchange protocol, so as to decode the encoded target encoded data subsequently, then break up and split the target encoded data into byte data to obtain a second byte data sequence, so as to obtain a plurality of byte data, then determine a data class of the byte data according to the byte data in the second byte data sequence, where the data class includes a fourth class and a fifth class, the fourth class corresponds to the first class, the fifth class corresponds to the second class, so as to classify the byte data obtained by breaking up and splitting, then, using a first decoding algorithm, decoding the byte data belonging to the fourth class to obtain fourth data, and using a second decoding algorithm, decoding the byte data belonging to the fifth class to obtain fifth data, where the first decoding algorithm and the second decoding algorithm are performed in parallel, the first decoding algorithm is used to decode the first algorithm, the second decoding algorithm is used to decode the second algorithm, and the second decoding algorithm is used to obtain the encoded data based on the second decoding algorithm, and the fifth decoding algorithm is used to obtain the encoded data based on the second algorithm, and the fourth decoding algorithm is used to obtain the encoded data. Therefore, decoding of byte data of different categories can be realized by executing two different decoding algorithms in parallel, and further decoding efficiency of data conforming to futures transaction data exchange protocols is improved.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application, and an electronic device 500 shown in fig. 5 includes: at least one processor 501, memory 502, at least one network interface 504, and other user interfaces 503. The various components in the electronic device 500 are coupled together by a bus system 505. It is understood that bus system 505 is used to enable connected communications between these components. The bus system 505 includes a power bus, a control bus, and a status signal bus in addition to a data bus. But for clarity of illustration the various buses are labeled as bus system 505 in fig. 5.
The user interface 503 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, a trackball, a touch pad, or a touch screen, etc.).
It is to be appreciated that the memory 502 in embodiments of the present application may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The nonvolatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable EPROM (EEPROM), or a flash Memory. The volatile memory may be random access memory (Random Access Memory, RAM) which acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (Double Data Rate SDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and Direct memory bus RAM (DRRAM). The memory 502 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some implementations, the memory 502 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 5021 and application programs 5022.
The operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, for implementing various basic services and processing hardware-based tasks. The application 5022 includes various application programs such as a Media Player (Media Player), a Browser (Browser), and the like for realizing various application services. A program for implementing the method of the embodiment of the present application may be included in the application 5022.
In this embodiment, the processor 501 is configured to execute the method steps provided in the method embodiments by calling a program or an instruction stored in the memory 502, specifically, a program or an instruction stored in the application 5022, for example, including:
obtaining a target data stream, wherein the target data stream accords with the futures transaction data exchange protocol;
the target data stream is scattered and divided into byte data, and a first byte data sequence is obtained;
determining a data category of byte data in the first byte data sequence, wherein the data category comprises a first category and a second category;
Adopting a first coding algorithm to code byte data belonging to the first category to obtain a first code;
adopting a second coding algorithm to code byte data belonging to the second category to obtain a second code, wherein the first coding algorithm and the second coding algorithm are executed in parallel;
based on the first encoding and the second encoding, encoded data of the target data stream is generated.
Or,
obtaining target coded data, wherein the target coded data is obtained by coding data conforming to the futures transaction data exchange protocol;
the target coding data are scattered and divided into byte data, and a second byte data sequence is obtained;
determining a data class of the byte data in the second byte data sequence, wherein the data class comprises a fourth class and a fifth class, the fourth class corresponds to the first class, and the fifth class corresponds to the second class;
adopting a first decoding algorithm to decode byte data belonging to the fourth category to obtain fourth data;
adopting a second decoding algorithm to decode byte data belonging to the fifth category to obtain fifth data, wherein the first decoding algorithm and the second decoding algorithm are executed in parallel, the first decoding algorithm is the inverse operation of a first encoding algorithm, and the second decoding algorithm is the inverse operation of a second encoding algorithm;
And generating decoding data of the target encoding data based on the fourth data and the fifth data.
The method disclosed in the embodiments of the present application may be applied to the processor 501 or implemented by the processor 501. The processor 501 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuitry in hardware or instructions in software in the processor 501. The processor 501 may be a general purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), an off-the-shelf programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be embodied directly in hardware, in a decoded processor, or in a combination of hardware and software elements in a decoded processor. The software elements may be located in a random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory 502, and the processor 501 reads information in the memory 502 and, in combination with its hardware, performs the steps of the method described above.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For a hardware implementation, the processing units may be implemented within one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processors (Digital Signal Processing, DSP), digital signal processing devices (dspev, DSPD), programmable logic devices (Programmable Logic Device, PLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units configured to perform the above-described functions of the application, or a combination thereof.
For a software implementation, the techniques described herein may be implemented by means of units that perform the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
The electronic device provided in this embodiment may be an electronic device as shown in fig. 5, and may perform all the steps of the above-described encoding method of the data stream according to the futures trade data exchange protocol or the decoding method of the data stream according to the futures trade data exchange protocol, so as to achieve the technical effects of the above-described encoding method of the data stream according to the futures trade data exchange protocol or the decoding method of the data stream according to the futures trade data exchange protocol, and specific reference is made to the above-described related description, which is omitted herein for brevity.
The embodiment of the application also provides a storage medium (computer readable storage medium). The storage medium here stores one or more programs. Wherein the storage medium may comprise volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid state disk; the memory may also comprise a combination of the above types of memories.
When the one or more programs in the storage medium are executable by the one or more processors, the method for encoding the data stream conforming to the futures trade data exchange protocol or the method for decoding the data stream conforming to the futures trade data exchange protocol, which are executed on the electronic device side, are implemented.
The processor is configured to execute an encoding program of a data stream conforming to a futures trade data exchange protocol or a decoding program of a data stream conforming to a futures trade data exchange protocol stored in the memory, so as to implement the following steps of an encoding method of a data stream conforming to a futures trade data exchange protocol or a decoding method of a data stream conforming to a futures trade data exchange protocol, which are executed on an electronic device side:
obtaining a target data stream, wherein the target data stream accords with the futures transaction data exchange protocol;
The target data stream is scattered and divided into byte data, and a first byte data sequence is obtained;
determining a data category of byte data in the first byte data sequence, wherein the data category comprises a first category and a second category;
adopting a first coding algorithm to code byte data belonging to the first category to obtain a first code;
adopting a second coding algorithm to code byte data belonging to the second category to obtain a second code, wherein the first coding algorithm and the second coding algorithm are executed in parallel;
based on the first encoding and the second encoding, encoded data of the target data stream is generated.
Or,
obtaining target coded data, wherein the target coded data is obtained by coding data conforming to the futures transaction data exchange protocol;
the target coding data are scattered and divided into byte data, and a second byte data sequence is obtained;
determining a data class of the byte data in the second byte data sequence, wherein the data class comprises a fourth class and a fifth class, the fourth class corresponds to the first class, and the fifth class corresponds to the second class;
Adopting a first decoding algorithm to decode byte data belonging to the fourth category to obtain fourth data;
adopting a second decoding algorithm to decode byte data belonging to the fifth category to obtain fifth data, wherein the first decoding algorithm and the second decoding algorithm are executed in parallel, the first decoding algorithm is the inverse operation of a first encoding algorithm, and the second decoding algorithm is the inverse operation of a second encoding algorithm;
and generating decoding data of the target encoding data based on the fourth data and the fifth data.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of function in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
It is to be understood that the terminology used herein is for the purpose of describing particular example embodiments only, and is not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The terms "comprises," "comprising," "includes," "including," and "having" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and/or groups thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring their performance in the particular order described or illustrated, unless an order of performance is explicitly stated. It should also be appreciated that additional or alternative steps may be used.
The foregoing is only a specific embodiment of the invention to enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (9)

1. A method of encoding a data stream conforming to a futures trade data exchange protocol, the method comprising:
obtaining a target data stream, wherein the target data stream accords with the futures transaction data exchange protocol;
the target data stream is scattered and divided into byte data, and a first byte data sequence is obtained;
determining a data category of byte data in the first byte data sequence, wherein the data category comprises and only comprises three categories of a first category, a second category and a third category;
adopting a first coding algorithm to code byte data belonging to the first category to obtain a first code;
Adopting a second coding algorithm to code byte data belonging to the second category to obtain a second code;
adopting a third coding algorithm to code byte data belonging to the third category to obtain a third code, wherein the first coding algorithm, the second coding algorithm and the third coding algorithm are executed in parallel;
generating encoded data of the target data stream based on the first encoding, the second encoding, and the third encoding, wherein byte data is decoded in parallel in byte units in the process of decoding the encoded data;
in the encoding process of the target data stream, three paths of parallel encoding are performed;
wherein the generating encoded data of the target data stream based on the first encoding, the second encoding, and the third encoding comprises:
aligning the first code, the second code and the third code according to the coding time of byte data to obtain an alignment result;
generating coded data of the target data stream based on the alignment result;
the first category indicates that byte data is 00, the second category indicates that byte data is greater than or equal to e0 and less than or equal to ef, the third category indicates that byte data is a category other than the first category and the second category, the first code is 1 byte in length, the second code is 2 bytes in length, and the third code is 1 byte in length; the alignment result includes first data corresponding to the first code, second data corresponding to the second code, and third data corresponding to the third code; in the case that there is no first code corresponding to the target coding time, using 00 to represent the first data corresponding to the target coding time; in the case where there is no second code corresponding to the target code time, the second data corresponding to the target code time is represented by 0000; in the case that there is no third code corresponding to the target coding time, representing the third data corresponding to the target coding time by 00; and
The generating the encoded data of the target data stream based on the alignment result includes:
performing bit OR operation on the first data, the second data and the third data to obtain an operation result;
and generating the coded data of the target data stream based on the operation result.
2. The method of claim 1, wherein generating encoded data for the target data stream based on the result of the operation comprises:
splicing the obtained operation results to obtain a spliced result;
and generating the coded data of the target data stream based on the splicing result.
3. The method of claim 2, wherein generating encoded data for the target data stream based on the splice result comprises:
and extracting effective data from the splicing result to obtain the coded data of the target data stream.
4. A method according to any of claims 1-3, wherein the target data stream comprises first unit data and second unit data, the first unit data and the second unit data being located adjacent to each other in the target data stream, and wherein the first unit data is located before the second unit data, the last byte data of the first unit data being 00 and the first byte data of the second unit data being 00; and
The step of scattering and splitting the target data stream into byte data to obtain a first byte data sequence includes:
the first unit data are scattered and divided into byte data, and a first byte data sequence corresponding to the first unit data is obtained;
the second unit data are scattered and split into byte data, and a first byte data sequence corresponding to the second unit data is obtained; and
the step of encoding the byte data belonging to the first category by adopting a first encoding algorithm to obtain a first encoding, comprising:
determining whether a preset number of adjacent byte data belonging to the first category exist in a first byte data sequence corresponding to the first unit data;
and under the condition that the preset number of adjacent byte data belonging to the first category exists in the first byte data sequence, adopting the first coding algorithm to code the first byte data sequence corresponding to the first unit data and the byte data belonging to the first category in the first byte data sequence corresponding to the second unit data, so as to obtain a first code.
5. A method of decoding a data stream conforming to a futures trade data exchange protocol, the method comprising:
Obtaining target encoded data, wherein the target encoded data is obtained by encoding data conforming to the futures trade data exchange protocol using the method of one of claims 1 to 4;
the target coding data are scattered and divided into byte data, and a second byte data sequence is obtained;
determining a data category of the byte data in the second byte data sequence, wherein the data category comprises and only comprises a fourth category, a fifth category and a sixth category;
adopting a first decoding algorithm to decode byte data belonging to the fourth category to obtain fourth data;
adopting a second decoding algorithm to decode the byte data belonging to the fifth category to obtain fifth data;
adopting a third decoding algorithm to decode byte data belonging to the sixth category to obtain sixth data, wherein the first decoding algorithm, the second decoding algorithm and the third decoding algorithm are used for parallel decoding of the byte data by taking bytes as units;
generating decoded data of the target encoded data based on the fourth data, the fifth data, and the sixth data;
in the decoding process of the target coded data, three paths of parallel decoding are performed.
6. An encoding device for a data stream conforming to a futures trade data exchange protocol, the device comprising:
a first obtaining unit, configured to obtain a target data stream, where the target data stream conforms to the futures transaction data exchange protocol;
the first splitting unit is used for splitting the target data stream into byte data to obtain a first byte data sequence;
a first determining unit, configured to determine, for byte data in the first byte data sequence, a data category of the byte data, where the data category includes and includes only three categories of a first category, a second category, and a third category;
the first coding unit is used for coding byte data belonging to the first category by adopting a first coding algorithm to obtain a first code;
the second coding unit is used for coding byte data belonging to the second category by adopting a second coding algorithm to obtain a second code;
the third coding unit is used for coding byte data belonging to the third category by adopting a third coding algorithm to obtain a third code, wherein the first coding algorithm, the second coding algorithm and the third coding algorithm are executed in parallel;
A first generation unit configured to generate encoded data of the target data stream based on the first encoding, the second encoding, and the third encoding, wherein byte data are decoded in parallel in units of bytes in decoding the encoded data;
in the encoding process of the target data stream, three paths of parallel encoding are performed;
wherein the generating encoded data of the target data stream based on the first encoding, the second encoding, and the third encoding comprises:
aligning the first code, the second code and the third code according to the coding time of byte data to obtain an alignment result;
generating coded data of the target data stream based on the alignment result;
the first category indicates that byte data is 00, the second category indicates that byte data is greater than or equal to e0 and less than or equal to ef, the third category indicates that byte data is a category other than the first category and the second category, the first code is 1 byte in length, the second code is 2 bytes in length, and the third code is 1 byte in length; the alignment result includes first data corresponding to the first code, second data corresponding to the second code, and third data corresponding to the third code; in the case that there is no first code corresponding to the target coding time, using 00 to represent the first data corresponding to the target coding time; in the case where there is no second code corresponding to the target code time, the second data corresponding to the target code time is represented by 0000; in the case that there is no third code corresponding to the target coding time, representing the third data corresponding to the target coding time by 00; and
The generating the encoded data of the target data stream based on the alignment result includes:
performing bit OR operation on the first data, the second data and the third data to obtain an operation result;
and generating the coded data of the target data stream based on the operation result.
7. A decoding device for a data stream conforming to a futures trade data exchange protocol, the device comprising:
a second obtaining unit, configured to obtain target encoded data, where the target encoded data is obtained by encoding data conforming to the futures transaction data exchange protocol by the method according to one of claims 1 to 4;
the second shunt unit is used for scattering and shunting the target coded data into byte data to obtain a second byte data sequence;
a second determining unit, configured to determine, for byte data in the second byte data sequence, a data category of the byte data, where the data category includes and includes only three categories of a fourth category, a fifth category, and a sixth category, the fourth category corresponds to the first category, the fifth category corresponds to the second category, and the sixth category corresponds to the third category;
The first decoding unit is used for decoding byte data belonging to the fourth category by adopting a first decoding algorithm to obtain fourth data;
the second decoding unit is used for decoding the byte data belonging to the fifth category by adopting a second decoding algorithm to obtain fifth data, wherein the first decoding algorithm is the inverse operation of the first encoding algorithm, and the second decoding algorithm is the inverse operation of the second encoding algorithm;
a third decoding unit, configured to decode byte data belonging to the sixth category by using a third decoding algorithm to obtain sixth data, where the first decoding algorithm, the second decoding algorithm, and the third decoding algorithm are configured to decode byte data in parallel in byte units;
a second generation unit configured to generate decoded data of the target encoded data based on the fourth data, the fifth data, and the sixth data;
in the decoding process of the target coded data, three paths of parallel decoding are performed.
8. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing a computer program stored in said memory, and which, when executed, implements the method of any of the preceding claims 1-5.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method of any of the preceding claims 1-5.
CN202311187059.1A 2023-09-14 2023-09-14 Encoding and decoding method and device for data stream conforming to futures transaction data exchange protocol Active CN116915368B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311187059.1A CN116915368B (en) 2023-09-14 2023-09-14 Encoding and decoding method and device for data stream conforming to futures transaction data exchange protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311187059.1A CN116915368B (en) 2023-09-14 2023-09-14 Encoding and decoding method and device for data stream conforming to futures transaction data exchange protocol

Publications (2)

Publication Number Publication Date
CN116915368A CN116915368A (en) 2023-10-20
CN116915368B true CN116915368B (en) 2024-03-29

Family

ID=88360758

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311187059.1A Active CN116915368B (en) 2023-09-14 2023-09-14 Encoding and decoding method and device for data stream conforming to futures transaction data exchange protocol

Country Status (1)

Country Link
CN (1) CN116915368B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110046331A (en) * 2019-03-20 2019-07-23 北京品友互动信息技术股份公司 Data-encoding scheme and device, storage medium, electronic device
CN110932822A (en) * 2019-12-02 2020-03-27 泰康保险集团股份有限公司 Data encoding method, data decoding method, device, equipment and storage medium
CN112783974A (en) * 2020-12-31 2021-05-11 杭州趣链科技有限公司 Data conversion method, device, equipment and storage medium
CN113792816A (en) * 2021-09-27 2021-12-14 重庆紫光华山智安科技有限公司 Data encoding method, data encoding device, computer equipment and storage medium
CN114070470A (en) * 2021-11-17 2022-02-18 中国银行股份有限公司 Encoding and decoding method and device
CN115276889A (en) * 2021-04-29 2022-11-01 腾讯科技(深圳)有限公司 Decoding processing method, decoding processing device, computer equipment and storage medium
CN116701048A (en) * 2023-06-12 2023-09-05 合众新能源汽车股份有限公司 Data verification method, data memory and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11244126B2 (en) * 2019-12-19 2022-02-08 Datamax-O'neil Corporation Systems and methods for encoding and decoding data

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110046331A (en) * 2019-03-20 2019-07-23 北京品友互动信息技术股份公司 Data-encoding scheme and device, storage medium, electronic device
CN110932822A (en) * 2019-12-02 2020-03-27 泰康保险集团股份有限公司 Data encoding method, data decoding method, device, equipment and storage medium
CN112783974A (en) * 2020-12-31 2021-05-11 杭州趣链科技有限公司 Data conversion method, device, equipment and storage medium
CN115276889A (en) * 2021-04-29 2022-11-01 腾讯科技(深圳)有限公司 Decoding processing method, decoding processing device, computer equipment and storage medium
CN113792816A (en) * 2021-09-27 2021-12-14 重庆紫光华山智安科技有限公司 Data encoding method, data encoding device, computer equipment and storage medium
CN114070470A (en) * 2021-11-17 2022-02-18 中国银行股份有限公司 Encoding and decoding method and device
CN116701048A (en) * 2023-06-12 2023-09-05 合众新能源汽车股份有限公司 Data verification method, data memory and storage medium

Also Published As

Publication number Publication date
CN116915368A (en) 2023-10-20

Similar Documents

Publication Publication Date Title
US10672014B2 (en) Method and a device for decoding data streams in reconfigurable platforms
CN103415836B (en) The network processing unit of expedited data Packet analyzing and method
CN111967244B (en) FAST protocol decoding method, device and equipment based on FPGA
TWI812623B (en) Node device, computer-implemented method, and related non-transitory processor-readable medium
CN111683069A (en) Customized communication protocol and service method based on netty framework
JP5750786B2 (en) RDP bitmap hash acceleration using SIMD instructions
JP2012151840A (en) Data compression device, operation method thereof, and data processing device including the same
US9983876B2 (en) Non-deterministic finite state machine module for use in a regular expression matching system
Morris et al. FPGA accelerated low-latency market data feed processing
US8041998B2 (en) Data processor decoding trace-worthy event collision matrix from pipelined processor
CN111147462A (en) FPGA-based step protocol analysis method, system, terminal and storage medium
CN114333862B (en) Audio encoding method, decoding method, device, equipment, storage medium and product
CN116915368B (en) Encoding and decoding method and device for data stream conforming to futures transaction data exchange protocol
US8473428B2 (en) Generation and use of specific probability tables for arithmetic coding in data compression systems
CN111865811A (en) Data processing method, device, equipment and medium
US7839849B1 (en) Formatting fields of communication packets
CN108573069B (en) Twins method for accelerating matching of regular expressions of compressed flow
Demangeon et al. On the expressiveness of multiparty sessions
CN109155777A (en) For disposing the method and network node of SCTP grouping
CN116193160A (en) Digital watermark embedding method, device, equipment and medium
CN110548285B (en) Game communication control method and device, medium and electronic equipment
CN114499757A (en) Method and device for generating checksum and electronic equipment
CN112995067B (en) Coarse-grained reconfigurable data processing architecture and data processing method thereof
Pontarelli et al. Smashing OpenFlow's “atomic” actions: Programmable data plane packet manipulation in hardware
CN116668339A (en) Deep packet inspection system and application method thereof

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