PROGRAM TEST
Patent Information
- Application Number
- DE602020040193
- Authority / Receiving Office
- DE · DE
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2019-09-16
- Filing Date
- 2020-09-15
- Publication Date
- 2024-10-30
- Estimated Expiration
- 2040-09-15
AI Technical Summary
Current programmable electronic devices lack an efficient method to determine which program instructions are executed and which are not during program implementation, leading to challenges in memory storage size and potential security risks from unexecuted instructions.
A method that selects memory areas for each program instruction, storing a value in these areas based on execution status, using bits to indicate predicate conditions, allowing for parallel storage during execution, and distinguishing between executed and unexecuted instructions, thereby reducing memory size and identifying unexecuted code.
This approach significantly reduces the size of the trace memory, facilitates the identification of unexecuted instructions, and enhances security by ensuring all instructions are executed, thus preventing potential attacks and unknown behavior.
Description
Domaine technique
[0001] This description relates generally to programmable electronic devices, and methods of executing program instructions. Technique antérieure
[0002] A program consists of a sequence of instructions. Instructions are, for example, stored in a memory connected to a sequential data processing unit such as a microprocessor. During program execution, instructions may be executed multiple times, for example when the program includes a loop. Instructions may not be executed, for example following a branch instruction, i.e., an instruction indicating a part of the program to be executed after the branch instruction.
[0003] Document US2013246770A1 describes a system for controlling the operation of a processor from a less privileged state.
[0004] The paper "Design & verification of automotive SoC firmware", KLEEBERGER VEIT B ET AL; 2015 52ND ACM / EDAC / IEEE DESIGN AUTOMATION CONFERENCE (DAC) describes firmware software developments, including their testing and debugging, and proposes structural coverage measures including the percentage of software instructions (lines of source code) that have been executed using the defined unit tests.
[0005] The paper "Hardware-assisted software event tracing: Hardware-assisted software event tracing", ADRIEN VERGÉ ET AL; CONCURRENCY AND COMPUTATION: PRACTICE AND EXPERIENCE describes a tracing method that relies on hardware modules to facilitate software tracing.
[0006] The paper "Trace and debug port based watchdog processor", BALAZS SCHERER ET AL; 2013 IEEE INTERNATIONAL INSTRUMENTATION AND MEASUREMENT TECHNOLOGY CONFERENCE (I2MTC) describes a trace and debugging method based on a watchdog system.
[0007] Document US5560036A describes a data processor having a circuit emulation function. Summary of the invention
[0008] There is a need to know which program instructions are executed and / or which instructions are not executed during program implementation.
[0009] An embodiment overcomes all or part of the drawbacks of conventional programmable electronic devices and conventional methods of executing program instructions.
[0010] One embodiment allows for reducing the size of a memory for storing information for determining which instructions have been executed during an implementation of the program.
[0011] The invention relates to a method according to claim 1 and a device according to claim 8.
[0012] The invention provides a method comprising a step of selecting memory areas from positions, in a memory, of instructions of a program, so as to associate each of said instructions with one of the memory areas, the instructions each occupying one or more locations in the memory, and the areas comprising for each location the same number of bits, preferably equal to one or two.
[0013] The method includes executing at least some of the instructions and, for each executed instruction, storing a value in one of the areas associated with the executed instruction.
[0014] According to one embodiment, each of the zones comprises at least a first bit and at least a second bit, the value comprising: the value one at the first bit location if the executed instruction has a predicate with the value "true"; the value one at the second bit location if the executed instruction has a predicate with the value "false"; and the value one at the first and second bit locations if the executed instruction is not a predicate instruction.
[0015] According to one embodiment, the storage is performed in parallel with the execution.
[0016] According to one embodiment, the storage is performed concurrently for concurrently executed instructions.
[0017] According to the invention, the method comprises, after execution, a step of verifying the presence of the value in each of the zones and / or detecting the absence of the value in one of the zones.
[0018] According to one embodiment, the storage comprises writing, to a memory word location comprising at least one of the areas, a word having, outside said at least one of the areas, the contents of the memory word location before the writing.
[0019] According to one embodiment, the areas are located in at least two separate memory banks.
[0020] According to one embodiment, the memory word location has low-order bits located in one of the two banks and high-order bits located in the other of the two banks.
[0021] Another embodiment provides a device configured to implement a method as defined above.
[0022] Another embodiment provides an integrated circuit comprising a device as defined above.
[0023] According to one embodiment, the circuit comprises the areas and is configured to execute the instructions.
[0024] According to one embodiment, the circuit is configured to be connected to a memory external to the circuit and to transmit the contents of the zones to the external memory.
[0025] Another embodiment provides a device comprising the external memory of a circuit as defined above, the device being configured to receive the contents of the zones and write the contents of the zones into the external memory.
[0026] According to one embodiment, the device is configured to verify the presence of the value in the content of each of the zones and / or the detection of the absence of the value in one of the contents. Brève description des dessins
[0027] These and other features and advantages will be set forth in detail in the following description of particular embodiments given without limitation in relation to the attached figures, among which:
[0028] there figure 1 represents, schematically and in block form, an embodiment of a system comprising a programmable device;
[0029] there figure 2 represents, by a partial and schematic view of two memories, an embodiment of a method implemented during the execution of instructions of a program;
[0030] there figure 3 represents, schematically and in block form, an embodiment of a programmable device;
[0031] there figure 4 represents, schematically and in block form, another embodiment of a system comprising a programmable device;
[0032] there figure 5 represents, by a partial and schematic view of two memories, another embodiment of the method of the figure 2 ; And
[0033] there figure 6 represents, by a partial and schematic view of two memories, another embodiment of the method of the figure 2 . Description des modes de réalisation
[0034] The same elements have been designated by the same references in the different figures. In particular, the structural and / or functional elements common to the different embodiments may have the same references and may have identical structural, dimensional and material properties.
[0035] For the sake of clarity, only the steps and elements useful for understanding the described embodiments have been shown and are detailed. In particular, units of a programmable device, such as a data processing unit, are not described in detail, the described embodiments being compatible with such usual units.
[0036] Unless otherwise specified, when two elements are referred to connected together, this means directly connected without intermediate elements other than conductors, and when two elements are referred to connected or coupled together, this means that these two elements can be connected or be connected or coupled through one or more other elements.
[0037] In the following description, when reference is made to absolute position qualifiers, such as the terms "front", "back", "top", "bottom", "left", "right", etc., or relative position qualifiers, such as the terms "above", "below", "upper", "lower", etc., or to orientation qualifiers, such as the terms "horizontal", "vertical", etc., reference is made unless otherwise specified to the orientation of the figures.
[0038] Unless otherwise specified, the expressions "about", "approximately", "substantially", and "of the order of" mean to within 10%, preferably to within 5%.
[0039] There figure 1 represents, schematically and in block form, an embodiment of a system 100 comprising a programmable device 110. The device 110 may comprise, or be constituted by, a circuit of the in situ programmable gate array (FPGA) type or by ASIC (Application-Specific Integrated Circuit) type gates.
[0040] The programmable device 110 is for example used in an automotive application. The programmable device 110 can then be included in an assembly such as an anti-lock brake system, or even a control assembly for an autonomous car. The programmable device can also be used in applications such as data acquisition and visualization of the captured data, or for example laser distance measurement applications.
[0041] The programmable device 110 comprises a program execution circuit 112. The circuit 112 is preferably an integrated circuit. Alternatively, the circuit 112 comprises several separate integrated circuits. An integrated circuit is defined by a package containing one or more chips (in English "die"). By chip, or electronic chip, is meant a portion of semiconductor wafer and electronic circuits located in and on the wafer. The package comprises connection pads or electrically conductive pins protruding from the package. The pads or pins are intended to be electrically connected to other circuits, preferably soldered onto a printed circuit board (PCB). Preferably, the circuit 112 comprises a single chip.
[0042] The circuit 112 comprises a data processing unit 114 (PU). The circuit 112 is connected, preferably connected, by a link or connection 118, to a memory 116 (PROG) of the device 110. The memory 116 contains the program instructions. According to the example shown, the memory 116 is external to the circuit 112. By external, it is meant that the device 110 is manufactured by separately providing the memory 116 and the circuit 112 intended to be connected, preferably connected, to the memory 116. According to a preferred example, the memory 116 is an internal memory of the circuit 112, that is to say that the memory 116 is included in the package of the integrated circuit, and preferably on the same chip as the circuit 112. For example, the memory 116 is of the type known under the name TCM (Tightly Coupled Memory). In a preferred example, program memory 116 contains 64-bit words and link 118 is a 64-bit parallel link.A memory word is a digital value whose bits can be accessed simultaneously for reading or writing in a memory.
[0043] Preferably, the circuit 112 is connected, preferably by a link or connection 122, to a memory 120 (DATA) of the device 110. The memory 120 may be external to the circuit 112 or, preferably, internal to the circuit 112. The memory 120 may be of the TCM type. Preferably, the memories 116 and 120 are two banks (i.e., two blocks) of distinct memory, more preferably of the TCM type. The links 118 and 122 are then preferably distinct. The memories 116 and 120 may also be parts of the same memory bank, and the links 118 and 122 are then the same link. In a preferred example, the data memory 120 contains 32-bit words and the link 122 is a 32-bit parallel link.
[0044] The circuit 112 further comprises a unit 130 (TRACE GEN) configured to generate a program trace. A program trace is understood to mean a set of information enabling a distinction between instructions that have not been executed and instructions that have been executed by the program. The program trace is generated during the execution of the program. The trace then makes it possible to distinguish between instructions that have not been executed and instructions that have already been executed by the program.
[0045] The system 100 further comprises a device 150 connected, preferably connected, to the device 110. The device 150 makes it possible to test the operation of the device 110 before it is used in an application. The device 150 may be a test platform, or a development platform for the programmable device 110. For example, the device 150 also makes it possible to program the programmable device 110. According to one embodiment, the device 150 comprises a memory 152 (TRACE MEM) intended to receive the trace. The memory 152 is then external to the circuit 112. The device 150 may further comprise a circuit 153 (TEST) linked, preferably connected, to the memory 152. The circuit 153 preferably comprises a unit for executing software (i.e. another program) for testing the program contained in the memory 116. Such a unit may comprise a microprocessor.Alternatively, the circuit 153 makes it possible to transmit, for example via a communication network, the contents of the memory 152 to another circuit, not shown, configured to implement the test software.
[0046] The device 110 and / or the device 150 may further comprise a debugging unit (in English "debugger unit") not shown, typically intended to allow the execution of the program step by step and / or to generate information concerning the value of variables of the program and / or to set up breakpoints in the program.
[0047] In operation, the program is implemented once, or several times, preferably with different data values used by the program. The program instructions are executed by the unit 114. The trace is generated by the unit 130 during the implementation(s) of the program. The trace obtained is stored in the memory 152. From the trace stored in the memory 152, the circuit 153 determines, for example by implementing the test software, whether some of the instructions were not executed during the implementation of the program, and possibly, if so, which these instructions are.
[0048] There figure 2 represents, by a partial and schematic view of the program memories 116 (PROG) and trace storage 152 (TRACE MEM) of the device of the figure 1 , an embodiment of a method implemented during the execution of instructions of the program. In particular, the execution is implemented by the circuit 112. More precisely, the program is executed one or more times and the circuit 130 generates the trace in the manner described in relation to the figure 1 .
[0049] The memory 116 comprises successive I instructions of the program. Four I instructions (I1, I2, I3 and I4) are shown for illustrative purposes, but the described embodiments apply to any number of instructions of the program.
[0050] Unit 114 typically comprises a program counter PC, also called an instruction pointer or ordinal counter. The program counter PC here designates a register which contains the memory address of the start of the instruction currently being executed. However, as a variant, this register may contain the memory address of the start of the instruction to be executed after the instruction currently being executed. In the example shown, the program counter contains the memory address of the start of instruction I2.
[0051] Memory areas 154 (154-1, 154-2, 154-3, 154-4), each consisting of one or more bits of memory 152, are selected from the positions of the instructions I. By positions of the instructions, we mean values having the same order as that of the instructions in memory 116. Thus, the memory areas 154 are determined according to the positions of the instructions in the memory. Each instruction I of the program is thus associated with one of the areas 154. Distinct instructions correspond to distinct and disjoint areas 154, that is to say without a common part. Preferably, as shown, the areas 154 are placed in memory 152 in the same order as the instructions I in memory 116. This is not limiting, the areas 154 can be placed in a different order.
[0052] The position of each instruction can be defined by the memory address of the start of the instruction. During program execution, each memory area 154 can then be selected based on the memory address of the start of the executed instruction. In other words, the memory address of the start of the area 154 associated with the executed instruction can be determined from the PC program counter.
[0053] Before the implementation(s) of the program for generating the trace, the trace memory 152 is filled with first values, more preferably the same first value, for example a low logic level (0). This is not limiting, the first values being able to be the values initially contained in the trace memory.
[0054] For each executed instruction, a second value different from the first value is stored. In the example of a first value at a low logic level, the second value preferably has a high logic level (1). Thus, the areas 154 associated with the instructions I not yet executed (in the example shown, the areas 154-3 and 154-4 associated with instructions I3 and I4) contain the first value. The areas 154 associated with the instructions I already executed (in the example shown, the areas 154-1 and 154-2 associated with instructions I1 and I2) contain the second value. In particular, the areas 154 associated with instructions I that have already been executed several times contain the second value. This is not limiting; in particular, several second values different from the first value can be used for various executions of the instruction.
[0055] After the trace has been obtained, for each of the areas 154 associated with at least one part of the program, the circuit 153, for example by executing the test software, checks whether the area 154 contains the or one of the second values, or detects whether the area 154 contains the first value. If one of the areas 154 contains the first value, this means that the associated instruction has not been executed. The circuit 153 thus detects, if applicable, the presence of unexecuted instructions.
[0056] One might have thought that a trace could be obtained by recording the successive positions of the PC program counter. However, because instructions are repeated, the trace thus recorded would have occupied a memory space, for example of several gigabytes, much larger than that of the trace obtained by the method described above.
[0057] By comparison, obtaining a trace in memory areas selected from the positions of the program instructions makes it possible to limit the size of the trace. In particular, it avoids having to copy the address of the executed instruction into the trace storage memory. Thus, the size of the trace can be less than, for example, 100 kilobytes, or even 10 kilobytes. More particularly, the size of the trace depends only on the size of the program, and does not depend on the execution time of the test. In one example, the size of the trace is equal to one-eighth of that of the program. A trace storage memory 152 has thus been advantageously obtained having a size considerably smaller than that of the trace storage memories obtained by recording the successive positions of the executed instructions.
[0058] Preferably, the program is designed so that all the instructions of the program are executed. This makes it possible to avoid, in particular, that unexecuted parts of the program could constitute entry points for an attack or risk causing the program to enter into unknown behavior. Such an attack would aim, for example, to cause the execution of another program allowing the attacker to take control of the device 110. In order to verify that the program obtained in practice has indeed all its instructions executed, one or more validation tests are typically provided in which it is necessary to verify that 100% of the instructions are executed when the program is executed during the test(s) with predefined data used by the program.
[0059] Circuit 153 then makes it possible to verify that the program obtained in practice has all its instructions executed. Thus, the trace obtained by the method described above allows the device to successfully pass the validation test.
[0060] The instructions I are associated in a one-to-one manner with the selected areas 154, i.e. each selected area 154 is associated with one and only one instruction I. In the event of detection of one or more areas 154 associated with one or more unexecuted instructions, this makes it possible to identify, from this or these areas 154, the unexecuted instruction(s). This allows the unexecuted instruction(s) to be signaled by the circuit 153. The information concerning the unexecuted instruction(s) can be used, for example, to modify the program, or to modify the test(s) or define new tests, so that all its instructions are executed after modification. This information can also be used to determine a level of risk of attack or unknown behavior of the program due to the unexecuted instructions.
[0061] Preferably, the areas 154 are contiguous in the memory 152. Thus, the areas 154 associated with the instructions correspond to a continuous range, or to the entirety, of the memory 152. Compared to a variant in which areas 154 are separated by spaces, this allows that, once the trace is obtained, all the areas of the range containing the first value correspond to an unexecuted instruction. Thus, the detection of unexecuted instructions is facilitated compared to separate areas 154.
[0062] Preferably, the storage of the trace is carried out in parallel with the execution of the instructions, that is to say that, for each executed instruction, the selection of the zone 154 and the storage of the second value in the memory 152 are carried out during the execution of the instruction. This advantageously makes it possible to obtain the trace without slowing down the execution of the program.
[0063] There figure 3 represents, schematically and in block form, an embodiment of a programmable device 300. The device 300 comprises elements identical or similar to those of the system 100 of the figure 1 , related in an identical or similar manner. These elements are not described here again, and only the differences are highlighted.
[0064] The device 300 comprises the elements of the device 110 of the figure 1 , namely the memories 116 and 120 and the units 114 and 130 included in the circuit 112. The programmable device 300 differs from the programmable device 110 of the figure 1 in that the integrated circuit 112 comprises the memory 152 and a circuit 353 (TEST). The circuit 353 replaces the circuit 153 of the figure 1 and is configured to implement all or part of the functions of circuit 153.
[0065] As mentioned above, the memory 152 has a reduced size. This has the advantage of facilitating the integration of the memory 152 into the integrated circuit 112. Such a memory 152 internal to the circuit 112 allows, compared to an external memory such as that of the figure 1 , to simplify the writing of data, in particular to do without a clock external to the device 110 ( figure 1 ) intended to synchronize the writing of the trace in the memory 152. This also makes it possible to avoid the risk of losing part of the trace following, for example, synchronization problems and / or congestion of the connection between the circuit 130 and the memory 152. Such congestion can occur, for example, if this connection comprises a connection bus between several electronic devices. This also makes it possible to advantageously reduce the number of pins on the package of the integrated circuit 112, because the connection between the circuit 130 and the memory 152, allowing the parallel transfer of several bits, is then a connection 310 internal to the integrated circuit 112.
[0066] The storage of a trace in parallel with the execution of the program instructions can be carried out outside of a program validation test, for example during the operation of the programmable device 300 in an application. This has the advantage of making it possible to monitor the operation of the program implemented in the application. The fact that the memory 152 is internal to the circuit 112 makes it possible to simplify obtaining the trace of the program when it is implemented in the application.
[0067] There figure 4 represents, schematically and in block form, another embodiment of a system 400 comprising a programmable device 410. The system 400 further comprises a device 450. The devices 450 and 410 comprise elements of the system 100 of the figure 1 , related in an identical or similar manner. These elements are not described here again, and only the differences are highlighted.
[0068] Device 450 corresponds to device 150 of the figure 1 , in which the memory 152 has been replaced by a memory 452 (MEM) adapted to receive the trace obtained and to store this trace. In particular, for each of the zones 154 of the memory 152 associated with at least one part of the program, the circuit 153 of the device 450 checks whether an area of the memory 452 corresponding to the area 154 contains the or one of the second values, or detects whether this area of the memory 452 contains the first value.
[0069] The programmable device 410 comprises the elements of the device 110 of the figure 1 , namely the memories 116 and 120 and the units 114 and 130 included in the circuit 112. The programmable device 410 differs from the programmable device 110 of the figure 1 in that the integrated circuit 112 comprises the memory 152. The device 410 is intended to be connected to the memory 452, external to the device 410. The device 410 is configured to, once connected to the memory 452 and once the trace has been obtained, transmit the trace, i.e. the content of the zones 154 ( figure 2 ), to memory 452.
[0070] The device 450 may have the same functionalities as the device 150 of the figure 1 . Furthermore, because the memory 152 is internal to the circuit 112, the advantage mentioned in connection with the figure 3 , to avoid the risk of losing part of the trace due to synchronization and / or congestion problems. We therefore benefit from both this advantage and the functionalities of a test platform.
[0071] In a variant, the device 450 further comprises the circuit 353 of the device 300 of the figure 3 .
[0072] There figure 5 represents, by a partial and schematic view of an embodiment of the program memories 116 and trace storage 152 of the device of the figure 1 , another embodiment of the method of the figure 2 .
[0073] The memory 116 comprises successive memory locations 510. By memory locations is meant distinct parts of a memory each having a predefined number of bits, in other words a predefined size. All locations preferably have the same size. Eight successive locations 510 are shown.
[0074] The size of the locations 510 is preferably chosen so that the size of each instruction, i.e. the number of bits occupied by the instruction in the memory 116, is a multiple of the size of the locations 510. In the example shown, instructions 520 occupy a single location 510, and instructions 522 occupy two locations 510. Instructions may occupy a number of locations 510 greater than two. In the example shown, the size of the locations is sixteen bits.
[0075] The locations form groups 530 of locations, with only one group 530 being shown. Successive groups 530 have the same number of locations, eight locations in the example shown. The locations of each group 530 are positioned at respective addresses. In the example shown, these addresses, expressed in bytes, have the values 0x...0, 0x...2, 0x...4, 0x...6, 0x...8, 0x...A, 0x...C, and 0x...E, where the prefix "0x" means that the following digits are in hexadecimal notation, and "..." represents non-detailed digits depending on the group 530 considered. In addition, the PC program counter has been shown when an instruction positioned at address 0x...4 is executed.
[0076] The trace storage memory 152 comprises locations 540. Only one location 540 is shown. Preferably, the locations 540 are memory word locations, i.e., each location 540 has the size of a word in the memory 152. In the example shown, each location 540 has a size of sixteen bits. Thus, the address of the location 540 in the memory 152 is represented by the value of the bits PC[>3] of the program counter PC of rank strictly greater than three, the ranks of the bits being defined starting from zero from the least significant bit.
[0077] Each area 154 of the memory 152 is at least partly included in one of the locations 540. The areas 154 selected from instructions occupying the same group 530 of the memory 116 occupy the same location 540 of the memory 152. More precisely, for each instruction, the area 154 associated with the instruction comprises the same number N of bits for each of the locations 510 occupied by the instruction. In other words, the area 154 comprises for each location a sub-part 550 of N bits. Thus, for each instruction, the size of the associated area 154 is the result of multiplying the number N by the number of locations occupied by the instruction. In an example not shown, the number N is equal to one. In the example shown, the number N is equal to two. Thus, in the example shown, the position of area 154 in location 540 is defined by the three least significant bits PC[3:1] of the program counter PC.
[0078] In one variant, the areas 154 selected from instructions of different sizes have the same number of bits. However, compared to such a variant, providing the same number of bits N of the areas 154 for each location 510 makes it possible to simplify the manner of selecting the areas 154 from the positions of the instructions, as illustrated in the above example of using the bits of the PC counter.
[0079] Preferably, when an instruction occupying several locations is executed, the value written in the area 154 includes the same bits in each of the sub-parts 550. In other words, the same bit values are written in the sub-parts 550 of the area 154. For example, in the case of sub-parts 550 with a single bit and contents of the memory 152 with a zero value before execution of the program, all the bits of the area 154 are set to a value of one.
[0080] Alternatively, a value is written only in one of the sub-parts 550 of the zone 154, for example the least significant sub-part of the zone 154 considered. However, compared to such a variant, writing the same bits in the sub-parts 550 makes it possible to avoid, in the trace obtained, parts of the memory 152 containing the zero value actually corresponding to locations of executed instructions. This facilitates the use of the trace to detect unexecuted instructions.
[0081] To write a value in the area 154 associated with the executed instruction, a word is written in the location 540, which word includes, outside the area 154 in question, the contents of the location 540 before writing. Thus, outside the area 154 associated with the executed instruction, the contents of the location 540 are not modified during this writing. This makes it possible to write the value in the area 154 in question without modifying the contents of the other areas 154. For this purpose, in the case where the contents of the location 540 are at the zero value before execution of the program, the memory 152 is, for example, configured so that only unmasked bits are written in each of the locations. A mask may be used having zero bits outside the bits to be written. The writing is then carried out using a word containing zero bits outside the area 154 in question, and using the word to be written as a mask.Preferably, the memory is configured so that only the bits having a non-zero value are written to the location 540 in question, the other locations being left at zero value. Alternatively, a bitwise OR function can be implemented with the contents of location 540 before writing. The word used thus also acts as a mask. However, compared to such a variant, the use of a memory in the manner described above makes it possible to avoid read access to the memory, and therefore makes it possible to write the desired value more quickly to the area 154.
[0082] According to one embodiment, several instructions of the same group are executed simultaneously. A word is then written comprising, outside the areas 154 associated with these instructions, the contents of the location 540 before writing. Preferably, each word location 540 comprises several areas 154. This makes it possible to write simultaneously in all the areas 154 associated with the instructions executed simultaneously. It is thus easy to obtain the trace simultaneously with the execution of the program.
[0083] Although word locations 540 of sixteen bits have been shown, the described embodiments are compatible with other sizes of the locations 540. The number of locations 510 of each group 530 is then defined as a function of the size of the locations 540 and the number N, so that the areas 154 associated with the instructions of the same group entirely occupy a single location 540. In particular, in a preferred embodiment, different from the example shown, each location 540 has 32 bits, and each group 530 has 16 locations.
[0084] For some instructions (G?I), the execution of the instruction may depend on the Boolean value of a predicate, also called a guard. The instruction is then called a predicated instruction or a guarded instruction. Such predicated instructions allow, for example, the execution of parts of the program to depend on the results of conditional tests, without making conditional jumps between parts of the program. For other instructions in the program (I), the execution does not depend on a predicate.
[0085] In the case of a program comprising predicate instructions, it is preferred that the number N be equal to 2, as in the example shown. The value written in the zone 154 associated with an executed instruction therefore comprises, for each subpart 550, first and second bits, for example a low-order bit and a high-order bit. Preferably, the first bit is set to the value one if the predicate is set to the value "true", and the second bit is set to the value one if the predicate is set to the value "false". Preferably, for an instruction without a predicate, the first and second bits are both set to the value one.
[0086] Preferably, to write the value in the zone 154, a word is written in the location 540 comprising, apart from the bits set to the value one, the contents of the location 540 before writing. For this, preferably, the contents of the location after writing result from a bitwise OR function between the contents of the location before writing and a mask comprising bits at the value zero apart from the bits to be set to the value one.
[0087] Because the 550 subparts are made up of two bits, a trace can be obtained that distinguishes between instructions that have not been executed, instructions that have been executed only for their predicate with the value "true", instructions that have been executed only for their predicate with the value "false", and instructions that have been executed for both values of their predicate. At the same time, the advantages of predicate instructions can be benefited from, such as a gain in speed in the execution of certain program loops and a simplification of the management of conditional branches of the program.
[0088] There figure 6 represents, by a partial and schematic view of an embodiment of the program memories 116 and trace storage 152 of the device of the figure 1 , another embodiment of the method of the figure 2 . The method of realization of the figure 6 incorporates elements, identical or similar, to those of the embodiment of the figure 5 These elements are not described again in detail and only the differences are highlighted.
[0089] The memory 152 comprises two separate memory banks 152H (TRACE MSB) and 152L (TRACE LSB). More preferably, the banks 152H and 152L correspond respectively to high-order bits and low-order bits of the locations 540 of the memory 152. As in figure 5 , an example of an eight-bit location 540 is shown. However, locations 540 are preferably 16 bits.
[0090] As in the embodiment of the figure 5 , the program may comprise instructions of several different sizes, for example 16, 32 and 48 bits, occupying several locations 510 of the program memory 116. Furthermore, instructions may be executed in parallel. In other words, parts 610 of the program memory 116 each comprise one or more locations 510, and, in each part 610 comprising several instructions, the instructions are executed simultaneously. Each part 610 is then associated with one or more areas 154 of the memory 152 in which it is desired to write values simultaneously.
[0091] Among the parts 610, a part 610A is shown, located between distinct groups 530 (530-1 and 530-2) of locations 510 of the memory 116. The zone(s) 154 associated with the part 610A are in a part 620 of the memory 152 located between distinct locations 540 (540-1 and 540-2).
[0092] The bits of part 620 located in location 540-1 are located in bank 152H and the bits of part 620 located in location 540-2 are located in bank 152L. Because these banks are separate, values corresponding to the fields 154 associated with the executing part 610A can be written simultaneously to the separate locations 540-1 and 540-2.
[0093] Compared to the method of realization of the figure 5 , the fact of carrying out the storage simultaneously in the separate locations 540-1 and 540-2 makes it possible to avoid carrying out the two storages sequentially while the instructions of the part 610A are executed. This advantageously allows the use of memories less fast than the memory 152 and / or avoids providing that the program does not contain a part 610A straddling two groups 530 of locations 510.
[0094] Although an embodiment comprising two memory banks has been described, this embodiment is compatible with a larger number of memory banks, each comprising bits of different weights among the bits of locations 540.
[0095] Various embodiments and variations have been described. Those skilled in the art will understand that certain features of these various embodiments and variations could be combined, and other variations will occur to those skilled in the art.
[0096] Finally, the practical implementation of the embodiments and variants described is within the reach of those skilled in the art from the functional indications given above.
Claims
1. A method suitable for detecting executed and / or nonexecuted instructions of a program, comprising selecting memory zones (154) in a trace storage memory (154) based on positions, in a program memory (116), of instructions of a program such that each of said instructions is associated with one of the memory zones, a memory zone being associated with a single instruction, the instructions each occupying one or more locations (510) of the program memory (116), and each memory zone (154) comprising, for each location (510) occupied by the instruction in the program memory (116), a same number of bits (N), preferably equal to one or two, the trace storage memory being filled with first values, the method comprising the execution of at least one part of said instructions and, for each executed instruction, the storage of a second value different from the first value in one of said zones (154) associated with the executed instruction; and, after said execution, a step of verifying the presence of said second value in each of said zones (154) and / or the detection of the absence of said second value in one of said zones (154).
2. The method according to claim 1, wherein each of said zones comprises at least one first bit and at least one second bit, said second value comprising: - the value one in the location of the first bit if the executed instruction has a predicate to the value "true"; - the value one in the location of the second bit if the executed instruction has a predicate to the value "false"; and - the value one in the locations of the first and second bits if the executed instruction is not an instruction with predicate.
3. The method according to claim 2, wherein the storage is done in parallel with said execution.
4. The method according to any of claims 1 to 3, wherein the storage is done simultaneously for instructions executed simultaneously.
5. The method according to any of claims 1 to 4, wherein said storage comprises writing, in a memory word location (540) comprising at least one of said zones (154), a word having, outside said at least one of said zones (154), the content of said memory word location (540) before the writing.
6. The method according to any of claims 1 to 5, wherein said zones (154) are located in at least two distinct memory banks (152H, 152L).
7. The method according to claim 6, wherein the memory word location (540) has least significant bits located in one of the two banks (152L) and most significant bits located in the other of the two banks (152H).
8. A device (110; 300; 410) configured to carry out a method according to any of claims 1 to 7, and comprising: - a program memory (116) comprising the instructions of a program; - an integrated circuit (112) comprising a data processing unit (114) suitable for executing the program instructions and a program trace generation unit (130) suitable for generating a program trace; and - a trace storage memory (152) destined to receive the program trace and comprising memory zones (154), the trace storage memory (152) being filled with first values, the program trace generation unit (130) being configured, for each instruction executed by the date processing unit (114), to: - store a second value different from the first value in one of said zones associated with the executed instruction; and - after said execution, perform a step of verifying the presence of the second value in each of said zones (154) and / or of detecting the absence of said second value in one of said zones (154).
9. The device (110; 300; 410) according to claim 8, comprising: - a data memory (120); and / or - a test circuit (153) for testing program content in the program memory (116).
10. The device (400) according to claim 8 or 9, configured to be coupled to a memory (452) external the circuit and to transmit the content of said zones (154) to the external memory (452).
11. A system (400) comprising the device (410) according to claim 10 and a test device (450) comprising the external memory (452), said test device being configured to receive the contents of said zones (154) and to write the contents of said zones (154) in said external memory (452).
12. The device according to claim 10 when dependent on claim 2, configured to verify the presence of said second value in the content of each of said zones (154) and / or the detection of the absence of said second value in one of said contents.
