CN1299198C - Microcontroller architecture with increased code density due to changeable instruction format - Google Patents
Microcontroller architecture with increased code density due to changeable instruction format Download PDFInfo
- Publication number
- CN1299198C CN1299198C CNB011295694A CN01129569A CN1299198C CN 1299198 C CN1299198 C CN 1299198C CN B011295694 A CNB011295694 A CN B011295694A CN 01129569 A CN01129569 A CN 01129569A CN 1299198 C CN1299198 C CN 1299198C
- Authority
- CN
- China
- Prior art keywords
- instruction
- decoding
- group
- index
- prefix
- 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.)
- Expired - Fee Related
Links
- 230000000875 corresponding effect Effects 0.000 claims description 28
- 230000006835 compression Effects 0.000 claims description 21
- 238000007906 compression Methods 0.000 claims description 18
- 238000000034 method Methods 0.000 claims description 12
- 230000003139 buffering effect Effects 0.000 claims description 2
- 230000006837 decompression Effects 0.000 description 7
- 238000013461 design Methods 0.000 description 6
- 230000000694 effects Effects 0.000 description 5
- 238000012546 transfer Methods 0.000 description 5
- 230000008901 benefit Effects 0.000 description 4
- 238000005457 optimization Methods 0.000 description 4
- 238000012356 Product development Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000006073 displacement reaction Methods 0.000 description 3
- 239000000284 extract Substances 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000009471 action Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000003860 storage Methods 0.000 description 1
Images
Landscapes
- Executing Machine-Instructions (AREA)
Abstract
Description
技术领域technical field
本发明有关于嵌入式系统的微控制器结构,尤其指一种由可改变的指令格式而提高程序码密集度的微控制器结构。The present invention relates to the micro-controller structure of the embedded system, in particular to a micro-controller structure whose program code density is improved by a changeable instruction format.
背景技术Background technique
高整合度是嵌入式系统(Embedded System)中非常重要的特色之一,而伴随着嵌入式设备处理的功能日益增加,只读存储器(ROM)的容量亦随之增加。但较大容量的只读存储器已逐渐变成影响整体系统成本的主要因素,而且也可能是指令提取的瓶颈所在,因而进一步影响执行效能。High integration is one of the very important features of an embedded system (Embedded System), and as the functions processed by embedded devices increase day by day, the capacity of the read-only memory (ROM) also increases accordingly. However, larger ROMs have gradually become a major factor affecting overall system cost, and may also be a bottleneck for instruction fetching, thereby further affecting execution performance.
要解决此一问题,技术上所面临的挑战即是:在不牺牲系统功能性与执行效能的条件下,如何减少只读存储器的容量?目前已提出的解决方案可归纳成二类,:(1)提供原始指令集结构的精简版(Compact Subset of theOriginal ISA),及(2)采用指令区块导向的压缩方法(Instruction BlookOriented Compression Scheme)。To solve this problem, the technical challenge is: how to reduce the capacity of the ROM without sacrificing the system functionality and performance? The solutions proposed so far can be classified into two categories: (1) providing a compact version of the original instruction set structure (Compact Subset of the Original ISA), and (2) using the instruction block-oriented compression method (Instruction Blook Oriented Compression Scheme) .
前述第一种方案的典型代表为ARM Thumb与SGI MIPS16,它们分别为ARM与MIPS的精简版。此类方法较常用于原始指令集为32位元的指令长度,由减少每个栏位的位元数而达到16位元的指令长度,因此是原来指令集的精简版。以MIPS为例说明,MIPS的指令是32位元固定长度的指令格式,分成三类别:I类(Immediate)、J类(Jump)及R类(Register-to-Register)。以I类为例,如图1所示,它由运算码(Opcode)、来源暂存器(Source Register)、目标暂存器(Target Register)、及立即值(Immediate Value)栏位所构成。在某些预先规范的条件下,若缩小每个栏位的长度,即可得到相对应的I类16位元精简版(如图的MIPS16所示)。Typical representatives of the aforementioned first scheme are ARM Thumb and SGI MIPS16, which are simplified versions of ARM and MIPS respectively. This kind of method is more commonly used in the instruction length of the original instruction set of 32 bits, and the instruction length of 16 bits is achieved by reducing the number of bits in each field, so it is a simplified version of the original instruction set. Taking MIPS as an example, MIPS instructions are 32-bit fixed-length instruction formats, which are divided into three categories: I (Immediate), J (Jump), and R (Register-to-Register). Taking class I as an example, as shown in Figure 1, it consists of fields of operation code (Opcode), source register (Source Register), target register (Target Register), and immediate value (Immediate Value). Under certain pre-standard conditions, if the length of each field is reduced, the corresponding Type I 16-bit compact version (as shown in MIPS16 in the figure) can be obtained.
由此类似的方法,可以定义出MIPS精简版指令集MIPS16。因此,使用MIPS16表示的程序码会减少其长度。而在硬件方面,如图2所示,需额外加入MIPS16解压缩逻辑22,以将由指令快取存储器21中所提取的MIPS16的指令解压缩(还原)为MIPS指令,然后再馈入原来标准的MIPS管线23中加以执行。From this similar method, the MIPS compact version instruction set MIPS16 can be defined. Therefore, the program code expressed using MIPS16 will reduce its length. In terms of hardware, as shown in FIG. 2 , MIPS16 decompression logic 22 needs to be additionally added to decompress (restore) the MIPS16 instructions extracted in the instruction cache memory 21 into MIPS instructions, and then feed them into the original standard It is executed in MIPS pipeline 23.
前述方案有下列缺点:(1)通常精简版指令集不能单独存在,并须与原始的指令集结构共存,因而,降低了弹性。(2)因为是精简版也是子集合的缘故,所以会造成原始程序指令数的增加,降低压缩的效果。(3)硬件实作方面乃是通过解压缩逻辑的辅助而依序完成,所以可能影响原始的管线设计造成临界路径(Critical Path),进而降低执行速率。(4)没有针对不同的应用程序执行不同程度的压缩优化(Optimization),而提供订制(ustomization)的好处。The foregoing solution has the following disadvantages: (1) Usually, the simplified instruction set cannot exist alone, and must coexist with the original instruction set structure, thus reducing flexibility. (2) Because it is a simplified version and also a subset, it will increase the number of original program instructions and reduce the compression effect. (3) The hardware implementation is completed sequentially with the assistance of decompression logic, so it may affect the original pipeline design and cause a critical path (Critical Path), thereby reducing the execution speed. (4) Different degrees of compression optimization (Optimization) are not performed for different applications, but the benefits of customization (ustomization) are provided.
又,前述第二类方案的典型代表为IBM CodePack与Wolfe CCRP(Compressed Code RISC Processor)。此方案通常为了达到执行时期解压缩的有效性,大多数乃采用修正的赫夫曼(Huffman)编码作为压缩的演算法,把指令快取列(Instruction Cache Line)作为压缩单位,将压缩后的程序储存在主存储器中,而指令快取存储器乃存放解压缩后的指令。In addition, typical representatives of the aforementioned second type of solutions are IBM CodePack and Wolfe CCRP (Compressed Code RISC Processor). In order to achieve the effectiveness of decompression during execution, most of this scheme uses modified Huffman coding as the compression algorithm, uses the Instruction Cache Line as the compression unit, and compresses the compressed Programs are stored in main memory, while instruction cache stores decompressed instructions.
以CCRP为例,图3显示了CCRP中存储器系统的组织结构。如上所述,指令存储器31(Instruction Memory)储存了压缩后的程序码,而指令快取存储器32(Instruction Cache)则存放未压缩的指令;另外,快取存储器回填引擎33(Cache Refill Engine)则负责指令解压缩的动作。程序执行时,若发生快取存储器存取击中(Cache Hit)时则中央处理单元34(CPU)乃直接提取此未压缩的指令列加以执行。但是,当发生快取存储器存取未击中(Cache Miss)时,快取存储器回填引擎33会从指令存储器31中提取压缩后的指令,执行解压缩,再将解压缩后的指令存入指令快取存储器33中,然后CPU34再从指令快取存储器32中提取刚存入的指令继续执行。Taking CCRP as an example, Figure 3 shows the organizational structure of the memory system in CCRP. As mentioned above, the instruction memory 31 (Instruction Memory) stores the compressed program code, while the instruction cache memory 32 (Instruction Cache) stores uncompressed instructions; in addition, the cache memory backfill engine 33 (Cache Refill Engine) then Responsible for the action of instruction decompression. When the program is executed, if a cache hit (Cache Hit) occurs, the central processing unit 34 (CPU) directly fetches the uncompressed instruction sequence for execution. However, when a cache memory access miss (Cache Miss) occurs, the cache memory backfill engine 33 will extract the compressed instruction from the instruction memory 31, perform decompression, and then store the decompressed instruction into the instruction In the cache memory 33, then the CPU 34 extracts the instruction just stored from the instruction cache memory 32 to continue execution.
另,此存储器系统并采用了行位址表311(Line Address Table,LAT)与快取行位址缓冲器35(Cache Line Address Lookaside Buffer,CLB)。此行位址表311乃是在压缩阶段时由压缩软件工具所产生,用以映对未压缩指令区块的位址至压缩后的指令区块的位址,以便解决控制转移(ControlTransfer)指令所造成分歧目的位址(Branch Target Address)不一致的问题。而快取行位址绘冲器35则是辅助行位址表311的使用,减少快取存储器存取未击中时指令回填所需的时间。In addition, the memory system also uses a line address table 311 (Line Address Table, LAT) and a cache line address buffer 35 (Cache Line Address Lookaside Buffer, CLB). The row address table 311 is generated by the compression software tool during the compression stage, and is used to map the address of the uncompressed instruction block to the address of the compressed instruction block, so as to solve the control transfer (ControlTransfer) instruction The problem caused by the inconsistency of the branch target address (Branch Target Address). The cache line address mapper 35 is used to assist the use of the line address table 311 to reduce the time required for instruction backfill when the cache memory access misses.
前述方案则有下列的缺点:(1)当指令区块大小递减时,LAT储存表格的额外负担就会递增。(2)在微控制器(Microcontroller)或较低阶的嵌入式应用中,并没有指令快取存储器的存在,所以此方法不适用于这些系统。(3)没有针对不同的应用程序执行不同程度的压缩优化,而提供订制(Customization)的好处。The foregoing solution has the following disadvantages: (1) When the size of the command block decreases, the additional burden of the LAT storage table increases. (2) In the microcontroller (Microcontroller) or lower-level embedded applications, there is no instruction cache memory, so this method is not suitable for these systems. (3) Different degrees of compression optimization are not performed for different applications, but the benefits of customization are provided.
由是可知,前述用以减少程序码的大小的已知技术仍有诸多失,而无法满足实际需要,因而仍有予以改进的必要。Therefore, it can be seen that the aforementioned known techniques for reducing the size of the program code still have many shortcomings, and cannot meet the actual needs, so there is still a need for improvement.
发明内容Contents of the invention
本发明的目的在于提供一种由可改变的指令格式而提高程序码密集度的微控制器结构,以通过指令压缩的方式,在不牺牲系统功能性与执行效能的条件下,降低只读存储器容量的需求,进而减少整体系统的成本。The purpose of the present invention is to provide a micro-controller structure with a changeable instruction format to increase the density of the program code, and to reduce the read-only memory by compressing the instruction without sacrificing the system functionality and execution performance. Capacity requirements, thereby reducing the overall system cost.
为达到前述目的,本发明的微控制器结构包括:To achieve the aforementioned object, the microcontroller structure of the present invention includes:
一存储器,储存有压缩后的指令,其中,每一压缩的指令由一群组字首附加至少一索引所构成;A memory storing compressed instructions, wherein each compressed instruction is composed of a group prefix and at least one index;
一压缩指令缓冲器,用以将自存储器所提取的指令予以存放缓冲;a compressed instruction buffer for storing and buffering instructions fetched from the memory;
一下个位址逻辑,依据微控制器的目前状态以决定是否自存储器提取指令,或是直接将压缩指令缓冲器的下一个指令送出;以及The next address logic, according to the current state of the microcontroller, decides whether to fetch the instruction from the memory, or directly send the next instruction in the compressed instruction buffer; and
一指令解压缩器,用以将由该压缩指令缓冲器所送出的目前压缩指令加以解压缩成原始指令格式;an instruction decompressor for decompressing the current compressed instruction sent from the compressed instruction buffer into an original instruction format;
其中,该指令解压缩器具有复数个指令群解码表,每一指令群解码表储存有预定类型的原始指令,该指令解压缩器依据该压缩指令的群组字首而选择一指令群解码表,并以该压缩指令的索引来搜寻取出该指令群解码表的相对应原始指令。Wherein, the instruction decompressor has a plurality of instruction group decoding tables, each instruction group decoding table stores a predetermined type of original instruction, and the instruction decompressor selects an instruction group decoding table according to the group prefix of the compressed instruction , and use the index of the compressed instruction to search and retrieve the corresponding original instruction from the instruction group decoding table.
其包含一解码与执行单元,以将解压缩的指令解码成硬件控制讯号,以操控执行核心执行相应的动作。It includes a decoding and execution unit to decode decompressed instructions into hardware control signals to control the execution core to perform corresponding actions.
该指令解码器包括一指令群萃取器及一多工器,该指令群萃取器用以将由该压缩指令缓冲器所送出的目前压缩指令加以分解,以依据压缩指令的群组字首来控制该多工器,选择一指令群解码表,并以压缩指令的索引来搜寻取出该指令群解码表中相对应的原始指令,而由该多工器输出至该解码器与执行单元以执行。The command decoder includes a command group extractor and a multiplexer, the command group extractor is used to decompose the current compressed command sent from the compressed command buffer, so as to control the multiplex according to the group prefix of the compressed command The multiplexer selects an instruction group decoding table, and uses the index of the compressed instruction to search for the corresponding original instruction in the instruction group decoding table, and outputs the multiplexer to the decoder and execution unit for execution.
该存储器为一只读存储器。This memory is a read-only memory.
该存储器所储存的压缩指令由一第一群组字首附加一指令索引所构成,该指令索引值用于搜寻一第一指令群解码表,而该第一指令群解码表存放有对应的原始指令。The compressed instructions stored in the memory are formed by adding an instruction index to a first group prefix, and the instruction index value is used to search a first instruction group decoding table, and the first instruction group decoding table stores the corresponding original instruction.
该存储器所储存的压缩指令由一第二群组字首附加一表示分歧条件码的运算码索引及一表示分歧目的位址的位移索引所构成,该运算码索引及该位移索引分别用以搜寻一第二指令群解码表的第一及第二解码子表,该第一解码子表存放有对应的原始指令的分歧条件码,该第二解码子表存放有对应的原始指令的分歧目的位址。The compressed instruction stored in the memory is composed of a second group prefix plus an operation code index representing the branch condition code and a displacement index representing the branch destination address, and the operation code index and the displacement index are respectively used for searching The first and second decoding sub-tables of a second instruction group decoding table, the first decoding sub-table stores the branch condition code of the corresponding original instruction, and the second decoding sub-table stores the branch destination bit of the corresponding original instruction site.
该存储器所储存的压缩指令由一第三群组字首附加一表示运算码的运算码索引及一表示立即值的立即索引,该运算码索引及该立即索引分别用以搜寻一第三指令群解码表的第三及第四解码子表,该第三解码子表存放有对应的原始指令的运算码,该第四解码子表存放有对应的原始指令的立即值。The compressed instructions stored in the memory are appended with an operation code index representing an operation code and an immediate index representing an immediate value by a third group prefix, and the operation code index and the immediate index are respectively used to search a third instruction group The third and fourth decoding sub-tables of the decoding table, the third decoding sub-table stores the operation code of the corresponding original instruction, and the fourth decoding sub-table stores the corresponding immediate value of the original instruction.
该存储器中亦储存有一第四群组字首附加原始指令的程序码。The memory also stores a program code of a fourth group prefix appending original instructions.
该群组字首为固定长度。The group prefix is of fixed length.
该存储器中出现频率较高的指令具有较短的群组字首。Instructions that occur more frequently in this memory have shorter group prefixes.
附图说明Description of drawings
下面以较佳实施例并结合附图对本发明作详细说明,其中:Below with preferred embodiment and in conjunction with accompanying drawing, the present invention is described in detail, wherein:
图1显示已知MIPS及MIPS16指令的映对关系;Figure 1 shows the mapping relationship between known MIPS and MIPS16 instructions;
图2概略显示已知MIPS16系统的硬件结构;Fig. 2 schematically shows the hardware structure of the known MIPS16 system;
图3概略显示已知CCRP的存储器系统结构;Fig. 3 schematically shows the memory system structure of known CCRP;
图4显示以使用本发明的微控制器结构来提供嵌入式系统设计的解决方案;Figure 4 shows a solution to provide embedded system design using the microcontroller architecture of the present invention;
图5显示依据本发明的订制指令与解码表格间的关系;Fig. 5 shows the relationship between the customized instruction and the decoding table according to the present invention;
图6显示本发明的微控制器结构的方块图;Fig. 6 shows the block diagram of microcontroller structure of the present invention;
图7显示本发明的微控制器结构中的指令解压缩器的方块图。FIG. 7 shows a block diagram of the instruction decompressor in the microcontroller architecture of the present invention.
具体实施方式Detailed ways
有关本发明的由可改变的指令格式而提高程序码密集度的微控制器结构的一较佳实施例,请先参照图4所示以使用的结构来提供嵌入式系统设计的解决方案,其设计基于以下特性:Regarding a preferred embodiment of the structure of the micro-controller that improves the program code density by the changeable instruction format of the present invention, please refer to the structure shown in FIG. 4 to provide a solution for embedded system design. The design is based on the following properties:
(1)嵌入式系统中,应用程序的特定功能且不随时改变,亦即,在产品开发阶段,程序的规格与特性大致已固定。(1) In an embedded system, the specific functions of the application program do not change at any time, that is, in the product development stage, the specifications and characteristics of the program are roughly fixed.
(2)一般而言,不论是组合语言程序码或是编译器产生的程序码均趋向仅使用所有可用指令中的少量指令。(2) In general, both assembly language code and compiler-generated code tend to use only a small number of all available instructions.
因此,如图4所示,在程序开发阶段(Coding Phase),前述的方案如传统方式一般,依然可用组合语言或高阶语言(例如:C)撰写应用程序,而得到原始指令集(未压缩)所构成的执行档43。接着,在编码(压缩)阶段(Encoding Phase),可通过压缩软件工具(例如:Profiler、Translator)的辅助而得到订制指令集46(压缩)所构成的执行档44,以及可供解码的资讯45,以进一步用于微控制器结构41的硬件设计。Therefore, as shown in Figure 4, in the program development phase (Coding Phase), the aforementioned scheme is the same as the traditional method, and the application program can still be written in an assembly language or a high-level language (for example: C), and the original instruction set (uncompressed ) constitutes the execution file 43. Then, in the encoding (compression) stage (Encoding Phase), the executable file 44 formed by the custom instruction set 46 (compression) and the information available for decoding can be obtained with the assistance of compression software tools (such as: Profiler, Translator). 45, to be further used in the hardware design of the microcontroller structure 41.
前述订制的指令集46可以依据原始指令的特色(例如:出现频率与指令格式)加以归类成不同的指令群(Instruction Group),然后以更精简的方式表示,而达到指令压缩的效果。例如:以较少的位元数表示较常出现的指令,而此新的订制指令即代表某一表格的索引值;而微控制器结构41即可利用表格查询(Table Lookup)方式对应出原来的指令或直接解码出控制讯号。The above-mentioned customized instruction set 46 can be classified into different instruction groups (Instruction Group) according to the characteristics of the original instructions (such as frequency of occurrence and instruction format), and then expressed in a more compact manner to achieve the effect of instruction compression. For example: use less number of bits to represent more frequently occurring instructions, and this new customized instruction represents the index value of a certain table; and the micro-controller structure 41 can use the table lookup (Table Lookup) method to correspond to The original command or directly decode the control signal.
图5显示了前述订制指令与可供解码的资讯的解码表格间的关系的一范例。在此范例中,系假设将原来指令归类成四种指令群组:FIG. 5 shows an example of the relationship between the aforementioned custom command and the decoding table of the information available for decoding. In this example, it is assumed that the original commands are grouped into four command groups:
G1:R-Group(Instruction without Immediate),此指令群通常为由最简单的指令所构成,它不是控制转移的指令,也不是含有立即值的指令。G1: R-Group (Instruction without Immediate), this instruction group is usually composed of the simplest instructions, it is not an instruction of control transfer, nor an instruction containing immediate value.
G2:C-Group(Control Transfer),此类型指含有控制转移的指令,通常它也含有分歧目的的位址栏位。G2: C-Group (Control Transfer), this type refers to the command that contains control transfer, and usually it also contains address fields with different purposes.
G3:I-Group(Instruction with Immediate),此类型指令为含有立即值的指令,但不是控制转移指令。G3: I-Group (Instruction with Immediate), this type of instruction is an instruction with immediate value, but not a control transfer instruction.
G4:M-Group(Miscellaneous Instruction),此类型是指未归类的指令。G4: M-Group (Miscellaneous Instruction), this type refers to unclassified instructions.
对于G1类型的指令,其对应的订制指令由群组字首(Group Prefix)GI附加一指令索引(Instruction Index)栏位所构成,其中,该指令索引值用于搜寻对应GI指令群解码表51,而该GI指令群解码表51即存放有对应的原始指令。For G1-type instructions, the corresponding customized instructions are formed by adding an instruction index (Instruction Index) field to the Group Prefix GI, where the instruction index value is used to search the corresponding GI instruction group decoding table 51, and the corresponding original instructions are stored in the GI instruction group decoding table 51.
对于G2类型的指令,其对应的订制指令由群组字首G2附加一表示分歧条件码的运算码索引(Opcode Index)及一表示分歧目的位址的位移索引(Displacement Index)栏位所构成,而此二个索引值是分别用于搜寻G2指令群解码表52的两个不同的解码子表521及522,而该解码子表521即存放有对应的原始指令的分歧目的位址。由此,可映对出不同的资讯而构成完整的指令解码。For the G2 type instruction, the corresponding customized instruction is composed of the group prefix G2 with an Opcode Index representing the divergent condition code and a Displacement Index field representing the divergent destination address. , and these two index values are respectively used to search two different decoding sub-tables 521 and 522 of the G2 instruction group decoding table 52, and the decoding sub-table 521 stores the branch destination address of the corresponding original instruction. Thus, different information can be mapped to form a complete instruction decoding.
对于G3类型的指令,其对应的订制指令由群组字首G3附加一表示运算码的运算码索引(Opcode Index)及一表示立即值的立即索引(Immediate Index),而此二个索引值是分别用于搜寻G3指令群解码表53的两个不同的解码子表531及532,而该解码子表531即存放有对应的原始指令的运算码,该解码子表532存放有对应的原始指令的立即值。由此,可映对出不同的资讯而构成完整的指令解码。For the G3 type instruction, the corresponding customized instruction is added with an operation code index (Opcode Index) representing the operation code and an immediate index (Immediate Index) representing the immediate value by the group prefix G3, and the two index values They are two different decoding sub-tables 531 and 532 for searching the G3 instruction group decoding table 53 respectively, and the decoding sub-table 531 stores the operation code of the corresponding original instruction, and the decoding sub-table 532 stores the corresponding original The immediate value of the instruction. Thus, different information can be mapped to form a complete instruction decoding.
而G4类型的指令是属于没有压缩的指令,所以,此类型不需用解码表解压缩成原来的指令格式,而是用原来的方式加以解码,因此,其对应的订制指令由群组字首G4附加原始的指令(Original Instruction)。The G4 type of instruction belongs to the instruction without compression, so this type does not need to be decompressed into the original instruction format with the decoding table, but decoded in the original way. Therefore, the corresponding customized instruction is determined by the group word The first G4 appends the original instruction (Original Instruction).
前述群组字首G1-G4可为固定长度(例如2位元),亦可为可变长度的编码,例如依据赫夫曼(Huffman)编码而将较短的码赋予给出现频率较高的类型的指令的群组字首。The aforementioned group prefixes G1-G4 can be of fixed length (for example, 2 bits), or can be codes of variable length, such as assigning shorter codes to those with higher frequency of occurrence according to Huffman coding. Group prefix for commands of type .
前述所归纳的G1-G4指令群仅为一示例,在实际应用时,可以依据应用程序的特性与硬件实作考量,配合着Profiling资讯,再加以明确定义,定义指令群的分类方式与总数、群组字首的格式与长度、及订制指令的长度等选项,以依据应用程序的不同做优化处理,达到订制(Customization)的效果。而其中显而易见的限制就是,大部分订制指令的指令长度必须小于原始指令的长度,如此才会达到指令压缩的效果。The G1-G4 instruction group summarized above is just an example. In actual application, it can be clearly defined according to the characteristics of the application program and hardware implementation considerations, combined with the Profiling information, to define the classification method and total number of instruction groups, Options such as the format and length of the group prefix, and the length of the custom command can be optimized according to different applications to achieve the effect of customization. The obvious limitation is that the instruction length of most customized instructions must be smaller than the length of the original instruction, so as to achieve the effect of instruction compression.
经压缩后的订制指令由本发明的微控制器结构41所执行,图6即显示了本发明的微控制器结构41的方块图,其包括有一存储器61、一压缩指令缓冲器62、一下个位址逻辑63、一指令解压缩器64、及一解码与执行单元65,其中,该存储器61用以储存压缩后的程序码,由于嵌入式系统的程序码不需要修改,所以该存储器61较佳地为一只读存储器(ROM)。The customized order after the compression is carried out by microcontroller structure 41 of the present invention, and Fig. 6 promptly has shown the block diagram of microcontroller structure 41 of the present invention, and it comprises a
该压缩指令缓冲器62供微控制顺在提取指令时,将自存储器61所提取的区块的内容予以存放缓冲。而由于订制指令的指令长度小于原始指令的长度,因此,该压缩指令缓冲器62可能内含数个压缩的指令。The compressed
该下个位址逻辑63的功能是依据微控制器的目前状态而决定是否要去存储器61提取指令,或是直接将压缩指令缓冲器62的下一个指令送出。The function of the
该指令解压缩器64用以将该压缩指令缓冲器62送出的目前压缩指令加以解压缩(还原)成原始指令格式,然后再进一步馈入该解码与执行单元65,由控制讯号解码器651解出硬件控制讯号,以操控执行核心652执行相应的动作,其中,该控制讯号解码器651与执行核心652为一般微控制器所既有,故在此不再详述其结构。The
而由前述下个位址逻辑63及解压缩指令缓冲器62的使用,微控制器可正确地提取所要执行的指令,其运作方式由如下步骤所示:And by the use of the aforementioned
(1)该下个位址逻辑63依据目前微控制器的内部状态,而得知下一个要存取的指令位址为何。(1) The
(2)该压缩指令缓冲器62将内含指令个数等资讯告诉下个位址逻辑63,以便决定即将要执行的指令是否存在于该压缩指令缓冲器62中。(2) The compressed
(3)若不存在于压缩指令缓冲器62,则下个位址逻辑63会将要存取的指令位址送出,以由该存储器61进行下一笔指令提取动作。然后跳至步骤(5)执行。(3) If it does not exist in the compressed
(4)若存在于压缩指令缓冲器62,则该压缩指令缓冲器62由提取的指令区块中选取正确的指令,并馈入指令压缩器64进行解压缩的动作。然后跳至步骤(1)执行。(4) If it exists in the compressed
(5)将由存储器61提取区块的内容存入该压缩指令缓冲器62内部的缓冲器,并加以对齐(Alignment)。(5) Store the content of the block extracted from the
(6)依据指令群组字首加以决定压缩指令的长度。(6) Determine the length of the compressed command according to the prefix of the command group.
(7)如此,该压缩指令缓冲器62即可知道此指令区块内含多少个压缩的命令,以及每个压缩指令的边界。将上述相关的资讯,通过控制讯号告知下个位址逻辑63。(7) In this way, the compressed
经前述所提取的压缩指令再由该指令解压缩器64将其解压缩成原始指令,图7显示该指令解压缩器64的方块图,其包括一指令群萃取器641、复数个指令群解码表50、及一多工器643,其中,该指令群萃取器641用以将由该压缩指令缓冲器62所送出的目前压缩指令加以分解,以依据压缩指令的群组字首的内容来控制该多工器643,选择一指令群解码表50,并以压缩指令的索引栏位的值来搜寻取出该指令群解码表50中相对应的原始指令,而由该多工器643输出至该解码与执行单元65执行。The extracted compressed instructions are then decompressed into original instructions by the
又前述指令群解码表50的资讯可通过压缩软件工具Translator的辅助加以获得,而且这些表格可利用可程序逻辑阵列(PLA)实作,在产品量产阶段再加以程序化(Programming)。此外,由于本发明在订制新指令时,已依据指令特性加以分类,所以对这些解码表而言,并不会造成单一个大表格,而是由一些小表格所构成。基于此特性,通过表格查询方式完成的解压缩动作并不会造成硬件的冲击,亦不致产生很长的存取时间。In addition, the information of the aforementioned instruction group decoding table 50 can be obtained with the assistance of the compression software tool Translator, and these tables can be implemented using a Programmable Logic Array (PLA), and then programmed in the mass production stage. In addition, since the present invention has classified according to the characteristics of the instructions when ordering new instructions, these decoding tables do not form a single large table, but are composed of some small tables. Based on this feature, the decompression action completed by table query will not cause impact on the hardware, nor will it cause a long access time.
由以上说明可知,本发明可由在产品开发时期分析收集应用程序的原始指令码特性,而重新订制指令集结构,以减少程序码的大小,而新的指令即代表某一表格的索引值,解码电路可利用表格查询方式对应出原来的指令,因此,相较于已知技术,本发明确具有以下优点:As can be seen from the above description, the present invention can re-order the structure of the instruction set by analyzing and collecting the original instruction code characteristics of the application program during the product development period, so as to reduce the size of the program code, and the new instruction represents the index value of a certain table. The decoding circuit can use the table query method to correspond to the original instruction. Therefore, compared with the known technology, the present invention has the following advantages:
(1)使用可改变的指令格式,以一对一的指令层次压缩方式,故适用于较低阶的嵌入式系统中(例如:微控制器的应用)。(1) Using a changeable instruction format and one-to-one instruction level compression, it is suitable for lower-level embedded systems (for example: the application of microcontrollers).
(2)针对不同的嵌入式应用程序的需求,以订制式指令集结构加以优化且压缩原始各序,进而提供订制的好处。(2) According to the requirements of different embedded applications, the customized instruction set structure is used to optimize and compress the original sequences, thereby providing customized benefits.
(3)优化且压缩的结果可获得较高的程序码密集度(Code Density)及较少的程序码,进而降低只读存储器容量的需求。(3) The result of optimization and compression can obtain higher program code density (Code Density) and less program code, thereby reducing the demand for ROM capacity.
(4)因为提高了程序码密集度,增加了指令提取利用率,所以降低了存储器总线流量(Memory Bus Traffic),进而减少了整体系统的功率消耗。(4) Because the program code density is improved and the instruction extraction utilization rate is increased, the memory bus traffic (Memory Bus Traffic) is reduced, thereby reducing the power consumption of the overall system.
(5)在产品开发阶段采用软硬件协同设计(Software/HardwareCodesign),因而提高了成本有效性(Cost-Effective)。(5) In the product development stage, software and hardware collaborative design (Software/HardwareCodesign) is adopted, thus improving the cost effectiveness (Cost-Effective).
综上所述,本发明无益就目的、手段及功效,均显示其不同于已知技术,应说明的是,上述诸多实施例仅为了便于说明而举例而已,本发明所主张的权利范围自应以申请专利范围所述为准,而非仅限于上述实施例。In summary, the present invention shows that it is different from the known technology in terms of purpose, means and effect. It should be noted that the above-mentioned embodiments are only examples for ease of description, and the scope of rights claimed by the present invention should be The scope of the patent application shall prevail, rather than being limited to the above-mentioned embodiments.
Claims (9)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB011295694A CN1299198C (en) | 2001-06-27 | 2001-06-27 | Microcontroller architecture with increased code density due to changeable instruction format |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB011295694A CN1299198C (en) | 2001-06-27 | 2001-06-27 | Microcontroller architecture with increased code density due to changeable instruction format |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN1393767A CN1393767A (en) | 2003-01-29 |
| CN1299198C true CN1299198C (en) | 2007-02-07 |
Family
ID=4669276
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CNB011295694A Expired - Fee Related CN1299198C (en) | 2001-06-27 | 2001-06-27 | Microcontroller architecture with increased code density due to changeable instruction format |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN1299198C (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9201652B2 (en) | 2011-05-03 | 2015-12-01 | Qualcomm Incorporated | Methods and apparatus for storage and translation of entropy encoded software embedded within a memory hierarchy |
| JP6179093B2 (en) * | 2012-12-03 | 2017-08-16 | 富士通株式会社 | Arithmetic processing device and arithmetic processing method |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1174352A (en) * | 1996-08-19 | 1998-02-25 | 现代电子美国公司 | Non-volatile memory with embedded programmable controller |
| CN1244675A (en) * | 1998-03-31 | 2000-02-16 | 英特尔公司 | Execute partial width packed data instructions |
| JP2001043082A (en) * | 1999-07-30 | 2001-02-16 | Nec Corp | Information processor and method for coding and decoding instruction |
| US6195743B1 (en) * | 1999-01-29 | 2001-02-27 | International Business Machines Corporation | Method and system for compressing reduced instruction set computer (RISC) executable code through instruction set expansion |
-
2001
- 2001-06-27 CN CNB011295694A patent/CN1299198C/en not_active Expired - Fee Related
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1174352A (en) * | 1996-08-19 | 1998-02-25 | 现代电子美国公司 | Non-volatile memory with embedded programmable controller |
| CN1244675A (en) * | 1998-03-31 | 2000-02-16 | 英特尔公司 | Execute partial width packed data instructions |
| US6195743B1 (en) * | 1999-01-29 | 2001-02-27 | International Business Machines Corporation | Method and system for compressing reduced instruction set computer (RISC) executable code through instruction set expansion |
| JP2001043082A (en) * | 1999-07-30 | 2001-02-16 | Nec Corp | Information processor and method for coding and decoding instruction |
Also Published As
| Publication number | Publication date |
|---|---|
| CN1393767A (en) | 2003-01-29 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN104331269B (en) | A kind of embedded system executable code compression method and code decompression compression system | |
| Moffat et al. | On the implementation of minimum redundancy prefix codes | |
| US6145069A (en) | Parallel decompression and compression system and method for improving storage density and access speed for non-volatile memory and embedded memory devices | |
| Kozuch et al. | Compression of embedded system programs | |
| Lekatsas et al. | SAMC: A code compression algorithm for embedded processors | |
| JP2534465B2 (en) | Data compression apparatus and method | |
| CN103582871B (en) | Method and apparatus for storage and translation of entropy-encoded software embedded within a memory hierarchy | |
| US6263429B1 (en) | Dynamic microcode for embedded processors | |
| WO2018005342A1 (en) | Optimized selection of hash collision chains | |
| CN1326132A (en) | Processor with compressed instructions and compress method thereof | |
| MX2008014048A (en) | Pre-decoding variable length instructions. | |
| JPH0869370A (en) | Method and system for compression of data | |
| JP2007234048A (en) | Program code compression method for allowing rapid prototyping of code compression technology and program code compression system | |
| CN106233632A (en) | Ozip compression and decompression | |
| CN103748550B (en) | Method and apparatus for storing and translating sequences of entropy-encoded instructions into executable form | |
| JP2003218703A (en) | Data coder and data decoder | |
| US20020199083A1 (en) | High code-density microcontroller architecture with changeable instruction formats | |
| Qiao et al. | An FPGA-based BWT accelerator for Bzip2 data compression | |
| CN1299198C (en) | Microcontroller architecture with increased code density due to changeable instruction format | |
| Xie et al. | Profile-driven selective code compression [embedded systems] | |
| CN1335958A (en) | Variable-instruction-length processing | |
| US7676651B2 (en) | Micro controller for decompressing and compressing variable length codes via a compressed code dictionary | |
| KR20220091361A (en) | Method and apparatus for efficient deflate decompression using content-addressable data structures | |
| Pibiri et al. | Inverted index compression | |
| Das et al. | Dictionary based code compression for variable length instruction encodings |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20070207 Termination date: 20140627 |
|
| EXPY | Termination of patent right or utility model |