Methods and systems for FPGA configuration file compression storage and hardware recovery

By employing a lossless compression method based on historical window matching and entropy coding in the FPGA configuration file, a compressed configuration file suitable for FPGA-side hardware recovery is generated, and hardware recovery is performed on the FPGA side. This solves the problems of storage resource occupation and control logic complexity in the existing technology, and achieves efficient configuration file storage and transmission.

CN123115071APending Publication Date: 2026-11-1758TH RES INST OF CETC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611337344.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively reduce storage space and data transmission volume in FPGA configuration files while controlling on-chip storage resource usage and control logic complexity.

Method used

A lossless compression method based on historical window matching and entropy coding is adopted. A compressed configuration file suitable for FPGA hardware recovery is generated on the software side, and decompression and recovery are performed on the FPGA side through the hardware recovery module. Hardware adaptation constraints such as fixed sliding window, disabling static dictionary references and literal context modeling are applied.

Benefits of technology

It achieves reduced storage resource consumption and control logic complexity during lossless recovery on the FPGA side, while significantly reducing the storage and transmission overhead of configuration files, with a compression rate of 29% to 32%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123115071A_ABST
    Figure CN123115071A_ABST
Patent Text Reader

Abstract

This invention relates to a method and system for compressed storage and hardware recovery of FPGA configuration files. The method includes: acquiring the original FPGA configuration file; performing lossless compression on the original FPGA configuration file in software, applying hardware adaptation constraints, and generating a compressed configuration file suitable for FPGA-side hardware recovery; sending the compressed configuration file to the FPGA via a data transmission path; and decompressing and recovering the compressed configuration file on the FPGA via a hardware recovery module to obtain and output the recovered configuration data. The hardware adaptation constraints include a fixed sliding window size, etc. This invention, through the combination of software-side compression constraints and the FPGA-side hardware recovery structure, achieves a compression ratio of 29%–32% and a recovery throughput of approximately 1.6 Gbps. It can reduce the amount of configuration file storage and data transmission while lowering the storage and control complexity of the FPGA-side hardware recovery process and ensuring lossless recovery of configuration data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data compression and decoding technology, specifically to a method and system for FPGA configuration file compression storage and hardware recovery. Background Technology

[0002] Field-Programmable Gate Arrays (FPGAs) are reconfigurable devices whose internal logic functions and interconnections can be changed through configuration data. During applications such as power-on, function updates, remote upgrades, and dynamic reconfiguration, FPGAs typically need to load configuration files from off-chip memory or external interfaces to configure their internal logic resources and interconnect structures. As the logic size and on-chip resources of FPGA devices continue to increase, the amount of data in the configuration files also increases accordingly, leading to problems such as increased off-chip memory capacity, longer configuration data transfer times, and reduced system update efficiency.

[0003] Compressing FPGA configuration files is an effective way to reduce storage space and the amount of data transmitted. FPGA configuration files are typically structured binary data with some local repetition and statistical redundancy. Therefore, using lossless compression to compress the configuration files can reduce the size of the data to be stored or transmitted. Since the configuration file directly determines the internal logic function of the FPGA, the restored configuration data must be consistent with the original configuration file. Therefore, this type of application has high requirements for the lossless and reliable nature of decompression and recovery.

[0004] Existing general-purpose lossless compression methods are typically designed for software platforms. The recovery process of their compressed bitstreams may involve steps such as variable windows, dictionary referencing, context modeling, and dynamic code table construction. Directly supporting the recovery process of a complete general-purpose compressed bitstream on the FPGA side would easily increase on-chip storage resource consumption and control logic complexity, and would also hinder the formation of a well-structured and clearly defined hardware recovery path. On the other hand, if only a simpler compression method is used, although the hardware recovery cost is lower, the compression effect may be limited, making it difficult to significantly reduce the storage and transmission overhead of the configuration file.

[0005] Therefore, it is necessary to propose a compression storage and hardware recovery method for FPGA configuration files, so that the software generates a compressed configuration file suitable for FPGA hardware recovery during the compression process, and the corresponding hardware recovery module completes lossless recovery on the FPGA side. This reduces the amount of configuration file storage and data transmission while controlling the storage resource consumption and control logic complexity of the FPGA recovery process. Summary of the Invention

[0006] To address the aforementioned technical problems, this invention provides a method for compressed storage and hardware recovery of FPGA configuration files, comprising the following steps: Step S1: Obtain the original FPGA configuration file; Step S2: Perform lossless compression processing on the original FPGA configuration file on the software side to generate a compressed configuration file suitable for FPGA hardware recovery. The lossless compression processing adopts a compression method based on historical window matching and entropy coding. Hardware adaptation constraints are applied during the compression process, and the hardware adaptation constraints include: fixed sliding window size, disabling static dictionary references, disabling literal context modeling, constraining compression quality level, and fixing distance coding related parameters. Step S3: Store the compressed configuration file in off-chip memory or send it to the FPGA via a data transmission path; Step S4: On the FPGA side, the compressed configuration file is decompressed and restored using a hardware recovery module to obtain restored configuration data. The decompression and restoration includes: caching and bitstream parsing the input compressed configuration file; parsing the header control information in the compressed configuration file; and constructing or reading a decoding table based on the header control information. The compressed text data is decoded to obtain literal information, command information, and distance information; historical data is reconstructed based on the literal information, command information, and distance information. Step S5: Output the recovery configuration data to the cache space, external interface, or configuration data receiving end.

[0007] In one embodiment of the present invention, the lossless compression process adopts the Brotli encoding method, wherein the sliding window size is fixed at 64KB, and the distance encoding related parameters include the distance suffix bit parameter and the direct distance code parameter, and both the distance suffix bit parameter and the direct distance code parameter are set to preset fixed values.

[0008] Specifically, the lossless compression process uses Brotli encoding, with the encoding mode set to general mode, the compression quality level fixed at Q5, the sliding window size fixed at 16 to correspond to the 64KB history window, the static dictionary reference path and the literal context modeling path disabled, the distance suffix bit parameter and the direct distance code parameter both set to 0, and the large window mode disabled.

[0009] In one embodiment of the present invention, the bit stream parsing includes: temporarily storing the input bit stream through an input buffer, using a shift register to form a bit window to store the bit segment to be parsed, extracting a field of a specified length from the high bit of the bit window and outputting it according to the bit width requested by the subsequent unit through a barrel shifter, and reading the next data word from the input buffer and shifting and splicing it to supplement the valid bits when there are insufficient valid bits.

[0010] In one embodiment of the present invention, the header control information includes a stream header field, a metablock header field, and a compressed metablock data descriptor field; wherein the stream header field includes at least a window order flag, a dictionary flag, and a window size indicator, wherein the window size indicator is fixed to a value corresponding to the sliding window size; and the metablock header field includes at least a metablock length and a compression flag; the compressed metablock data descriptor field includes at least a block type descriptor, a context mapping descriptor, and a Huffman code length descriptor.

[0011] In one embodiment of the present invention, the construction or reading of the decoding table includes: storing multiple types of Huffman decoding tables using RAM partitioning, wherein the multiple types of Huffman decoding tables include literal code tables, command code tables, distance code tables, block type code tables, and block count code tables; employing a two-level lookup table structure, using the high-order bits of the code stream as indexes to enter the first-level table, and when the codeword length exceeds the bit width of the first-level table, entering the second-level sub-table to retrieve the symbol and complete code length based on the offset given by the first-level table; each table entry includes at least a symbol field, a code length field, and an index or flag field pointing to the second-level table.

[0012] In one embodiment of the present invention, the historical data reconstruction in step S4 includes: using a fixed-capacity circular buffer to store the recovered data, configuring write pointers and read pointers, and setting address wraparound logic to realize cyclic read and write; for literal information, writing the literal into the circular buffer and outputting it; for command information and distance information, recovering the backtracking distance based on the distance information, reading the recovered data from the circular buffer based on the backtracking distance, performing copy write-back and synchronous output; when the copy length is greater than the backtracking distance, using a byte-by-byte or pipelined overlapping copy method.

[0013] The present invention also provides a compressed storage and hardware recovery system for FPGA configuration files, including a hardware recovery module, wherein the hardware recovery module includes a bitstream parsing unit, a header parsing unit, an entropy decoding unit, a historical data reconstruction unit and an output unit; The bitstream parsing unit is used to receive compressed configuration files and provide variable-length bit read data; The header parsing unit is used to parse the header control information in the compressed configuration file; The entropy decoding unit is used to construct or read the decoding table and decode the compressed text data; The historical data reconstruction unit is used to perform literal writing, distance recovery, and historical data copying based on the decoding results; The output unit is used to output the restored configuration data.

[0014] In one embodiment of the present invention, the bit stream parsing unit includes an input buffer, a bit window, a bit counter, and a barrel shifter; the input buffer is constructed using a dual-port RAM or FIFO, receiving and temporarily storing the input bit stream byte by byte or word by word; the bit window is constructed using a shift register, storing the bit segment to be parsed, and the effective bit length is recorded by the bit counter; the barrel shifter extracts a field of a specified length from the high bits of the bit window according to the bit width requested by the subsequent unit, and updates the bit counter after extracting the bit; wherein, when the bit window has insufficient effective bits, it reads the next data word from the input buffer and performs shifting and concatenation to supplement the effective bits.

[0015] The hardware recovery module has a compression rate of 29% to 32% for the FPGA configuration file; the hardware recovery module has the following resource requirements on a medium-scale FPGA device: 6500 LUTs, 5100 FFs, 28 BRAMs, and does not occupy DSP resources; the operating frequency is 200MHz, and the recovery throughput is 1.6Gbps.

[0016] Compared with the prior art, the above-mentioned technical solution of the present invention has the following advantages: The compressed storage and hardware recovery scheme of the present invention generates a compressed configuration file on the software side according to hardware adaptation constraints, making the data recovery source, decoding path and distance recovery method of the compressed bitstream more suitable for FPGA side implementation, which can reduce the hardware recovery end's support requirements for complex paths such as static dictionary references, context mapping and variable distance parameters; Since the FPGA side completes the recovery process through hardware units such as bitstream parsing, header parsing, entropy decoding and historical data reconstruction, it can reduce the configuration file storage and transmission overhead and control the hardware recovery complexity while ensuring lossless recovery of configuration data. Attached Figure Description

[0017] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings.

[0018] Figure 1 This is a schematic diagram of the FPGA configuration file compression storage and hardware recovery system provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the software-side compressed configuration file generation process provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the FPGA-side hardware recovery process provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the hardware recovery module structure provided in an embodiment of the present invention. Detailed Implementation

[0019] like Figure 1As shown, this embodiment provides a compressed storage and hardware recovery system for FPGA configuration files. The original FPGA configuration file is first input to a software compression module. This module performs lossless compression on the original FPGA configuration file according to hardware adaptation constraints, generating a compressed configuration file suitable for FPGA-side hardware recovery. The compressed configuration file can be stored in off-chip memory or sent to the FPGA via a serial interface, parallel interface, on-chip bus, or other data paths. The FPGA is equipped with a hardware recovery module, which decompresses and recovers the received compressed configuration file, outputting the recovered configuration data. The original FPGA configuration file can be a bit file, a bin file, or other binary configuration data used for FPGA configuration loading.

[0020] like Figure 1 and Figure 2 As shown, the FPGA configuration file compression storage and hardware recovery method provided in this embodiment includes the following steps: S1, obtaining the original FPGA configuration file; S2, performing lossless compression processing on the original FPGA configuration file in software to generate a compressed configuration file suitable for FPGA hardware recovery; S3, storing the compressed configuration file in off-chip memory or sending it to the FPGA via a data transmission path; S4, decompressing and recovering the compressed configuration file on the FPGA via a hardware recovery module to obtain recovered configuration data; S5, outputting the recovered configuration data to a cache space, an external interface, or a configuration data receiving end.

[0021] Furthermore, regarding the generation of compressed configuration files on the software side: such as Figure 2 As shown, the software-side compressed configuration file generation process includes: reading the original FPGA configuration file; setting lossless compression encoding parameters; applying hardware adaptation constraints based on FPGA hardware recovery requirements; performing lossless compression; and outputting the compressed configuration file. The hardware adaptation constraints are used to make at least one of the following—the data recovery source, decoding path, and distance recovery method of the compressed configuration file—more suitable for FPGA hardware recovery. Specifically, the hardware adaptation constraints include one or more of the following: fixing the sliding window size, disabling static dictionary references, disabling literal context modeling, constraining the compression quality level, and fixing distance encoding-related parameters.

[0022] In one implementation, the lossless compression process employs a compression method based on historical window matching and entropy coding. Historical window matching is used to represent repeated segments in the original configuration file as historical copy information, while entropy coding is used to encode symbols such as literals, commands, or distances. By applying hardware adaptation constraints to the compressed bitstream on the software side, the historical cache capacity, decoding path, and distance recovery method during the FPGA-side hardware recovery process can be more determined, thereby reducing the implementation complexity of the hardware recovery module.

[0023] In one specific implementation, the lossless compression process employs Brotli encoding. Before encoding, the software compression module uniformly sets the file format and encoding parameters, specifically as follows: the encoding mode is set to generic mode to avoid special encoding paths for text or fonts; the compression quality level is fixed at Q5 to control the code length distribution and code table size of entropy encoding; and the sliding window size is fixed at 16 (i.e., 2¹). 6 (Corresponding to a 64KB history window); disable static dictionary reference path; disable literal context modeling path; set both distance suffix bit parameter and direct distance code parameter to 0; disable large window mode to avoid additional fields in the stream header. Through the unified settings of the above file format and encoding parameters, the generated code stream structure is regular and the parameters are determined, facilitating recovery by the FPGA using a well-defined hardware path.

[0024] Furthermore, the setting methods for each hardware adaptation constraint and their effects on FPGA-side hardware recovery are as follows.

[0025] Fixed sliding window size: The sliding window size is fixed at 64KB (2¹) 6 Accordingly, the FPGA-side hardware recovery module uses a fixed-capacity historical cache for data recovery, eliminating the need to support dynamic adjustment of the cache capacity corresponding to the variable window, thereby reducing on-chip storage resource consumption and address control complexity.

[0026] Disabling static dictionary references: Static dictionary reference paths are not enabled during software coding, ensuring that the source of recovered data converges to recovered historical data. Therefore, the FPGA does not need to save or retrieve the contents of the Brotli built-in static dictionary (approximately 120KB in size), avoiding on-chip storage overhead and dictionary indexing logic.

[0027] Disabling literal context modeling: Literal context modeling is disabled during software encoding, ensuring that literal symbols are decoded using a single or limited Huffman code table. The FPGA-side decoding process eliminates the need for context mapping calculations and multiple code table switching, reducing decoding control complexity and decoding table storage capacity.

[0028] Constraining Compression Quality Level: By limiting the compression quality level to a lower range, the code length distribution and code table size of entropy coding are controlled. The decoder can be implemented on the FPGA side with fixed decoding table specifications (fixed number of entries, fixed upper limit of code length), avoiding reserving too much storage to support the large code table generated by high-level compression.

[0029] Fixed-range encoding parameters: Both the distance suffix bit parameter and the direct distance code parameter are set to preset fixed values, thus determining the bit width of the distance decoding and the size of the distance code alphabet. The FPGA side can implement the distance decoder with a fixed bit width and fixed table capacity, without needing to support decoding paths with variable suffix bits and variable direct distance codes.

[0030] After the above parameter settings and hardware adaptation constraints are applied, the software compression module outputs a compressed configuration file suitable for hardware recovery on the FPGA side. The compressed configuration file is organized in the Brotli bitstream format, including a stream header and one or more metablocks. Each metablock contains an uncompressed literal data block or a compressed data block. The compressed data block contains descriptors indicating block type, context mapping, Huffman code length, and other information, as well as entropy-encoded text data. Because the above hardware adaptation constraints are applied on the software side, the output bitstream does not need to support complex paths such as variable windows, static dictionary references, dynamic context modeling, and variable distance parameters during FPGA recovery. The recovery source, decoding path, and distance recovery method are all deterministic structures.

[0031] Regarding the FPGA hardware recovery process and module structure: (e.g.) Figure 3 As shown, the FPGA-side hardware recovery process includes: receiving the compressed configuration file; buffering the input data; performing bitstream parsing; parsing the header control information; constructing or reading the decoding table; decoding the compressed text; reconstructing historical data; and outputting the recovered configuration data. Specifically, after receiving the input bitstream corresponding to the compressed configuration file, the hardware recovery module first buffers the input data; then, it obtains the variable-length bit fields required for the recovery process through bitstream parsing; the header parsing process is used to extract the block length, block end marker, decoding table description information, and other recovery control information; the entropy decoding process is used to decode the compressed text data according to the decoding table; and the historical data reconstruction process recovers the original configuration data based on the literal information, command information, and distance information obtained from the decoding.

[0032] like Figure 4 As shown, the hardware recovery module includes a bitstream parsing unit, a header parsing unit, an entropy decoding unit, a historical data reconstruction unit, and an output unit. The bitstream parsing unit receives the compressed configuration file and provides variable-length bit read data; the header parsing unit parses the header control information in the compressed configuration file; the entropy decoding unit constructs or reads the decoding table and decodes the compressed text data; the historical data reconstruction unit performs literal writing, distance recovery, and historical data copying based on the decoding results; and the output unit outputs the recovered configuration data.

[0033] The specific implementation of each unit is as follows.

[0034] Bitstream parsing unit: The bitstream parsing unit receives compressed configuration files and provides variable-length bit read data. The input buffer is constructed using dual-port RAM or FIFO, receiving and temporarily storing the input bitstream byte-by-byte or word-by-word. The buffer level is managed by read and write pointers, and the data to be parsed is provided to the bit window. The bit window is constructed using a shift register (e.g., 64-bit), storing the currently parsed bit segment. The effective bit length of the bit window is recorded by a bit counter. Bit fetching control, based on the bit width requested by the subsequent unit (1-32 bit variable-length field), uses a barrel shifter to truncate a field of a specified length from the high bits of the bit window and outputs it, updating the bit counter after fetching. Bit window update: When the number of effective bits is insufficient, the next data word is read from the input buffer and shifted and concatenated to supplement the effective bits. This unit provides variable-length bit fields to the header parsing unit and entropy decoding unit at a deterministic pace, avoiding timing uncertainties caused by bit-by-bit loop judgments during software decoding, and facilitating the formation of a regular hardware pipeline.

[0035] Header Parsing Unit: The header parsing unit is used to parse the header control information in the compression configuration file. The specific fields parsed include three categories: stream header fields, meta-block header fields, and compressed meta-block data descriptor fields. Among them, the stream header fields include: ISLAST (1 bit), indicating whether it is the last meta-block; ISLASTEMPTY (2 bits), which, together with ISLAST, indicates an empty stream or the end of the stream; window order flag (1 bit) and dictionary flag (1 bit), indicating whether a large window order is used and whether a static dictionary is referenced. In this scheme, both of these two bits are 0; WBITS (6 bits), indicating the sliding window size (2^WBITS), which is fixed at 16 in this scheme, corresponding to a 64KB window. The block header fields include: ISLAST (1 bit) and ISLASTEMPTY (2 bits), indicating whether the block is the last block and whether it is an empty block; MNIBBLES (1 bit), indicating the number of nibbles used by MLEN for the block length; MLEN (4 × MNIBBLES bits), indicating the block length; UNUSED and MSKIPBYTES, indicating the number of bytes to be skipped before decompression and byte alignment information; and compression flag (2 bits), indicating whether the block is an uncompressed literal block or a compressed data block. The compressed metablock data descriptor fields include: a block type descriptor, used to recover block type switching information for literals, commands, and distance symbols, including the Huffman code length and block count code of the block type code; a context mapping descriptor, indicating the scale and transformation method of the literal context mapping, which is simplified to a single mapping in this scheme due to the disabling of context modeling; a Huffman code length descriptor, indicating the code length sequence, number of code trees, and code length encoding method of each Huffman code tree; and decoding table size information, which is used by the entropy decoding unit to determine the alphabet size and number of entries of each code table.

[0036] Entropy Decoding Unit: The entropy decoding unit is used to construct or read the decoding table and decode the compressed text data. The decoding table storage unit stores multiple types of Huffman decoding tables in RAM partitions, including literal code tables, command code tables (combinations of insertion length and copy length), distance code tables, block type code tables, and block count code tables. Each code table is allocated an independent RAM partition as needed, supporting read and write operations and avoiding access conflicts between multiple code tables. To support hardware parallel decoding, a two-level lookup table structure is adopted: the first-level table uses the high K bits of the code stream (e.g., 9 or 10 bits) as an index, and the table entries include a symbol field, a code length field, and a flag indicating whether a second-level table is needed; when the codeword length exceeds the width K bits of the first-level table, the second-level sub-table is entered based on the offset given by the first-level table, and the symbol and complete code length are retrieved using the remaining bits as an index. This reduces the decoding of Huffman codes up to 15 bits to 1-2 RAM lookups, ensuring a fixed decoding cycle and facilitating pipelined implementation. Each entry contains at least a symbol field (the symbol value to be decoded, such as a literal byte, command combination code, or distance code), a code length field (the current codeword width, used by the bitstream parsing unit to perform bit window shifting according to this width), and an index or flag field pointing to the secondary table. After header parsing is completed, the entropy decoding unit constructs a decoding table according to the code length sequence in the canonical Huffman method, that is, assigning canonical codewords to symbols in ascending order of code length, and in ascending order of symbols for the same code length, and generating two levels of lookup table contents, which are written to the RAM partition of the decoding table storage unit. In the text decoding stage, the entropy decoding unit cyclically retrieves bits from the bitstream parsing unit in the order of literal, command, and distance, looks up the table to obtain the symbol and code length, and outputs literal information, command information (insertion length, copy length), and distance information for use by the historical data reconstruction unit. Since this scheme disables context modeling and fixes the distance encoding parameters, the decoding process does not involve context mapping switching and variable distance parameter calculation, the number of code tables and switching paths are limited, and the control logic is significantly simplified.

[0037] Historical Data Reconstruction Unit: This unit performs literal writing, distance recovery, and historical data copying based on the decoding results. A circular buffer, constructed with a fixed capacity (e.g., 64KB) of dual-port RAM, serves as the storage space for recovered data. Write and read pointers are configured, and address wraparound logic is set to enable cyclic reading and writing. For literal information, the literal byte is written to the write pointer in the circular buffer and simultaneously output to the output unit, with the write pointer incrementing. For command information, the backtracking distance is recovered based on the distance information. Since this scheme fixes the distance encoding parameters, the distance decoding bit width is determined, and the distance recovery path is simple. The read pointer is calculated based on the backtracking distance (i.e., the write pointer minus the address corresponding to the backtracking distance). The recovered data is read from the circular buffer, and `len` bytes are copied back to the write pointer and output synchronously, completing the historical data copying and write-back. When the copy length exceeds the backtracking distance, the copy source and copy target areas overlap. A byte-by-byte or pipelining overlapping copying method is used to ensure that the source data is updated in real time during the copying process, guaranteeing the correct recovery of data in the overlapping area. This unit completes data recovery with a fixed-capacity historical cache, without the need to support variable windows or static dictionaries. It has low storage resource consumption and address control complexity, and can complete configuration data reconstruction with a regular hardware structure.

[0038] Output Unit: The output unit will restore the configuration data and send it to the cache space, external interface, or configuration data receiver.

[0039] To further illustrate the technical effects of the present invention, this embodiment provides quantitative verification data on compression ratio and hardware resource consumption.

[0040] In one implementation, lossless compression tests were conducted on various FPGA configuration files using both the constraints of this solution (Brotli encoding, 64KB window, static dictionary and context modeling disabled, fixed distance parameter) and general compression parameters (no hardware adaptation constraints applied, larger window, static dictionary and context modeling enabled). The compression ratios (compressed size / original size) were compared as follows: For an Artix-7 device, the original file size was 2,850,000 bytes; after compression using this solution, it was 893,000 bytes, a compression ratio of approximately 31.3%, while the general parameter compression ratio was approximately 27.5%. For another FPGA device, the original file size was 1,024,000 bytes; after compression using this solution, it was 296,000 bytes, a compression ratio of approximately 28.9%, while the general parameter compression ratio was approximately 25.6%. The tests show that this solution achieves a compression ratio of approximately 29%–32% for typical FPGA configuration files, meaning that it can reduce the amount of data stored and transmitted in the configuration file by more than two-thirds while maintaining lossless performance, significantly reducing off-chip storage capacity usage and configuration data transmission time.

[0041] In one implementation, the hardware recovery module of this invention is implemented using a medium-scale FPGA device (such as the Artix-7 series device). The resource usage after the comprehensive implementation is as follows: approximately 6,500 LUTs for bit stream parsing, header parsing, entropy decoding, and historical data reconstruction control logic; approximately 5,100 FFs (flip-flops) for pipeline registers, bit windows, pointers, and control states; approximately 28 BRAMs (36Kb), including approximately 15 circular buffers (64KB), approximately 8 decoding table storages, and approximately 5 input / output buffers; it does not occupy DSP resources; the operating frequency is approximately 200MHz, and the recovery throughput is approximately 1.6Gbps.

[0042] As can be seen from the above resource consumption, the on-chip resource overhead of the hardware recovery module described in this invention is mainly LUT and BRAM, and does not occupy DSP resources; among them, the fixed-capacity circular buffer and decoding table storage are the main sources of storage overhead. Compared with directly supporting the general Brotli complete recovery process on the FPGA side (which requires support for variable window buffer, static dictionary storage, context mapping and variable distance parameters, resulting in significantly higher resource consumption and logical complexity), this solution can complete the lossless recovery of configuration data with a smaller hardware cost. Furthermore, since the recovery throughput (approximately 1.6Gbps) is higher than the transmission rate of common configuration loading interfaces (such as SPI x4 / x8, SelectMAP, etc.), this solution can complete decompression and recovery in real time during configuration data transmission. The recovery process does not constitute a time bottleneck for configuration loading, making it suitable for application scenarios such as power-on startup, function updates, remote upgrades and dynamic reconfiguration.

[0043] In one implementation, to confirm the correctness of the recovery result, file length verification, digest verification, or byte-by-byte comparison can be used to verify the consistency between the recovered configuration data and the original FPGA configuration file, thereby verifying that the hardware recovery process can achieve lossless recovery.

[0044] In summary, this invention generates a well-structured and parameter-defined compressed configuration file on the software side through hardware adaptation constraints, and completes lossless recovery on the FPGA side through hardware units such as bitstream parsing, header parsing, entropy decoding, and historical data reconstruction. Compared with solutions that directly support the complete recovery process of a general compressed bitstream on the FPGA side, this invention reduces complex paths such as static dictionaries, context mapping, and variable distance parameters, thereby reducing on-chip storage usage and control logic complexity. Compared with solutions that only use simple compression methods, this invention retains the lossless compression capabilities of historical window matching and entropy encoding, achieving a higher compression ratio and more effectively reducing the storage and transmission overhead of the configuration file.

[0045] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.

Claims

1. A method for compressive storage and hardware recovery of FPGA configuration files, characterized in that, Includes the following steps: Step S1: Obtain the original FPGA configuration file; Step S2: Perform lossless compression processing on the original FPGA configuration file on the software side to generate a compressed configuration file suitable for FPGA hardware recovery. The lossless compression processing adopts a compression method based on historical window matching and entropy coding. Hardware adaptation constraints are applied during the compression process, and the hardware adaptation constraints include: fixed sliding window size, disabling static dictionary references, disabling literal context modeling, constraining compression quality level, and fixing distance coding related parameters. Step S3: Store the compressed configuration file in off-chip memory or send it to the FPGA via a data transmission path; Step S4: On the FPGA side, the compressed configuration file is decompressed and restored using a hardware recovery module to obtain restored configuration data. The decompression and restoration includes: caching and bitstream parsing the input compressed configuration file; parsing the header control information in the compressed configuration file; and constructing or reading a decoding table based on the header control information. The compressed text data is decoded to obtain literal information, command information, and distance information; historical data is reconstructed based on the literal information, command information, and distance information. Step S5: Output the recovery configuration data to the cache space, external interface, or configuration data receiving end.

2. The method of claim 1, wherein: The lossless compression process uses Brotli encoding, where the sliding window size is fixed at 64KB, and the distance encoding parameters include distance suffix bit parameters and direct distance code parameters, both of which are set to preset fixed values.

3. The compressed storage and hardware recovery method according to claim 1, characterized in that: The bitstream parsing includes: temporarily storing the input bitstream through an input buffer, using a shift register to form a bit window to store the current bit segment to be parsed, extracting a field of a specified length from the high bits of the bit window and outputting it according to the bit width requested by the subsequent unit through a barrel shifter, and reading the next data word from the input buffer and shifting and splicing it to supplement the valid bits when there are insufficient valid bits.

4. The method of claim 1, wherein: The header control information includes a stream header field, a meta-block header field, and a compressed meta-block data descriptor field; The stream header field includes at least a window order flag, a dictionary flag, and a window size indicator, wherein the window size indicator is fixed to a value corresponding to the sliding window size; and the meta block header field includes at least a meta block length and a compression flag. The compressed meta-block data descriptor field includes at least the block type descriptor, the context mapping descriptor, and the Huffman code length descriptor.

5. The method of claim 1, wherein: The construction or retrieval of the decoding table includes: storing multiple types of Huffman decoding tables using RAM partitioning, including literal code tables, command code tables, distance code tables, block type code tables, and block count code tables; employing a two-level lookup table structure, using the high-order bits of the code stream as an index to enter the first-level table, and when the codeword length exceeds the bit width of the first-level table, entering the second-level sub-table based on the offset given by the first-level table to retrieve the symbol and complete code length; each table entry contains at least a symbol field, a code length field, and an index or flag field pointing to the second-level table.

6. The method of claim 1, wherein: The historical data reconstruction in step S4 includes: using a fixed-capacity circular buffer to store the recovered data, configuring write pointers and read pointers, and setting address wraparound logic to achieve cyclic read and write; for literal information, writing the literal into the circular buffer and outputting it; for command information and distance information, recovering the backtracking distance based on the distance information, reading the recovered data from the circular buffer based on the backtracking distance, performing copy write-back and synchronous output; when the copy length is greater than the backtracking distance, using a byte-by-byte or pipelined overlapping copy method.

7. A compression storage and hardware recovery system for FPGA configuration files, characterized in that, It includes a hardware recovery module, which comprises a bitstream parsing unit, a header parsing unit, an entropy decoding unit, a historical data reconstruction unit, and an output unit; The bitstream parsing unit is used to receive compressed configuration files and provide variable-length bit read data; The header parsing unit is used to parse the header control information in the compressed configuration file; The entropy decoding unit is used to construct or read the decoding table and decode the compressed text data; The historical data reconstruction unit is used to perform literal writing, distance recovery, and historical data copying based on the decoding results; The output unit is used to output the restored configuration data.

8. The compressed storage and hardware recovery system of claim 7, wherein: The bitstream parsing unit includes an input buffer, a bit window, a bit counter, and a barrel shifter. The input buffer is constructed using a dual-port RAM or FIFO, receiving and temporarily storing the input bitstream byte by byte or word by word. The bit window is constructed using a shift register, storing the bit segment to be parsed, with the effective bit length recorded by the bit counter. The barrel shifter extracts a specified length of field from the high bits of the bit window according to the bit width requested by the subsequent unit, and updates the bit counter after extracting the bit. When the number of effective bits is insufficient, the bit window reads the next data word from the input buffer and performs shifting and concatenation to supplement the effective bits.