1. Technical Field
The present invention relates in general to a system and method for automatically adding hardware breakpoint logic to a hardware design model. In particular, the present invention relates to a system and method that automatically adds breakpoint hardware to the design and enables the user to set breakpoints without having to reload the design in the hardware simulator.
2. Description of the Related Art
With the ever increasing complexity and size (in terms of gate counts) of modern very large scale integrated circuits (VLSI), verifying the correctness of a design's architecture and implementation has become increasingly difficult and time consuming. Detecting design faults early is crucial. The longer an error takes to be detected and corrected, the more time consuming and costly a redesign becomes. Moreover, the longer an error takes to be detected and corrected, the longer it takes for the product to reach the marketplace.
Cycle simulation is a crucial and widely used technique for verifying hardware designs. A clock period (cycle) serves as the time quanta for simulation. During cycle simulation, the various hardware components are simulated on a cycle-by-cycle basis. Cycle simulation is thus able to identify particular hardware design errors, such as timing errors, that are difficult or impossible for software-based emulators to identify. Cycle simulation begins by constructing a gate or register transfer level (RTL) model of the design. The RTL model is often created using a synthesizable hardware description language (HDL). The inputs of this model are then stimulated with test vectors. Stimulating the model with test vectors causes the state of the machine—broadly defined as the values contained in the registers, latches, and memory elements—to change.
In software-based cycle simulation, simulation is executed on one or more computer systems with the state changes occurring in values stored in random access memory (RAM) of the computer systems. This form of simulation allows cycle-by-cycle visibility of the state to external checking mechanisms. These external checking mechanisms (also called external software checkers and test-benches) monitor the state and state changes of the simulated machine to ensure proper functional operation. Should a violation of one of the rules encoded in one of the checking mechanisms occur, the simulation can be halted and a trace of the events leading up to the error can be established.
A challenge of software-based cycle simulation is that the process can be very slow. Simulating complex designs with large gate counts exacerbates this challenge. Simulating a complex design often only allows simulating from tens to a few hundred cycles per second. In an era of gigahertz-class computer systems, simulating a large complex design can mean that months of simulation are required to simulate just one second of actual hardware time. As a result, errors which occur deep in the design which are visible only after thousands or millions of cycles of operation may go undetected. Failing to detect these errors often results in hardware being produced, at the cost of millions of dollars, that has errors.
Another challenge of slow simulation speeds is that it hinders software development for the software being developed to run on the hardware that is being designed. Software development occurs concurrently with hardware development. Running and debugging this software on an accurate hardware model is crucial to ensuring proper operation of the software. Slow simulation of hardware also hinders the development of related software. Because software may rely on very specific features and functions implemented in hardware, it is crucial to run and debug this software inside a cycle-accurate hardware simulation
In order to accelerate the process of cycle simulation, special purpose hardware is frequently used to simulate the design under test (DUT). Using a special purpose hardware simulator, the hardware design to be simulated is mapped into the gates and arrays of custom ASICs or FPGAs for simulation execution.
A challenge of using a specialized hardware simulator is minimizing communications between the hardware simulator and a host computer system. While these hardware simulators are often hundreds or thousands of times faster than using software-based cycle simulation, maximum performance can only be achieved when communication between the hardware simulator and the host across a service interface is minimized. A challenge of minimizing this communication is that cycle-by-cycle state changes are no longer visible to either external function checkers or to the software developer. As a result of the restricted debugging information available using hardware simulation, hardware simulation has traditionally been used in a limited fashion and predisposed to programs that are self-checking.
One approach to maximize simulation speed while minimizing communication between the host and the hardware simulator is writing some functional checks in a synthesizable HDL and compiling the functional checks into the simulation model. Because these “in-circuit” checks are hardware-based, they are simulated at the same speed as the design under test and do not require communication with the host until a test fails. Unfortunately, there are significant challenges using in-circuit checks. First, the in-circuit checks are limited in functionality and complexity as compared to software checkers that are written in a higher level language, such as C or C++. Second, in-circuit checks are expensive in terms of time and resources to prepare as compared to using software checkers. Finally, in-circuit checks require an intimate working knowledge of the hardware design—this is a skill that is not always available in verification teams whose staff may be more software oriented.
An alternative to writing an entire in-circuit check in hardware is to write simpler logic that defines a “breakpoint” signal or event. A breakpoint halts (freezes) the emulator when an event of interest (such as an assertion, test failure, or trigger) occurs. Once halted, the state of the simulator can be probed by sophisticated host-based software checkers and the state can be compared against expected values to ensure correct functional operation. Instead of having external software slow the simulation by probing on a cycle-by-cycle basis, breakpoints allow the simulator to run at full-speed until something interesting occurs.
In addition to facilitating accelerated hardware verification, breakpoints are also useful to software developers who need to test and debug their code on simulated hardware. While simulators allow simulation of millions of clock cycles necessary to run real software, the communications bottleneck prevents cycle-by-cycle visibility of key hardware resources without dramatically impacting the speed of the simulation. However, visibility of hardware resources such as general purpose registers (GPRs), the instruction counter (IC), the memory address register (MAR), and other resources are crucial to debugging software.
Instead of displaying the contents of all hardware resources every cycle, in-circuit hardware breakpoints can be used in a similar fashion to how breakpoints are used in a software debugger. Namely, a developer breaks on an interesting event and compares the state of the machine to its expected value.
A challenge to using breakpoints is that they are defined beforehand and are time consuming to change in order to break on a different event or signal. Breakpoints are defined beforehand, compiled into the simulation model, and mapped to a hardware simulator. Performing these steps is a lengthy process, often taking several hours to complete. If the developer wants different breakpoints during the course of debugging, the model must be recompiled. Finally, an additional challenge to using breakpoints is that they also require hardware expertise in order to write.
What is needed, therefore, is a system and method that allows breakpoints to be enabled and disabled as needed. Additionally, what is needed is a system and method that defines new breakpoints during hardware simulation without needing to recompile the hardware model.
A system and method addressing the foregoing challenges has been discovered that allows breakpoints to be enabled and disabled as needed. Additionally, the system and method defines new breakpoints during hardware simulation without needing to recompile the hardware model.
Hardware that enables programmable breakpoints is automatically generated. Resources (i.e., registers, instruction counter, memory areas, signals, nets, busses, etc.) included in the design under test (DUT) are identified as being useful for debugging purposes. These resources are “tagged” in the hardware description language (HDL) in a way so that the tags are retained in the netlist model.
The HDL is compiled into a netlist that includes the tags corresponding to the identified resources. A software program traverses the design to locate the tagged resources. For each tagged resource, logic is automatically constructed to generate signals based the resource. The signals are generated based on a comparison to, a change in, or the relative timing of the tagged resource. The values used for comparison to the tagged resource (or for comparison to a tagged resource triggered cycle count) are stored in registers that are also resources of the simulation model. These registers are programmable by using a standard put( ) command—provided by the simulator—to set a value. This value is retained in the simulated model during simulation until explicitly reprogrammed or disabled.
Signals output from the automatically generated logic associated with each tagged resource comprise “basic events.” For example, a basic event could be defined as a particular register being equal to a particular value (e.g., IAR=0x1234). This basic event would be triggered when IAR equals the hexadecimal value 0x1234. Basic events may be used as breakpoints. In addition, basic events may be combined to form more complex breakpoints.
The automatic generation of basic events eliminates the effort and HDL expertise required to manually design breakpoint logic and hardware checkers. At the same time, the automatically generated breakpoint logic operates at in-circuit speeds to maximize simulator performance. Furthermore, the power and flexibility of software-based checkers is harnessed but only when a particular event occurs that triggers a breakpoint. This avoids cycle-by-cycle observation over a relatively slow communication interface.
By using programmable values that are set using standard puto commands allows breakpoints to be enabled, disabled, and changed whenever desired without having to recompile the simulation model. In this manner, the speed of the hardware simulator is more fully harnessed while allowing the flexibility and interactivity of a standard software debugger.
The foregoing is a summary and thus contains, by necessity, simplifications, generalizations, and omissions of detail; consequently, those skilled in the art will appreciate that the summary is illustrative only and is not intended to be in any way limiting. Other aspects, inventive features, and advantages of the present invention, as defined solely by the claims, will become apparent in the non-limiting detailed description set forth below.
The present invention may be better understood, and its numerous objects, features, and advantages made apparent to those skilled in the art by referencing the accompanying drawings. The use of the same reference symbols in different drawings indicates similar or identical items.
The following is intended to provide a detailed description of an example of the invention and should not be taken to be limiting of the invention itself. Rather, any number of variations may fall within the scope of the invention which is defined in the claims following the description.
<element name><input signals><output signals>
Netlists are the primary form of a circuit used for simulation. Schematic versions of circuits are compiled into netlists before simulation or manufacture is possible. The netlist is used to create a model of the hardware at step 220. The model is used on an emulator (hardware simulator) at step 225. At step 230, the model is loaded on the simulator. At step 235 the model is executed on the simulator where cycle simulation is performed. After a predetermined number of cycles (N cycles), set by the designer, are performed, a check is made to see whether the design has errors. At 240, the simulation is halted and the state of the model is checked for errors. If there are no errors, the processing loops back to continue the simulation and simulate another N cycles of the hardware design. Simulation continues until the hardware designer is confident that any errors in the design have been uncovered. When an error is found, the designer retrieves the values in the array of special purpose hardware in the simulator and attempts to debug the cycle window (i.e., how the error developed with the preceding N cycles). Decreasing the number of cycles makes the window smaller for identifying the error but increases the time needed to simulate the design. Conversely, increasing the number of cycles decreases the time needed for simulation but makes the debug window larger, thus increasing the time and effort needed to identify the error in any given debug window.
Turning now to the interactive methodology provided by the present invention that commences at 250. The flowchart commencing at 250 highlights the differences between the improved methodology and that used in the prior art. Additional steps for using the interactive methodology with programmable breakpoints are highlighted. Steps that are not highlighted are essentially the same as those previously described with the same reference numbers in the prior art description above. When the netlist is generated, breakpoint hardware is automatically generated and attached to the netlist at step 260. Now, when the model is built and loaded, the model includes the breakpoint hardware design as well. More detailed descriptions of the breakpoint hardware are provided in hereinafter (see
Design under test (DUT) 300 includes the model of the hardware being simulated. Also included in the design under test are tagged resources 310. Resources, such as registers, instruction counter, memory areas, signals, nets, busses, etc., included in the design under test (DUT) are identified as being useful for debugging purposes. These resources are “tagged” in the hardware description language (HDL) in a way so that the tags are retained in the netlist model. Also included is logic 320 for analyzing the tagged resources.
When the breakpoint for a resource is turned “on,” the logic corresponding to the resource is used to provide data to the designer regarding both basic events as well as more complex events. The logic includes register 330 that the user of the simulation (designer, developer, etc.) can use to turn the breakpoint “on” or “off.” Comparator 325 is used to compare the value of the resource with a value supplied by the simulation user. For example, the simulation user might be interested in a hardware register when it reaches a certain value or when it contains a particular address. Comparator 325 is automatically generated due to the fact that this resource has been “tagged” as being potentially useful for debugging purposes. A simulated comparator, register 330, counter logic 350, and basic event logic 370 are generated for each tagged resource. However, the comparator, counter and basic event logic are only executed for those tagged resources with breakpoints that have been turned “on” by the simulation user turning the breakpoint. The comparator provides certain basic events 370 depending upon the value of the resource. The two basic events are either an “equal” condition 380 that is flagged when the user-programmed register value in register 330 is equal to the resource value, and a “not equal” condition 385 that is flagged when the user-programmed register value in register 330 is not equal to the resource value.
In addition, an EQUAL value from the comparator sets latch 335 whose output enables counter 360 to be incremented each clock cycle. Counter logic 350 is provided for each tagged resource. When clock signal 340 is reached and the latch is set, AND gate 345 sends a signal to counter 360 which is incremented accordingly. The value of counter 360 is compared to user defined register 355 to determine if the value being checked for (user defined register 330) has occurred a given number of times. Comparator 365 compares user defined register 355 with counter 360. The output from this comparison, CNT_REACHED 375, is set high when the counter reaches (is equal to) the user defined value. The combination of a comparator and the counter enables temporal breakpoints such as “HALT 12 cycles after instruction counter=0x99884” to be triggered off of the CNT_REACHED signal. A basic event, such as when a register is equal to a certain value or when a counter has reached a certain threshold, can serve as a breakpoint. When a breakpoint is reached, the simulation can be halted and the user of the simulation can analyze the state of the hardware being simulated at a point in time when a particular condition has occurred. For more advanced checking, however, the user may wish to define more complex breakpoint conditions, for example setting a breakpoint to occur when general purpose register 4 (GPR4) is equal to 0x1234 exactly 19 cycles after instruction counter (IC) is 0x998812 and translation look aside buffer flush condition is true (TLB_FLUSH=0x1). For these more advanced condition combinations, a switch and combination logic are used to combine basic events into more complex breakpoint conditions. One example of setting complex breakpoints is shown in
While
Design under test (DUT) 400 includes a number of tagged resources, such as registers, instruction counters, memory areas, signals, nets, busses, etc. For each tagged resource, simulated hardware 420 is automatically generated. When running a simulation, the breakpoints for some resources are turned on while others can be left off. When a breakpoint for a resource is turned on, it becomes an “observed resource” (410) The results and values maintained by observed resources 410 are analyzed using the simulated hardware that was automatically generated for these resources (see
Results from automatically generated hardware 420 are referred to as “basic events” 430. Automatically generated hardware 420 provides basic events 430 to switch 440. As with the automatically generated hardware, switch 440 is also simulated and the hardware used to build the switch is included in the model. In order to combine basic events, simulated switch 440, such as a Benes switch, is automatically generated in order to reroute basic events as inputs to simulated combination hardware logic 460 (for an example of simulated combination hardware logic, see
Various basic events are shown in
It will be appreciated by those skilled in the art that the circuitry shown in combine logic 460 can be as complex or as simple as needed, based upon the hardware being simulated. In addition, an entire library of combination logic can be included in combine logic 460 with various permutations of combining basic events.
In an alternative embodiment, inputs to the space division network can include signals other than the basic events produced by the automatically constructed hardware. This would allow both basic events, and other internal or external signals to be used to form complex breakpoints. The cost of a cross-connect switch of the type shown herein is related, among other things, to the number of switch points needed to implement the various switching modules used to construct the cross-connect switch. In the Benes approach, a switch is constructed with N input lines and N output lines. Each stage is constructed from switch modules having equal numbers of input and output lines, the number of such lines being determined by N.
To construct a cross-connect switch according to Benes with N>6, one first selects the size of the switch modules used to construct the center stage. If P is largest prime factor of N, then number of input (and output) lines, Nc, for each center stage switch module is chosen to be P if P>3. If P=3 and N is even, Nc is chosen to be 6. If P=3 and N is odd, Nc is chosen to be 3. Finally, if P=2 then Nc is chosen to be 4. If N is less than or equal to 6, a single N×N switch module is used to construct the cross-connect switch.
Having chosen Nc, one then decomposes N/Nc into its prime factors, fi. The number of prime factors determines the number of stages in the cross-connect switch. In particular, if there are S prime factors, the cross-connect switch will have 2S+1 stages. The cross-connect switch is symmetric about the center stage which will be labeled as stage “O.” The stages on the output side of the center stage will be labeled with positive numbers, and the stages on the input side of the center stage will be labeled with negative numbers. Hence, stage i and stage −i are both constructed from fi×fi switch modules.
This methodology can be more easily understood with reference to the specific cross-connect switch shown in
Although switch 600 has five stages, it may be viewed as a three-stage Clos switch in which the center stage is constructed from two 18×18 switch modules 612. Each switch module 612 is in turn a three stage switch having a first and third stages constructed from 3×3 switch modules and a center stage constructed from 6×6 switch modules.
The choice of which switch modules are used for the stages other than the center stage does not affect the total number of cross-points needed to construct a switch according to Benes. For example, an alternative 36×36 cross-connect switch could be constructed in which the first and fifth stages are constructed from 3×3 switch modules and the second and fourth stages are constructed from 2×2 switch modules.
Processing used to automatically attach breakpoint hardware commences at 730. At step 735 the HDL source that describes the hardware to be tested is tagged in order to identify resources of interest. The tags are written to the HDL source stored in HDL source file 710. The tags can be provided by the designer (or other person tasked with testing the design) or can be traversed with a computer program that reads the HDL source to identify various resources and, when a resource is located, writes tags accordingly. At step 740, a computer program automatically traverses HDL source 710 in order to find tagged resources. At step 745, when a tagged resource is found, for example, a tagged register, breakpoint hardware corresponding to the resource is attached to the design by reading the breakpoint hardware HDL from file 720 and writing the breakpoint hardware HDL to HDL source 710. In this manner different breakpoint hardware HDL can be attached depending upon the type of the tagged resource. Traversal of the HDL source continues until all of the tagged resources have been identified and corresponding breakpoint hardware, if any, has been written to HDL source 710.
At step 750, HDL source 710 is read and compiled to compiled HDL source 760. The compiled source now includes the breakpoint hardware which was added in steps 740 and 745. At step 770, compiled HDL file 760 (a model of the design under test (DUT) along with the breakpoint hardware corresponding to tagged resources) is loaded into hardware simulator 120. The design under test and the breakpoints are stored in an array of special purpose hardware (125) included in the hardware simulator. Breakpoint logic 160 corresponds to the breakpoint hardware HDL that was added to the design and corresponds to tagged resources.
At step 780, the user of the simulator sets and changes basic breakpoints by setting [set( )] values in breakpoint hardware registers. For example, the user can turn a breakpoint on or off using a set( ) command and can provide a comparison value used to compare the resource being simulated. (See
Creation of the design source file commences at 800 with the hardware designer creating design source file 810 at step 805. At step 815, Breakpoint Hardware is designed and compiled in Compiled Breakpoint Hardware file 820. The Breakpoint Hardware is the hardware that is inserted in the model in order to capture basic events. Creation of the HDL source files ends at 825.
Processing used to automatically attach breakpoint hardware commences at 830. At step 835 the design source that describes the hardware to be tested is tagged in order to identify resources of interest. The tags are written to the design source stored in source file 810. The tags can be provided by the designer (or other person tasked with testing the design) or can be traversed with a computer program that reads the design source to identify various resources and, when a resource is located, writes tags accordingly. At step 840, the design source is compiled into a netlist/graph representation and written to compiled netlist file 850. At step 855, the compiled netlist file is traversed in order to find tagged resources (attachment points) for breakpoint hardware. At step 860, when a tagged resource is found, for example, a tagged register, breakpoint hardware corresponding to the resource is attached to the design by reading the breakpoint hardware design from file 820 and writing the breakpoint hardware to compiled netlist file 850. In this manner different breakpoint hardware HDL are attached depending upon the type of the tagged resource. Traversal of the compiled design continues until all of the tagged resources have been identified and corresponding breakpoint hardware, if any, has been written to the compiled design file.
At step 870, compiled netlist file 860 (a model of the design under test (DUT) along with the breakpoint hardware corresponding to tagged resources) is loaded into hardware simulator 120. The design under test and the breakpoints are stored in an array of special purpose hardware (125) included in the hardware simulator. Breakpoint logic 160 corresponds to the breakpoint hardware HDL that was added to the design and corresponds to tagged resources.
At step 880, the user of the simulator sets and changes basic breakpoints by setting [set( )] values in breakpoint hardware registers. For example, the user can turn a breakpoint on or off using a set( ) command and can provide a comparison value used to compare the resource being simulated. (See
Returning to
At step 940, switch design 910 is included (attached) to the model, and at step 945, complex breakpoint design 920 is attached to the model. The attached switch design allows the simulation user, at run time, to map basic breakpoint events to complex breakpoint inputs. The complex breakpoints can be enabled or disabled (turned on or off) depending upon the testing that the simulation user wants perform. An example of a complex breakpoint design is shown in
Returning to
At step 970, the compiled design is loaded into hardware simulator 120. The simulation user sets (using put( ) commands) basic breakpoint registers that enable/disable basic breakpoints as well as provide comparison values for the basic breakpoint logic (for example, when testing a register a breakpoint might be generated when the register contains a particular value of interest). The design under test, basic breakpoints, the switch/network, and the complex breakpoint logic are stored in an array of special purpose hardware (125) included in the hardware simulator. Basic breakpoint logic 160 corresponds to the basic breakpoint hardware HDL that was added to the design and corresponds to tagged resources. Switch logic 912 is the switch design, such as that shown in
At step 980, the simulation user maps basic breakpoint events as inputs to complex breakpoint inputs using the switch/network that was included in the compiled design. In one embodiment, the simulation user uses settable register values to provide the switch with such mapping information. In step 985, the complex breakpoints are enabled by setting the enable bits. In addition, complex breakpoints can also include user-settable registers that can be used to compare the complex breakpoint to a user-settable value. For example, a complex breakpoint can be configured to receive input from multiple basic breakpoint events that correspond to various registers. The complex breakpoint logic could OR or AND the registers together and compare the registers to a particular value. In this manner, a complex breakpoint can be established that is triggered when any of a set of registers is equal to a particular value, or a complex breakpoint can be established that is triggered when multiple registers are all equal to a particular value.
At step 990, the user starts the hardware simulator and the loaded simulation runs until a breakpoint is reached (either a basic event that is enabled or a complex “final” breakpoint). Allowing both basic and complex breakpoints allows the simulation user flexibility in they types of breakpoint data being returned. For example, the user can use complex breakpoints to determine when a general situation occurs and, when the general situation occurs, the user can enable more basic breakpoint events to further identify and analyze the state of the design under test (DUT).
PCI bus 1014 provides an interface for a variety of devices that are shared by host processor(s) 1000 and Service Processor 1016 including, for example, flash memory 1018. PCI-to-ISA bridge 1035 provides bus control to handle transfers between PCI bus 1014 and ISA bus 1040, universal serial bus (USB) functionality 1045, power management functionality 1055, and can include other functional elements not shown, such as a real-time clock (RTC), DMA control, interrupt support, and system management bus support. Nonvolatile RAM 1020 is attached to ISA Bus 1040. Service Processor 1016 includes JTAG and I2C busses 1022 for communication with processor(s) 1000 during initialization steps. JTAG/I2C busses 1022 are also coupled to L2 cache 1004, Host-to-PCI bridge 1006, and main memory 1008 providing a communications path between the processor, the Service Processor, the L2 cache, the Host-to-PCI bridge, and the main memory. Service Processor 1016 also has access to system power resources for powering down information handling device 1001.
Peripheral devices and input/output (I/O) devices can be attached to various interfaces (e.g., parallel interface 1062, serial interface 1064, keyboard interface 1068, and mouse interface 1070 coupled to ISA bus 1040. Alternatively, many I/O devices can be accommodated by a super I/O controller (not shown) attached to ISA bus 1040.
In order to attach computer system 1001 to another computer system to copy files over a network, LAN card 1030 is coupled to PCI bus 1010. Similarly, to connect computer system 1001 to an ISP to connect to the Internet using a telephone line connection, modem 1075 is connected to serial port 1064 and PCI-to-ISA Bridge 1035.
While the computer system described in
One of the preferred implementations of the invention is an application, namely, a set of instructions (program code) in a code module which may, for example, be resident in the random access memory of the computer. Until required by the computer, the set of instructions may be stored in another computer memory, for example, on a hard disk drive, or in removable storage such as an optical disk (for eventual use in a CD ROM) or floppy disk (for eventual use in a floppy disk drive), or downloaded via the Internet or other computer network. Thus, the present invention may be implemented as a computer program product for use in a computer. In addition, although the various methods described are conveniently implemented in a general purpose computer selectively activated or reconfigured by software, one of ordinary skill in the art would also recognize that such methods may be carried out in hardware, in firmware, or in more specialized apparatus constructed to perform the required method steps.
While particular embodiments of the present invention have been shown and described, it will be obvious to those skilled in the art that, based upon the teachings herein, changes and modifications may be made without departing from this invention and its broader aspects and, therefore, the appended claims are to encompass within their scope all such changes and modifications as are within the true spirit and scope of this invention. Furthermore, it is to be understood that the invention is solely defined by the appended claims. It will be understood by those with skill in the art that if a specific number of an introduced claim element is intended, such intent will be explicitly recited in the claim, and in the absence of such recitation no such limitation is present. For a non-limiting example, as an aid to understanding, the following appended claims contain usage of the introductory phrases “at least one” and “one or more” to introduce claim elements. However, the use of such phrases should not be construed to imply that the introduction of a 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 in the claims of definite articles.