Hardware is sometimes developed using tools that specify its functionality and its potential structure. These tools process code similar to the programming language C. Each logic block may be described by the function or the operation that the logic block will perform once created as part of a semiconductor integrated circuit or another type of circuit. As an example, a logic block may be created to perform a multiply operation on two variables. To reduce the size of the logic needed to implement the operation and store the inputs and outputs, the bit-size of each of the variables is sometimes reduced. The reduction in the bit-size may reduce the number of memory cells needed to store the values corresponding to the variables.
Such reduction of the bit-size can, however, produce adverse results including undefined behavior and incorrect outputs.
In one example, the present disclosure relates to a method including receiving code corresponding to at least one block of the hardware module, wherein the code providing at least a first value for a first variable, a second value for a second variable, or an operation to be performed using at least one of the first variable or the second variable. The method may further include automatically generating an exception detector to determine whether an overflow condition is triggered by at least one of the operation, the first variable, or the second variable.
In another aspect, the present disclosure relates to a computer-readable medium comprising instructions corresponding to a method. The method may include receiving code corresponding to at least one block of the hardware module, wherein the code providing at least a first value for a first variable, a second value for a second variable, or an operation to be performed using at least the first variable or the second variable. The method may further include automatically generating an exception detector to determine whether an overflow condition is triggered by at least one of the operation, the first variable, or the second variable. The method may further include during processing of the code corresponding to the at least one block of the hardware module, based on the exception detector indicating that the overflow condition is triggered by the at least one of the operation, the first variable, or the second variable, automatically providing at least one of: (1) a first user-defined value for replacing the first value for the first variable triggering the overflow condition, (2) a second user-defined value for replacing the second value for the second variable triggering the overflow condition (3) at least one user-defined relationship among values corresponding to any of variables triggering the overflow condition, (4) a value for replacing a result of the at least one operation triggering the overflow condition, (5) a third variable for replacing the first variable triggering the overflow condition, or (6) a fourth variable for replacing the second variable triggering the overflow condition.
In yet another aspect, the present disclosure relates to a system comprising at least one processor and at least one memory including instructions. The instructions may be for: (1) receiving code corresponding to at least one block of the hardware module, wherein the code providing at least a first value for a first variable, a second value for a second variable, or an operation to be performed using the first variable or the second variable, (2) automatically generating an exception detector to determine whether an overflow condition is triggered by at least one of the operation, the first variable, or the second variable, and (3) during processing of the code corresponding to the at least one block of the hardware module, despite the exception detector indicating that the overflow condition is triggered by the at least one of the operation, the first variable, based on a value of at least one marker embedded in the code ignoring the overflow condition.
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
The present disclosure is illustrated by way of example and is not limited by the accompanying figures, in which like references indicate similar elements. Elements in the figures are illustrated for simplicity and clarity and have not necessarily been drawn to scale.
Examples described in this disclosure relate to systems and methods for automatic generation of an exception detector during development of a hardware module. Hardware modules include, but are not limited to Field-Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application-Specific Standard Products (ASSPs), System-on-a-Chip systems (SoCs), Complex Programmable Logic Devices (CPLDs), Digital-Signal Processors (DSPs) or other similar hardware modules. Hardware modules such as FPGAs, ASICs, ASSPs, SoCs, and CPLDs are developed using electronic design automation (EDA) tools that may specify various logic blocks of the hardware modules. Each logic block may be described based on the function or the operation that the logic block will perform once created as part of a semiconductor integrated circuit or another type of circuit. As an example, a logic block may be created to perform a multiply operation on two variables. In this disclosure, a “variable” may refer to an input on which any operation, such as a sum operation, a multiply operation, or any other type of operation may be performed. The term “variable” may refer to an output of any operation as well. The term “variable” further includes inputs or outputs that may be constants. The level of abstraction for the description of the logic blocks may be dictated by the type of user of the EDA tools. As an example, software programmers may prefer an EDA tool that lets them develop a hardware module in a code similar to the programming language C.
Each logic block of a hardware module may be described based on the function or the operation that the logic block will perform once formed as part of a semiconductor integrated circuit or another type of circuit. As an example, a logic block may be designed to perform a multiply operation on two variables. As part of a high-level representation of the hardware module, to reduce the size of the logic needed to implement the operation, the bit-size of each of the variables may be reduced. Such reduction of the bit-size can, however, produce adverse results including undefined behavior and incorrect outputs. The present disclosure provides systems and methods that may, upon detection of an error condition such as overflow, generate code to perform an “emergency stop” of during simulation of the logic block corresponding to the hardware module. In addition, the systems and methods may expose internal state or inputs to the developer of the hardware to diagnose the problems caused by error conditions, such as an overflow. This may advantageously allow catching of such errors at an earlier stage during the development of the hardware and the diagnosing of exactly which variables may need to be enlarged or changed otherwise. As an example, a high-level synthesis (HLS) compiler can detect the possibility for an overflow (or lack thereof) during compilation. In this example, if the HLS compiler is generating the code for an addition operation with an operand width of X number of bits for one argument and Y number of bits for the other argument, there is a possibility for overflow if and only if the result is stored in a variable whose bit size is less than MAX (X, Y)+1. A more advanced compiler may propagate bit size constants through the code, so if one of the operands is bit masked to a smaller size, shifted right, etc. a potential overflow could be detected during compile time. Table 1, below, shows example code for addition operations where integer overflow may occur.
Table 2, below, shows an example code for addition operations where integer overflow is not possible.
System 104 may generate code corresponding to a first-level representation of the hardware module. In this example, the first-level representation of the hardware module may be code corresponding to an intermediate-level representation 106 of the hardware module. In one example, intermediate-level representation 106 of the hardware module may correspond to register-transfer level code in a language, such as Verilog or VHDL. As an example, Table 4 below shows an example Verilog code corresponding to intermediate-level representation 106 of the code.
Consistent with another example, Table 5 below shows example code corresponding to high-level representation of an array-related operation.
Intermediate-level representation 106 of the hardware module may be processed using a synthesis module 108 to generate a low-level representation 110 of the hardware module. Low-level representation 110 of the hardware module may be logic netlist or a similar low-level representation that can be further processed to create chip-level schematics for the hardware module to develop hardware 120 corresponding to the hardware module. In another example, system 104 may process the first-level code to generate code corresponding to the hardware module. Although
With continued reference to
With continued reference to
The exception may include not only an indication of an overflow condition, but also an error type (e.g., e.Type in Table 3), a line number corresponding to the operation or the variable that caused the exception (e.g., e.Line in Table 3), and an original value corresponding to the variable or the result that cause the exception (e.g., e.OriginalValue in Table 3). In addition, upon detection of an error condition, such as overflow, system 104 may also generate code for performing an “emergency stop” of the processing of the high-level representation of the logic block corresponding to the hardware module. Hardware 300 or 400 generated from the code may perform the emergency stop based on the code generated by system 104 as part of this step. System 104 may further generate code to expose internal states and inputs (e.g., the variables) to the developer to allow the developer to debug the high-level representation 102 of the hardware module. System 104 may expose the internal states and inputs relating to hardware 300 and hardware 400 to the developer during the development cycle. Although
In conclusion, the present disclosure relates to a method including receiving code corresponding to at least one block of the hardware module, wherein the code providing at least a first value for a first variable, a second value for a second variable, or an operation to be performed using at least one of the first variable or the second variable. The method may further include automatically generating an exception detector to determine whether an overflow condition is triggered by at least one of the operation, the first variable, or the second variable.
The method may further include the exception detector determining a location in the code of a variable or an operation that triggered the overflow condition. In addition, the method may further include during processing of the code corresponding to the at least one block of the hardware module, based on the exception detector indicating that the overflow condition is triggered by the at least one of the operation, the first variable, or the second variable, automatically generating an exception. The automatically generating the exception may further include providing at least one message comprising (1) a first location in the code of the operation, to be performed using the first value for the first variable and the second value for the second variable, that triggered the overflow condition or (2) a second location in the code related to: (a) providing the first value for the first variable that triggered the overflow condition or (b) providing the second value for the second variable that triggered the overflow condition. The automatically generating the exception may further include providing at least one message comprising at least one of: (1) an original value for the first variable that triggered the overflow condition or (2) an original value for the second variable that triggered the overflow condition. In addition, the method may further include during processing of the code corresponding to the at least one block of the hardware module, requiring evaluation of an optional marker associated with at least one of the first variable, the second variable, the at least one operation, a variable for storing a result of the at least one operation, or a portion of the code corresponding to the at least one block of the hardware module.
The method may further include suppressing the at least one message based on a result of the evaluation of the optional marker. The optional marker may comprise an annotation indicating whether an overflow condition is expected with respect to the at least one of the first variable, the second variable, the at least one operation, the variable for storing the result of the at least one operation, or the portion of the code corresponding to the at least one block of the hardware module.
The method may further include automatically processing the code corresponding to the at least one block of the hardware module to generate a low-level representation of the code comprising at least one of timing information or routing information for the at least one block of the hardware module.
In another aspect, the present disclosure relates to a computer-readable medium comprising instructions corresponding to a method. The method may include receiving code corresponding to at least one block of the hardware module, wherein the code providing at least a first value for a first variable, a second value for a second variable, or an operation to be performed using at least the first variable or the second variable. The method may further include automatically generating an exception detector to determine whether an overflow condition is triggered by at least one of the operation, the first variable, or the second variable. The method may further include during processing of the code corresponding to the at least one block of the hardware module, based on the exception detector indicating that the overflow condition is triggered by the at least one of the operation, the first variable, or the second variable, automatically providing at least one of: (1) a first user-defined value for replacing the first value for the first variable triggering the overflow condition, (2) a second user-defined value for replacing the second value for the second variable triggering the overflow condition (3) at least one user-defined relationship among values corresponding to any of variables triggering the overflow condition, (4) a value for replacing a result of the at least one operation triggering the overflow condition, (5) a third variable for replacing the first variable triggering the overflow condition, or (6) a fourth variable for replacing the second variable triggering the overflow condition.
The automatically providing may further comprise providing at least one message comprising (1) a first location in the code of the operation, to be performed using the first value for the first variable and the second value for the second variable, that triggered the overflow condition or (2) a second location in the code related to: (a) providing the first value for the first variable that triggered the overflow condition or (b) providing the second value for the second variable that triggered the overflow condition. The automatically providing may further comprise providing at least one message comprising at least one of: (1) an original value for the first variable that triggered the overflow condition or (2) an original value for the second variable that triggered the overflow condition.
The computer-readable medium may also comprise instructions for the method to include the exception detector determining a location in the code of a variable or an operation that triggered the overflow condition. The computer-readable medium may also comprise instructions for the method to include during the processing of the code corresponding to the at least one block of the hardware module, requiring evaluation of an optional marker associated with at least one of the first variable, the second variable, the at least one operation, a variable for storing a result of the at least one operation, or a portion of the code corresponding to the at least one block of the hardware module.
The computer-readable medium may also comprise instructions for the method to include suppressing the at least one message based on a result of the evaluation of the optional marker. The optional marker may comprise an annotation indicating whether an overflow condition is expected with respect to at least one of the first variable, the second variable, the at least one operation, the variable for storing the result of the at least one operation, or the portion of the code corresponding to the at least one block of the hardware module.
The computer-readable medium may also comprise instructions for the method to include automatically processing the code corresponding to the at least one block of the hardware module to generate a low-level representation of the code comprising at least one of timing information or routing information for the at least one block of the hardware module.
In yet another aspect, the present disclosure relates to a system comprising at least one processor and at least one memory including instructions. The instructions may be for: (1) receiving code corresponding to at least one block of the hardware module, wherein the code providing at least a first value for a first variable, a second value for a second variable, or an operation to be performed using the first variable or the second variable, (2) automatically generating an exception detector to determine whether an overflow condition is triggered by at least one of the operation, the first variable, or the second variable, and (3) during processing of the code corresponding to the at least one block of the hardware module, despite the exception detector indicating that the overflow condition is triggered by the at least one of the operation, the first variable, based on a value of at least one marker embedded in the code ignoring the overflow condition.
The at least one memory may further comprise instructions for the exception detector determining a location in the code of a variable or an operation that triggered an overflow condition. The at least one memory may further comprise instructions for, during processing of the code corresponding to the at least one block of the hardware module, based on the exception detector indicating that the overflow condition is triggered by the at least one of the operation, the first variable, or the second variable, automatically generating an exception wherein the at least one message further comprising (1) a first location in the code of the operation, to be performed using the first value for the first variable or the second value for the second variable, that triggered the overflow condition or (2) a second location in the code related to: (a) providing the first value for the first variable or (b) providing the second value for the second variable.
It is to be understood that the methods, modules, and components depicted herein are merely exemplary. Alternatively, or in addition, the functionality described herein can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include Field-Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application-Specific Standard Products (ASSPs), System-on-a-Chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc. In an abstract, but still definite sense, any arrangement of components to achieve the same functionality is effectively “associated” such that the desired functionality is achieved. Hence, any two components herein combined to achieve a particular functionality can be seen as “associated with” each other such that the desired functionality is achieved, irrespective of architectures or inter-medial components. Likewise, any two components so associated can also be viewed as being “operably connected,” or “coupled,” to each other to achieve the desired functionality.
The functionality associated with the examples described in this disclosure can also include instructions stored in a non-transitory media, e.g., memory 220 or other types of non-transitory media. The term “non-transitory media” as used herein refers to any media storing data and/or instructions that cause a machine, such as processor 210, to operate in a specific manner. Exemplary non-transitory media include non-volatile media and/or volatile media. Non-volatile media include, for example, a hard disk, a solid-state drive, a magnetic disk or tape, an optical disk or tape, a flash memory, an EPROM, NVRAM, PRAM, or other such media, or networked versions of such media. Volatile media include, for example, dynamic memory, such as DRAM, SRAM, a cache, or other such media. Non-transitory media is distinct from, but can be used in conjunction with, transmission media. Transmission media is used for transferring data and/or instruction to or from a machine, such as processor 100. Exemplary transmission media, include coaxial cables, fiber-optic cables, copper wires, and wireless media, such as radio waves.
Furthermore, those skilled in the art will recognize that boundaries between the functionality of the above described operations are merely illustrative. The functionality of multiple operations may be combined into a single operation, and/or the functionality of a single operation may be distributed in additional operations. Moreover, alternative embodiments may include multiple instances of a particular operation, and the order of operations may be altered in various other embodiments.
Although the disclosure provides specific examples, various modifications and changes can be made without departing from the scope of the disclosure as set forth in the claims below. Accordingly, the specification and figures are to be regarded in an illustrative rather than a restrictive sense, and all such modifications are intended to be included within the scope of the present invention. Any benefits, advantages, or solutions to problems that are described herein with regard to a specific example are not intended to be construed as a critical, required, or essential feature or element of any or all the claims.
Furthermore, the terms “a” or “an,” as used herein, are defined as one or more than one. Also, the use of introductory phrases such as “at least one” and “one or more” in the claims should not be construed to imply that the introduction of another claim element by the indefinite articles “a” or “an” limits any particular claim containing such introduced claim element to inventions containing only one such element, even when the same claim includes the introductory phrases “one or more” or “at least one” and indefinite articles such as “a” or “an.” The same holds true for the use of definite articles.
Unless stated otherwise, terms such as “first” and “second” are used to arbitrarily distinguish between the elements such terms describe. Thus, these terms are not necessarily intended to indicate temporal or other prioritization of such elements.
Number | Date | Country | |
---|---|---|---|
62421962 | Nov 2016 | US |