Microcontroller Code Decompression Engine for Random Access Branching
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing decompression methods for executable code require significant memory overhead due to the use of look-up tables and indeterminate or non-converging offset values, especially when handling branch instructions, which complicates efficient execution and storage.
Innovation Solution
A decompression engine that utilizes a dictionary part and a compressed code part with segments containing mask types, locations, and patterns, along with an index to the dictionary, allowing for efficient decompression by applying masks using exclusive OR operations to form corrected instruction values, and adjusts branch instructions with offset values to ensure accurate address retrieval.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If the entire compressed file is decompressed into RAM, then random access to instructions is enabled, but RAM size must be four times the size of flash memory
Solution Approach 1:
The decompression process is segmented into two parts: a decompression engine that remains in RAM and a compressed code storage in flash memory. This allows random access to be performed on the small decompression engine while the large compressed code remains in flash, avoiding the need to load entire compressed files into RAM.
Solution Approach 2:
A decompression engine acts as an intermediary between the compressed code in flash memory and the CPU. This intermediary component enables random access operations without requiring the entire codebase to be present in RAM, as it can dynamically decompress and deliver instructions on demand.
2Reliability
If look-up tables and indeterminate offset values are used for decompression, then branch instructions can be handled, but memory overhead increases significantly
Solution Approach 1:
The patent extracts the branch handling capability from large look-up tables and concentrates it into a small, deterministic decompression engine. This engine uses a compact representation of branch offsets that can be stored in flash memory alongside the compressed code, eliminating the need for large RAM-based look-up tables.
Solution Approach 2:
The patent changes the representation parameters of branch offsets from indeterminate values requiring large tables to deterministic values that can be compactly encoded. By modifying how branch information is stored and processed, the system achieves reliable branch handling with minimal memory overhead.
3Quantity of substance
If variable length bit patterns are used for compression, then compression ratio is improved, but random access to specific instructions becomes impossible
Solution Approach 1:
The system dynamically adapts between compressed and uncompressed representations based on access patterns. The decompression engine maintains the compressed code in flash memory for space efficiency while dynamically decompressing only the specific instructions needed for execution, enabling both high compression ratios and random access capability.
Data Source
AI summary
A code decompression engine reads compressed code from a memory containing a series of code parts and a dictionary part. The code parts each have a bit indicating compressed or uncompressed. When the code part is compressed, it has a value indicating the number of segments, followed by the segments, followed by an index into the dictionary part. The decompressed instruction is the dictionary value specified by the index, which is modified by the segments. Each segment describes the modification to the dictionary part specified by the index by a mask type, a mask offset, and a mask.


