CN110647234B - Instruction processing method and electronic equipment - Google Patents

Instruction processing method and electronic equipment Download PDF

Info

Publication number
CN110647234B
CN110647234B CN201910926855.XA CN201910926855A CN110647234B CN 110647234 B CN110647234 B CN 110647234B CN 201910926855 A CN201910926855 A CN 201910926855A CN 110647234 B CN110647234 B CN 110647234B
Authority
CN
China
Prior art keywords
instruction
characters
instructions
character
condition
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
CN201910926855.XA
Other languages
Chinese (zh)
Other versions
CN110647234A (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.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing 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 Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CN201910926855.XA priority Critical patent/CN110647234B/en
Publication of CN110647234A publication Critical patent/CN110647234A/en
Application granted granted Critical
Publication of CN110647234B publication Critical patent/CN110647234B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/3017Runtime instruction translation, e.g. macros
    • G06F9/30178Runtime instruction translation, e.g. macros of compressed or encrypted instructions

Abstract

The application discloses an instruction processing method and electronic equipment, wherein the method comprises the following steps: screening a first instruction from an instruction set according to a first condition, wherein the electronic equipment has first working power consumption when running by adopting the first instruction; performing first processing on the first instruction to obtain a second instruction, wherein when the electronic equipment runs by adopting the second instruction, the electronic equipment has second working power consumption, and the second working power consumption is lower than the first working power consumption; and screening third instructions from the instruction set according to a second condition, screening all or part of the second instructions from all the second instructions according to the second condition, and carrying out second processing on the selected second instructions and the corresponding third instructions according to a specific algorithm to form compressed instructions. The method can effectively compress the number of instructions in the electronic equipment, thereby saving precious cache space and effectively reducing the power consumption of the electronic equipment.

Description

Instruction processing method and electronic equipment
Technical Field
The application relates to an instruction processing method and electronic equipment.
Background
At present, electronic products such as computers and mobile phones are indispensable electronic devices in life, work and study, but in the process of working of the electronic devices, the working power consumption of the electronic devices is an important factor influencing the quality and the service life of the electronic device products, and along with the increase of the power consumption, the electronic devices can generate heat. In the prior art, the work power consumption of the electronic equipment is often adjusted by directly changing a hardware power supply mode, the mode is complex, the cost is high, and the problems cannot be solved in real time.
Disclosure of Invention
In view of the foregoing problems in the prior art, embodiments of the present application provide an instruction processing method and an electronic device.
An instruction processing method provided in an embodiment of the present application includes:
screening a first instruction from an instruction set according to a first condition, wherein the electronic equipment has first working power consumption when running by adopting the first instruction;
performing first processing on the first instruction to obtain a second instruction, wherein when the electronic equipment runs by adopting the second instruction, the electronic equipment has second working power consumption, and the second working power consumption is lower than the first working power consumption;
and screening third instructions from the instruction set according to a second condition, screening all or part of the second instructions from all the second instructions according to the second condition, and carrying out second processing on the selected second instructions and the corresponding third instructions according to a specific algorithm to form compressed instructions.
Preferably, the second instruction and the third instruction are both composed of a first character and a second character, and the number of the first characters contained in the instruction is positively correlated with the work power consumption of the electronic device when the electronic device runs by adopting the instruction;
the screening of the third instruction from the instruction set according to the second condition and the screening of all or part of the second instructions from all the second instructions according to the second condition includes:
selecting two first characters according to the second condition, wherein the number of the two first characters does not exceed a specific numerical value, and the two first characters are not uniform in identical bits and are to-be-selected instructions of the first characters;
and judging the number of the first characters in each instruction to be selected, determining the instruction with more first characters as a selected second instruction, and determining the instruction with less first characters as a third instruction corresponding to the selected second instruction.
Preferably, the second processing of the selected second instruction and the corresponding third instruction according to a specific algorithm to form a compressed instruction includes:
matching characters at corresponding positions in the second instruction and the third instruction with each other, and adding identification characters;
and forming a compression instruction based on the matched characters and the identification characters.
Preferably, the compression instruction is used for executing or calling, wherein the executing or calling of the compression instruction includes:
reading the compression instruction to obtain the identification character of the compression instruction and the character matched with the identification character;
and processing the characters matched with each other based on the identification characters, and restoring to obtain the first instruction and the third instruction.
Preferably, the performing the first processing on the first instruction includes:
and performing negation processing on the characters of the first instruction, wherein the negation processing represents that a first character in the characters of the first instruction is replaced by a second character, and the second character in the first instruction is replaced by the first character.
Preferably, the processing the characters matched with each other based on the identification character, and restoring to obtain the first instruction and the third instruction includes:
analyzing the characters matched with each other based on the identification characters to obtain characters in the second instruction and characters in the third instruction;
analyzing characters in the second instruction based on the identification characters to obtain characters of the first instruction;
and obtaining the first instruction and the third instruction based on the character of the first instruction and the character of the third instruction.
An embodiment of the present application further provides an electronic device, including:
the electronic equipment comprises a first processing module, a second processing module and a control module, wherein the first processing module is configured to filter a first instruction from an instruction set according to a first condition, and the electronic equipment has first working power consumption when running by adopting the first instruction;
the second processing module is configured to perform first processing on the first instruction to obtain a second instruction, and when the electronic device runs by using the second instruction, the electronic device has second working power consumption, wherein the second working power consumption is lower than the first working power consumption;
and the compression module is configured to screen third instructions from the instruction set according to a second condition, screen all or part of the second instructions from all the second instructions according to the second condition, and perform second processing on the selected second instructions and the corresponding third instructions according to a specific algorithm to form compressed instructions.
Preferably, the second instruction and the third instruction are both composed of a first character and a second character, and the number of the first characters contained in the instruction is positively correlated with the work power consumption of the electronic device when the electronic device runs by adopting the instruction;
the compression module is further configured to:
selecting two first characters according to the second condition, wherein the number of the two first characters does not exceed a specific numerical value, and the two first characters are not uniform in identical bits and are to-be-selected instructions of the first characters;
and judging the number of the first characters in each instruction to be selected, determining the instruction with more first characters as a selected second instruction, and determining the instruction with less first characters as a third instruction corresponding to the selected second instruction.
Preferably, the compression module is further configured to:
matching characters at corresponding positions in the second instruction and the third instruction with each other, and adding identification characters;
and forming a compression instruction based on the matched characters and the identification characters.
Preferably, the compression instruction is used to execute or call, and the electronic device further includes a restoring module configured to:
reading the compression instruction to obtain the identification character of the compression instruction and the character matched with the identification character;
and processing the characters matched with each other based on the identification characters, and restoring to obtain the first instruction and the third instruction.
Compared with the prior art, the beneficial effect of this application lies in: the method can effectively compress the number of the instructions in the electronic equipment, thereby saving precious cache space, and in addition, the number of the characters '1' in the instruction set, particularly the first instruction with higher use frequency, is reduced, so that the power consumption of the electronic equipment is effectively reduced.
Drawings
FIG. 1 is a flow chart of a method of instruction processing according to an embodiment of the present application;
FIG. 2 is a flowchart of one embodiment of step S103 of FIG. 1;
FIG. 3 is a flowchart of another embodiment of step S103 in FIG. 1;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the present application is described in detail below with reference to the accompanying drawings and the detailed description.
Various aspects and features of the present application are described herein with reference to the drawings.
These and other characteristics of the present application will become apparent from the following description of preferred forms of embodiment, given as non-limiting examples, with reference to the attached drawings.
It should also be understood that, although the present application has been described with reference to some specific examples, a person of skill in the art shall certainly be able to achieve many other equivalent forms of application, having the characteristics as set forth in the claims and hence all coming within the field of protection defined thereby.
The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.
Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it is to be understood that the disclosed embodiments are merely exemplary of the application and that it may be embodied in various forms. Well-known and/or repeated functions and structures have not been described in detail so as to not unnecessarily obscure the present application with unnecessary or unnecessary detail. Therefore, specific structural and functional details disclosed herein are not to be interpreted as limiting, but merely as a basis for the claims and as a representative basis for teaching one skilled in the art to variously employ the present application in virtually any appropriately detailed structure.
The specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," which may each refer to one or more of the same or different embodiments in accordance with the application.
The application provides an instruction processing method, which comprises the following steps:
screening a first instruction from an instruction set according to a first condition, wherein the electronic equipment has first working power consumption when running by adopting the first instruction;
performing first processing on the first instruction to obtain a second instruction, wherein the electronic equipment has second working power consumption when running by adopting the second instruction, and the second working power consumption is lower than the first working power consumption;
and screening a third instruction from the instruction set according to a second condition, and carrying out second processing on the second instruction and the third instruction according to a specific algorithm to form a compressed instruction.
According to the instruction processing method, after a first instruction is screened from an instruction set according to a first condition, when the electronic equipment runs by adopting the first instruction, the electronic equipment has first working power consumption; the first instruction is subjected to first processing to obtain a second instruction, and when the electronic device runs by adopting the second instruction, the electronic device has second working power consumption, wherein the first condition can be that the use frequency is greater than a preset value and the number of the first characters contained in the instruction is greater than a preset number, or the first condition can be a part of instructions selected according to actual needs, of course, the first condition can also be adjusted according to the actual needs, and the second working power consumption is lower than the first working power consumption; and then, screening a third instruction from the instruction set according to a second condition, and carrying out second processing on the second instruction and the third instruction according to a specific algorithm to form a compressed instruction. The second instruction is obtained by carrying out first processing on the first instruction, so that the working power consumption of the electronic equipment when the electronic equipment adopts the instruction meeting the first condition is reduced, meanwhile, the second instruction and a third instruction screened according to the second condition are subjected to second processing according to a specific algorithm, and finally a compression instruction mode is formed, so that one compression instruction actually comprises two instructions, the space occupied by the instructions can be greatly saved, and the processing efficiency or the storage capacity of the electronic equipment capable of using or storing the compression instruction is improved.
In order to understand the above technical solutions more simply and in detail, the following describes the above image processing method in detail with reference to the embodiments and the drawings.
As shown in fig. 1 and fig. 2, fig. 1 is a flowchart of an instruction processing method provided in an embodiment of the present application, where the instruction processing method specifically includes the following steps:
step 101: and screening a first instruction from the instruction set according to a first condition, wherein the electronic equipment has first working power consumption when running by adopting the first instruction. As an example, taking the instruction of the computer processor as an example, the instruction in the computer processor is a character string composed of a first character and/or a second character, that is, may be a character string including a character 1 and a character 0, where the character 1 is at a high level, i.e., the more characters 1 are included in the instruction of the computer processor, the higher the operating power consumption of the electronic device when the instruction is stored or transmitted. Because the number of instructions in the instruction set used in the electronic device is large, when the first instruction is screened according to the first condition, on one hand, the first condition may be that an instruction with a higher frequency of use is selected from the instruction set as the first instruction; on the other hand, the first condition may be to select a partial instruction as the first instruction based on the arrangement of the first character and the second character in the instruction, such as to select an instruction having three characters "1" between two characters "0" (the number of characters "1" is greater than that of characters "0") from the instruction as the first instruction, such as the first instruction may be "11011101", "10111011", "11100111", or "01110111".
Step 102: and performing first processing on the first instruction to obtain a second instruction, wherein the electronic equipment has second working power consumption when the electronic equipment adopts the second instruction to run, and the second working power consumption is lower than the first working power consumption. Wherein the first instruction and the second instruction may each be composed of a character string including a plurality of characters, such as "11100111" as the first instruction, as an example.
In one embodiment, in order to reduce the number of instructions and reduce the number of characters "1" in the frequently executed first instruction and finally form a compressed instruction under the condition that it is ensured that the first instruction can be restored and executed, after the first instruction is subjected to the first processing, the number of characters "1" in the formed compressed instruction is reduced, so that the operating power consumption of the electronic device is reduced, for example, in the process of storing or transmitting the instruction, the power consumption can be reduced because the number of characters "1" representing high levels is small. The first processing the first instruction comprises: and performing negation processing on the characters of the first instruction, wherein the negation processing represents that a first character in the characters of the first instruction is replaced by a second character, and the second character in the first instruction is replaced by the first character. Specifically, as an example, the negation processing may be performed on "11100111", where the negation processing represents that the character "1" is replaced by "0", and simultaneously, the character "0" is replaced by "1", so as to obtain the second instruction "00011000", and it can be seen that the number of the character "1" with the high level in "11100111" of the first instruction is 6, and the number of the character "1" with the high level in the second instruction "00011000" is only 2, that is, the second operating power consumption of the electronic device when the electronic device operates by using the second instruction is smaller than the first operating power consumption of the electronic device when the electronic device operates by using the first instruction.
Step 103: and screening third instructions from the instruction set according to a second condition, screening all or part of the second instructions from all the second instructions according to the second condition, and carrying out second processing on the selected second instructions and the corresponding third instructions according to a specific algorithm to form compressed instructions.
Since the second instruction and the third instruction are processed to obtain the compressed instruction, the number of instructions is actually reduced, that is, two original instructions are converted into one instruction, so that precious storage space (such as limited storage space in a register or a cache) can be saved in the process of storing the instructions.
In some embodiments of the application, the second instruction and the third instruction are both composed of a first character and a second character, and the number of the first character is contained in the instruction, so that when the instruction is used by the electronic device, the electronic device has positive correlation with the work power consumption.
As shown in fig. 2, the screening of the third instruction from the instruction set according to the second condition, and screening all or part of the second instructions from all the second instructions according to the second condition includes:
s1031, selecting the number of the two first characters not exceeding a specific numerical value according to the second condition, wherein the uneven same bit is a to-be-selected instruction of the first characters;
and S1032, judging the number of the first characters in each instruction to be selected, determining the instruction with more first characters as a selected second instruction, and determining the instruction with less first characters as a third instruction corresponding to the selected second instruction.
Specifically, when the second instruction and the third instruction are filtered, a plurality of instructions composed of the first character (1) and the second character (0) are taken as an example, for example, an instruction composed of 8 "1" and/or "0" is taken as an example, and the third instruction and all or part of the second instruction are filtered, so that the following preconditions need to be met: the number of the first characters is selected not to exceed a specific value (e.g., not to exceed three), and the parity bits of the second instruction and the third instruction are not uniform for the first character. Specifically, when the instruction is composed of 8 "1" s and/or "0" s, the number of "1" s in the screened second instruction and the corresponding third instruction cannot exceed three, and the character "1" cannot appear simultaneously in the same bit among 8 bits of the second instruction and the third instruction. Under the precondition, the second instruction and the third instruction are screened according to the following screening rule one: looking at the number of the first characters, determining the instruction with more first characters as a second instruction (e.g. 11000010), and determining the instruction with less first characters as a third instruction (which needs to meet the above-mentioned preconditions) corresponding to the second instruction (e.g. 0001100; when the number of the first characters is the same, the instruction with the first character closest to the left side of the whole character string is selected as the second instruction (e.g., 11000000), and the instruction with the first character farther from the left side of the whole character string is selected as the third instruction (which is required to meet the above-mentioned precondition) corresponding to the second instruction, e.g., 0001100.
In addition, the second instruction and the third instruction may be screened according to the following screening rule two under the above premise: if the following situation occurs, when one instruction is divided into two parts according to the number of characters, the first part is four characters (including the first character and/or the second character), and the second part is four second characters, the instruction is determined as the second instruction, correspondingly, when another instruction is divided into two parts according to the number of characters, the first part is four second characters, and the second part is four characters (including the first character and/or the second character), the instruction is determined as the third instruction corresponding to the second instruction. Still taking the example of an instruction consisting of 8 "1" s and/or "0" s, such as the instruction 10100000, whose last four bits are "0", is screened as the second instruction, and correspondingly, if 00000111 is encountered, whose first four bits are "0", is screened as the third instruction corresponding to the second instruction.
Furthermore, in order to increase the success rate of the operation of the compressed instruction, the identities of the selected second instruction and the selected third instruction may be removed if the two instructions are screened as the second instruction and the third instruction, respectively, and after the second instruction and the third instruction are compressed (for example, an addition operation), the compressed instruction is formed, but the compressed instruction cannot be accurately restored to the original second instruction and the original third instruction, so that the two instructions are not compressed any more.
In some embodiments of the application, said second processing said second instruction and said third instruction according to a specific algorithm to form a compressed instruction, as shown in fig. 3, comprises the following steps:
s1033, matching the characters at the corresponding positions in the second instruction and the third instruction with each other, and adding identification characters;
s1034, forming a compression instruction based on the matched characters and the identification characters.
The identification character is used for identifying the compression mode of the two instructions and the third instruction, so that the second instruction and the third instruction are restored when the compression instruction is executed or called, and the identification character can comprise at least two characters.
For example, assuming that the first instruction is "11100111", the second instruction is "00011000", accordingly, the third instruction is "11000001", and in this case, the compressed instruction is "11011001", and the flag character is added before or after "11011011001", and in this case, if the flag is added before the compressed instruction, and if the flag is added after the compressed instruction, that is, the addition method is set to be uniform, and in this embodiment, the second instruction "00011000" and the third instruction "11000001" are compressed and then "11011001". In one embodiment, adding the identification to the compressed instruction may be: adding a mark "10" or "11" at the end of the instruction, wherein the first character is "1", which indicates that the instruction with the character "1" corresponding to the position between the at least two non-adjacent second characters (which may be character 0) in the restored instruction is preceded by "00011000", and the instruction with the character "0" corresponding to the position between the at least two non-adjacent second characters (which includes two instructions arranged in a tandem order) in the restored instruction is followed by "11000001"; and the second character "0" indicates that the preceding instruction "00011000" is the second instruction, i.e., the instruction resulting from the first processing (inverting) of the first instruction, and if the second character is "1", the second character "1" indicates that the following instruction is the second instruction. Of course, the way of adding the identifier after the compression instruction and the corresponding definition can also be set according to the actual needs of the user, so as to guide the specific reduction operation, thereby better meeting the requirements of the user.
In some embodiments of the application, the compress instruction is to execute or invoke, wherein the executing or invoking of the compress instruction comprises: reading the compression instruction to obtain the identification character of the compression instruction and the character matched with the identification character; and processing the characters matched with each other based on the identification characters, and restoring to obtain the first instruction and the third instruction. Specifically, after the characters matched with each other are processed, the second instruction and the third instruction may be obtained first, and then the first instruction is obtained based on the second instruction. For example, after the second instruction "00011000" and the third instruction "11000001" are compressed, they are "1101100110", that is, the identification character is "10", and if the identification is performed in an identification manner, the restored instructions are "00011000" and "11000001" based on the first identification character being "1", and the second identification character being "0", the second instruction is "00011000", and the third instruction is "11000001".
Further, in some embodiments of the application, the processing the mutually matched characters based on the identification character, and restoring to obtain the first instruction and the third instruction include: analyzing the characters matched with each other based on the identification characters to obtain characters in the second instruction and characters in the third instruction; analyzing characters in the second instruction based on the identification characters to obtain characters of the first instruction; and obtaining the first instruction and the third instruction based on the character of the first instruction and the character of the third instruction. For example, the second instruction "00011000" and the third instruction "11000001" are compressed and then become "1101100110", wherein the identification character is "10", and in an example of identification by adding identification means, the restored instructions are "00011000" and "11000001" based on the first identification character being "1", the second instruction is "00011000" based on the second identification character being "0", the third instruction is "11000001", and the second instruction is inverted to obtain the first instruction "11100111".
The embodiment of the present invention further provides an electronic device, as shown in fig. 4, including:
the electronic equipment comprises a first processing module and a second processing module, wherein the first processing module is configured to filter a first instruction from an instruction set according to a first condition, and the electronic equipment has first working power consumption when running by adopting the first instruction. As an example, the instruction of the computer processor is a character string composed of a first character and/or a second character, that is, it may be a character string including a character 1 and a character 0, where the character 1 is at a high level, that is, the more characters 1 are included in the instruction of the computer processor, the higher the operating power consumption of the electronic device when the instruction is stored or transmitted. Because the number of instructions in the instruction set used in the electronic device is large, when the first processing module filters the first instruction according to the first condition, on one hand, the first condition may be that an instruction with a higher use frequency is selected from the instruction set and used as the first instruction; on the other hand, the first condition may be to select a partial instruction as the first instruction based on the arrangement of the first character and the second character in the instruction, such as to select an instruction having three characters "1" between two characters "0" (the number of characters "1" is greater than that of characters "0") from the instruction as the first instruction, such as the first instruction may be "11011101", "10111011", "11100111", or "01110111".
The second processing module is configured to perform first processing on the first instruction to obtain a second instruction, and the electronic device has second working power consumption when running by using the second instruction, wherein the second working power consumption is lower than the first working power consumption. Wherein the first instruction and the second instruction may each be composed of a character string including a plurality of characters, such as "11100111" as the first instruction, as an example.
In an embodiment, in order to reduce the number of instructions and reduce the number of characters "1" in the frequently executed first instruction to finally form a compressed instruction under the condition that it is ensured that the first instruction can be restored and executed, after the second processing module performs the first processing on the first instruction, the number of characters "1" in the formed compressed instruction is reduced, thereby reducing the operating power consumption of the electronic device, for example, in the process of storing or transmitting the instruction, the power consumption can be reduced because the number of characters "1" representing high levels is small. The first processing the first instruction comprises: and performing negation processing on the characters of the first instruction, wherein the negation processing represents that a first character in the characters of the first instruction is replaced by a second character, and the second character in the first instruction is replaced by the first character. Specifically, as an example, the negation processing may be performed on "11100111", where the negation processing represents that the character "1" is replaced by "0", and simultaneously, the character "0" is replaced by "1", so as to obtain the second instruction "00011000", and it can be seen that the number of the character "1" with the high level in "11100111" of the first instruction is 6, and the number of the character "1" with the high level in the second instruction "00011000" is only 2, that is, the second operating power consumption of the electronic device when the electronic device operates by using the second instruction is smaller than the first operating power consumption of the electronic device when the electronic device operates by using the first instruction.
And the compression module is configured to screen a third instruction from the instruction set according to a second condition, screen all or part of second instructions from all second instructions according to the second condition, and perform second processing on the selected second instruction and the third instruction according to a specific algorithm to form a compressed instruction. Since the second instruction and the third instruction are processed to obtain the compressed instruction, the number of instructions is actually reduced, that is, two original instructions are converted into one instruction, so that precious storage space (such as limited storage space in a register or a cache) can be saved in the process of storing the instructions.
In some embodiments of the application, the second instruction and the third instruction are both composed of a first character and a second character, and the number of the first character is contained in the instruction, so that when the instruction is used by the electronic device, the electronic device has positive correlation with the work power consumption.
The compression module is further configured to:
selecting two first characters according to the second condition, wherein the number of the two first characters does not exceed a specific numerical value, and the two first characters are not uniform in identical bits and are to-be-selected instructions of the first characters;
and judging the number of the first characters in each instruction to be selected, determining the instruction with more first characters as a selected second instruction, and determining the instruction with less first characters as a third instruction corresponding to the selected second instruction.
Specifically, when the second instruction and the third instruction are filtered, taking a plurality of instructions composed of the first character (1) and the second character (0) as an example, for example, the instructions composed of 8 "1" and/or "0" are used as an example, the compression module filters the third instruction and all or part of the second instruction, and the following preconditions need to be met: the number of the first characters is selected not to exceed a specific value (e.g., not to exceed three), and the parity bits of the second instruction and the third instruction are not uniform for the first character. Specifically, when the instruction is composed of 8 "1" s and/or "0" s, the number of "1" s in the screened second instruction and the corresponding third instruction cannot exceed three, and the character "1" cannot appear simultaneously in the same bit among 8 bits of the second instruction and the third instruction. Under the precondition, the second instruction and the third instruction are screened according to the following screening rule one: looking at the number of the first characters, determining the instruction with more first characters as a second instruction (e.g. 11000010), and determining the instruction with less first characters as a third instruction (which needs to meet the above-mentioned preconditions) corresponding to the second instruction (e.g. 0001100; when the number of the first characters is the same, the instruction with the first character closest to the left side of the whole character string is selected as the second instruction (e.g., 11000000), and the instruction with the first character farther from the left side of the whole character string is selected as the third instruction (which is required to meet the above-mentioned precondition) corresponding to the second instruction, e.g., 0001100.
In addition, the compression module may also screen out the second instruction and the third instruction according to the following screening rule two on the premise: if the following situation occurs, when one instruction is divided into two parts according to the number of characters, the first part is four characters (including the first character and/or the second character), and the second part is four second characters, the instruction is determined as the second instruction, correspondingly, when another instruction is divided into two parts according to the number of characters, the first part is four second characters, and the second part is four characters (including the first character and/or the second character), the instruction is determined as the third instruction corresponding to the second instruction. Still taking the example of an instruction consisting of 8 "1" s and/or "0" s, such as the instruction 10100000, whose last four bits are "0", is screened as the second instruction, and correspondingly, if 00000111 is encountered, whose first four bits are "0", is screened as the third instruction corresponding to the second instruction.
Furthermore, in order to increase the success rate of the operation of the compressed instruction, the identities of the selected second instruction and the selected third instruction may be removed if the two instructions are screened as the second instruction and the third instruction, respectively, and after the second instruction and the third instruction are compressed (for example, an addition operation), the compressed instruction is formed, but the compressed instruction cannot be accurately restored to the original second instruction and the original third instruction, so that the two instructions are not compressed any more.
In some embodiments of the application, the compression module is further configured to: matching characters at corresponding positions in the second instruction and the third instruction with each other, and adding identification characters; and forming a compression instruction based on the matched characters and the identification characters.
The identification character is used for identifying the compression mode of the two instructions and the third instruction, so that the second instruction and the third instruction are restored when the compression instruction is executed or called, and the identification character can comprise at least two characters.
For example, assuming that the first instruction is "11100111", the second instruction is "00011000", accordingly, the third instruction is "11000001", and in this case, the compressed instruction is "11011001", and the flag character is added before or after "11011011001", and in this case, if the flag is added before the compressed instruction, and if the flag is added after the compressed instruction, that is, the addition method is set to be uniform, and in this embodiment, the second instruction "00011000" and the third instruction "11000001" are compressed and then "11011001". In one embodiment, adding the identification to the compressed instruction may be: adding a mark "10" or "11" at the end of the instruction, wherein the first character is "1", which indicates that the instruction with the character "1" corresponding to the position between the at least two non-adjacent second characters (which may be character 0) in the restored instruction is preceded by "00011000", and the instruction with the character "0" corresponding to the position between the at least two non-adjacent second characters (which includes two instructions arranged in a tandem order) in the restored instruction is followed by "11000001"; while the second character "0" indicates that the preceding instruction "00011000" is the second instruction, i.e., the instruction resulting from the negation, and if the second character is "1" the second character "1" indicates that the following instruction is the second instruction. Of course, the way of adding the identifier after the compression instruction and the corresponding definition can also be set according to the actual needs of the user, so as to guide the specific reduction operation, thereby better meeting the requirements of the user.
In some embodiments of the application, the electronic device further comprises a restore module configured to:
reading the compression instruction to obtain the identification character of the compression instruction and the character matched with the identification character;
and processing the characters matched with each other based on the identification characters, and restoring to obtain the first instruction and the third instruction.
Specifically, after the characters matched with each other are processed, the second instruction and the third instruction may be obtained first, and then the first instruction is obtained based on the second instruction. For example, after the second instruction "00011000" and the third instruction "11000001" are compressed, they are "1101100110", that is, the identification character is "10", if the identification is performed in an identification manner, if the first identification character is "1", the restored instructions are "00011000" and "11000001", and if the second identification character is "0", the second instruction is "00011000", and the third instruction is "11000001".
Since the electronic device described in this embodiment is an electronic device corresponding to the instruction processing method in this embodiment, based on the instruction processing method in this embodiment, a person skilled in the art can understand the specific implementation of the electronic device in this embodiment and various variations thereof, so that detailed description of the electronic device is omitted here. Electronic devices that implement the instruction processing method in the embodiments of the present application are within the scope of the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processing module of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing module of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above embodiments are only exemplary embodiments of the present application, and are not intended to limit the present application, and the protection scope of the present application is defined by the claims. Various modifications and equivalents may be made by those skilled in the art within the spirit and scope of the present application and such modifications and equivalents should also be considered to be within the scope of the present application.

Claims (8)

1. An instruction processing method, comprising:
screening a first instruction from an instruction set according to a first condition, wherein the electronic equipment has first working power consumption when running by adopting the first instruction, wherein the first condition comprises a condition of using frequency of the instructions in the instruction set and a condition of arrangement condition of a first character and a second character in the instructions in the instruction set;
performing first processing on the first instruction to obtain a second instruction, wherein when the electronic equipment runs by adopting the second instruction, the electronic equipment has second working power consumption, and the second working power consumption is lower than the first working power consumption;
screening third instructions from the instruction set according to a second condition, screening all or part of the second instructions from all the second instructions according to the second condition, and carrying out second processing on the selected second instructions and the corresponding third instructions according to a specific algorithm to form compressed instructions;
when two instructions are respectively screened as the selected second instruction and the selected third instruction, and after the selected second instruction and the selected third instruction are subjected to compression operation, a compressed instruction is formed, but the compressed instruction cannot be accurately restored to the original selected second instruction and the original selected third instruction, the identities of the selected second instruction and the selected third instruction of the two instructions can be removed, so that the two instructions are not subjected to compression operation any more subsequently;
wherein said second processing the selected second instruction and the corresponding third instruction according to a specific algorithm to form a compressed instruction comprises: matching characters at corresponding positions in the selected second instruction and the selected third instruction with each other, and adding identification characters; and forming a compression instruction based on the matched characters and the identification characters.
2. The method according to claim 1, wherein the second instruction and the third instruction are both composed of a first character and a second character, and the number of the first characters contained in the instruction is positively correlated with the operating power consumption of the electronic device when the electronic device runs by adopting the instruction;
the screening of the third instruction from the instruction set according to the second condition and the screening of all or part of the second instructions from all the second instructions according to the second condition includes:
selecting two first characters according to the second condition, wherein the number of the two first characters does not exceed a specific numerical value, and the two first characters are not uniform in identical bits and are to-be-selected instructions of the first characters;
and judging the number of the first characters in each instruction to be selected, determining the instruction with more first characters as a selected second instruction, and determining the instruction with less first characters as a third instruction corresponding to the selected second instruction.
3. The method of claim 1, wherein the compress instruction is to execute or invoke, wherein the executing or invoking of the compress instruction comprises:
reading the compression instruction to obtain the identification character of the compression instruction and the character matched with the identification character;
and processing the characters matched with each other based on the identification characters, and restoring to obtain the first instruction and the third instruction.
4. The method of claim 3, the first processing the first instruction comprising:
and performing negation processing on the characters of the first instruction, wherein the negation processing represents that a first character in the characters of the first instruction is replaced by a second character, and the second character in the first instruction is replaced by the first character.
5. The method of claim 4, wherein processing the mutually matched characters based on the identification character and restoring to obtain the first instruction and the third instruction comprises:
analyzing the characters matched with each other based on the identification characters to obtain characters in the second instruction and characters in the third instruction;
analyzing characters in the second instruction based on the identification characters to obtain characters of the first instruction;
and obtaining the first instruction and the third instruction based on the character of the first instruction and the character of the third instruction.
6. An electronic device, comprising:
the electronic equipment comprises a first processing module, a second processing module and a display module, wherein the first processing module is configured to filter a first instruction from an instruction set according to a first condition, and the electronic equipment has first working power consumption when running by adopting the first instruction, wherein the first condition comprises a condition of using frequency of the instructions in the instruction set and a condition of arrangement of a first character and a second character in the instructions in the instruction set;
the second processing module is configured to perform first processing on the first instruction to obtain a second instruction, and when the electronic device runs by using the second instruction, the electronic device has second working power consumption, wherein the second working power consumption is lower than the first working power consumption;
the compression module is configured to screen third instructions from the instruction set according to a second condition, screen all or part of the second instructions from all the second instructions according to the second condition, and perform second processing on the selected second instructions and the corresponding third instructions according to a specific algorithm to form compression instructions;
the compression module is further configured to, when two instructions are screened as the selected second instruction and the selected third instruction respectively, form a compressed instruction after the selected second instruction and the selected third instruction are subjected to a compression operation, but the compressed instruction cannot be accurately restored to the original selected second instruction and the original selected third instruction, remove the identity of the selected second instruction and the selected third instruction of the two instructions so that the two instructions are not subjected to the compression operation any more subsequently;
wherein the compression module is further configured to: matching characters at corresponding positions in the selected second instruction and the selected third instruction with each other, and adding identification characters; and forming a compression instruction based on the matched characters and the identification characters.
7. The electronic device according to claim 6, wherein the second instruction and the third instruction are both composed of a first character and a second character, and the number of the first characters included in the instruction is positively correlated with the power consumption of the electronic device when the electronic device runs by using the instruction;
the compression module is further configured to:
selecting two first characters according to the second condition, wherein the number of the two first characters does not exceed a specific numerical value, and the two first characters are not uniform in identical bits and are to-be-selected instructions of the first characters;
and judging the number of the first characters in each instruction to be selected, determining the instruction with more first characters as a selected second instruction, and determining the instruction with less first characters as a third instruction corresponding to the selected second instruction.
8. The electronic device of claim 6, the compress instruction to execute or invoke, the electronic device further comprising a restore module configured to:
reading the compression instruction to obtain the identification character of the compression instruction and the character matched with the identification character;
and processing the characters matched with each other based on the identification characters, and restoring to obtain the first instruction and the third instruction.
CN201910926855.XA 2019-09-27 2019-09-27 Instruction processing method and electronic equipment Active CN110647234B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910926855.XA CN110647234B (en) 2019-09-27 2019-09-27 Instruction processing method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910926855.XA CN110647234B (en) 2019-09-27 2019-09-27 Instruction processing method and electronic equipment

Publications (2)

Publication Number Publication Date
CN110647234A CN110647234A (en) 2020-01-03
CN110647234B true CN110647234B (en) 2021-08-17

Family

ID=68992979

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910926855.XA Active CN110647234B (en) 2019-09-27 2019-09-27 Instruction processing method and electronic equipment

Country Status (1)

Country Link
CN (1) CN110647234B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1222236A (en) * 1996-04-29 1999-07-07 爱特梅尔股份有限公司 Signal processing system and method with rom storing instructions encoded for reducing power consumption during reads
CN1703663A (en) * 2002-11-20 2005-11-30 株式会社东芝 Reduced power consumption signal processing methods and apparatus
JP2013257670A (en) * 2012-06-11 2013-12-26 Fujitsu Ltd Processor, compression apparatus, compression method, and compression program
CN104331269A (en) * 2014-10-28 2015-02-04 中国科学院自动化研究所 Executable code compression method of embedded type system and code uncompressing system
CN108388446A (en) * 2018-02-05 2018-08-10 上海寒武纪信息科技有限公司 Computing module and method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8281083B2 (en) * 2005-06-30 2012-10-02 Intel Corporation Device, system and method of generating an execution instruction based on a memory-access instruction
CN105843363B (en) * 2016-03-24 2018-05-25 福州瑞芯微电子股份有限公司 A kind of chip low power consumption optimization method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1222236A (en) * 1996-04-29 1999-07-07 爱特梅尔股份有限公司 Signal processing system and method with rom storing instructions encoded for reducing power consumption during reads
CN1703663A (en) * 2002-11-20 2005-11-30 株式会社东芝 Reduced power consumption signal processing methods and apparatus
JP2013257670A (en) * 2012-06-11 2013-12-26 Fujitsu Ltd Processor, compression apparatus, compression method, and compression program
CN104331269A (en) * 2014-10-28 2015-02-04 中国科学院自动化研究所 Executable code compression method of embedded type system and code uncompressing system
CN108388446A (en) * 2018-02-05 2018-08-10 上海寒武纪信息科技有限公司 Computing module and method

Also Published As

Publication number Publication date
CN110647234A (en) 2020-01-03

Similar Documents

Publication Publication Date Title
JP6587330B2 (en) Random forest model training method, electronic apparatus, and storage medium
CN107832406B (en) Method, device, equipment and storage medium for removing duplicate entries of mass log data
CN109840589B (en) Method and device for operating convolutional neural network on FPGA
CN110457235B (en) Memory compression method, device, terminal and storage medium
CN103902729A (en) Method and device for recommending application program
CN109885828A (en) Word error correction method, device, computer equipment and medium based on language model
KR20180108810A (en) Service parameter selection method and associated device
CN105046270A (en) Application classification model constructing method and system and application classification method and system
CN105138375A (en) Method and device for deploying software
CN110647234B (en) Instruction processing method and electronic equipment
CN111130834B (en) Method and device for processing network elasticity strategy
CN109146765B (en) Image processing method, main processor, coprocessor and electronic equipment
US20150293950A1 (en) Method, apparatus, and storage medium for removing redundant information from terminal
CN110619391B (en) Detection model compression method and device and computer readable storage medium
CN110781410A (en) Community detection method and device
CN111221650A (en) System resource recovery method and device based on process type association
CN114091029B (en) Training system, method, device, medium and platform for malicious file detection model
US20200242467A1 (en) Calculation method and calculation device for sparse neural network, electronic device, computer readable storage medium, and computer program product
CN113657408B (en) Method and device for determining image characteristics, electronic equipment and storage medium
CN106776623B (en) User behavior analysis method and device
CN112037814B (en) Audio fingerprint extraction method and device, electronic equipment and storage medium
CN114003388A (en) Method and device for determining task parameters of big data computing engine
CN113901456A (en) User behavior security prediction method, device, equipment and medium
CN111459634A (en) Task scheduling method, device, terminal and storage medium
CN110660029B (en) Image processing method, device, equipment and storage medium

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