A system and method automatically generates an object-oriented, textual program from a graphical model, and verifies the performance of the textual program as compared to the graphical model. The graphical model may have a plurality of interconnected blocks, and each block may have a plurality of parameters. One or more of the blocks are mapped to a system object, and the block's parameters are mapped to properties of the system object. An object-oriented, executable textual string is generated automatically for the block. The generated string includes at least one command to: instantiate a system object having functionality that matches the block; set one or more properties of the system object based on the block's parameters; and run the instantiated object.
|
7. A computer implemented method comprising:
storing, in a memory, a graphical model having a plurality of interconnected, executable graphical blocks;
receiving an identification of at least one designated graphical block of the graphical model, the at least one designated graphical block having one or more graphical block parameters;
retrieving, for the at least one designated graphical block, one or more object properties from a predefined data structure stored in the memory, the predefined data structure configured to map graphical block parameters to respective object properties;
generating, for the at least one designated graphical block, an object-oriented, executable textual string that includes at least one command to:
instantiate an object having functionality that matches the at least one designated graphical block,
set one or more properties of the instantiated object based on the retrieved one or more object properties, and
run the instantiated object, the generating performed automatically by a processor coupled to the memory; and
executing the generated textual string.
24. One or more non-transitory computer readable media storing computer executable instructions, the media storing one or more instructions comprising instructions for:
storing, in a memory, a graphical model having a plurality of interconnected, executable graphical blocks;
receiving an identification of at least one designated graphical block of the graphical model, the at least one designated graphical block having one or more graphical block parameters;
retrieving, for the at least one designated graphical block, one or more object properties from a predefined data structure stored in the memory, the predefined data structure configured to map graphical block parameters to respective object properties;
generating, for the at least one designated graphical block, an object-oriented, executable textual string that includes at least one command to:
instantiate an object having functionality that matches the at least one designated graphical block,
set one or more properties of the instantiated object based on the retrieved one or more object properties, and
run the instantiated object, the generating performed automatically by a processor coupled to the memory; and
executing the generated textual string.
14. A computer implemented method comprising:
storing, in a memory, a graphical model having a plurality of interconnected, executable graphical blocks;
receiving an identification of a target graphical block;
identifying one or more occurrences of the target graphical block in the graphical model, where each identified occurrence of the target graphical block in the graphical model has one or more block parameters;
retrieving, for each occurrence of the target graphical block in the graphical model, one or more object properties from a data structure stored in the memory, the data structure preconfigured to map block parameters to respective object properties;
generating, for each occurrence of the target graphical block in the graphical model, an object-oriented, executable textual string that includes at least one command to:
instantiate an object having functionality that matches the target graphical block,
set one or more properties of the instantiated object based on the object properties retrieved for the respective occurrence of the target graphical block, and
run the instantiated object, the generating performed automatically by a processor coupled to the memory; and
executing each generated textual string.
10. An apparatus comprising:
a memory storing:
a graphical model having a plurality of interconnected, executable graphical blocks,
an identification of a target graphical block, where each occurrence of the target graphical block in the graphical model has one or more block parameters,
an object class library for instantiating, in response to text-based commands, a plurality of objects, each object having one or more object properties, and
at least one data structure storing a predetermined mapping between object properties and block parameters, and
a processor coupled to the memory, the processor configured to:
generate, for each occurrence of the target graphical block in the graphical model, an object-oriented, executable textual string that includes at least one command to:
instantiate an object from the object class library where the instantiated object has functionality matching the target graphical block,
set one or more properties of the instantiated object based on the predetermined mapping between object properties and block parameters, and
run the instantiated each object;
execute each generated textual string to produce an object output;
run the graphical model to produce a model output; and
compare the object output and the model output.
27. One or more non-transitory computer readable media storing computer executable instructions, the media storing one or more instructions comprising instructions for:
storing, in a memory, a graphical model having a plurality of interconnected, executable graphical blocks;
receiving an identification of a target graphical block;
identifying one or more occurrences of the target graphical block in the graphical model, where each identified occurrence of the target graphical block in the graphical model has one or more block parameters;
retrieving, for each occurrence of the target graphical block in the graphical model, one or more object properties from a data structure stored in the memory, the data structure preconfigured to map block parameters to respective object properties;
generating, for each occurrence of the target graphical block in the graphical model, an object-oriented, executable textual string that includes at least one command to:
instantiate an object having functionality that matches the target graphical block,
set one or more properties of the instantiated object based on the object properties retrieved for the respective occurrence of the target graphical block, and
run the instantiated object, the generating performed automatically by a processor coupled to the memory; and
executing each generated textual string.
1. A method comprising:
storing, in a memory:
a graphical model having:
a plurality of interconnected, executable graphical blocks, where:
each graphical block of the graphical model has one or more graphical block parameters, and at least one of the executable graphical blocks is a target graphical block, and
a data structure storing block parameters and object properties;
receiving an identification of the target graphical block;
identifying occurrences of the target graphical block in the graphical model;
retrieving, for each occurrence of the target graphical block in the graphical model, the one or more block parameters;
mapping the graphical one or more block parameters retrieved for the respective occurence of the target graphical block to respective object properties using the data structure;
generating, for each occurrence of the target graphical block in the graphical model, an object-oriented, executable textual string that includes at least one command to:
instantiate an object having functionality that matches the target graphical block,
set one or more properties of the instantiated object based on the one or more block parameters retrieved for the respective occurrence of the target graphical block, and
run the instantiated object, the generating performed automatically by a processor coupled to the memory;
executing each generated textual string to produce at least one object output;
executing the graphical model to produce at least one model output;
comparing the at least one object output with the at least model output; and
verifying the textual string generated for each occurrence of the target graphical block based on the comparing.
19. One or more non-transitory computer readable media storing computer executable instructions, the media storing one or more instructions comprising instructions for:
storing, in a memory:
a graphical model having:
a plurality of interconnected, executable graphical blocks, where:
each graphical block of the graphical model has one or more graphical block parameters, and at least one of the executable graphical blocks is a target graphical block, and
a data structure storing block parameters and object properties;
receiving an identification of the target graphical block;
identifying occurrences of the target graphical block in the graphical model;
retrieving, for each occurrence of the target graphical block in the graphical model, the one or more block parameters;
mapping the graphical one or more block parameters retrieved for the respective occurence of the target graphical block to respective object properties using the data structure;
generating, for each occurrence of the target graphical block in the graphical model, an object-oriented, executable textual string that includes at least one command to:
instantiate an object having functionality that matches the target graphical block,
set one or more properties of the instantiated object based on the one or more block parameters retrieved for the respective occurrence of the target graphical block, and
run the instantiated object, the generating performed automatically by a one or more processors coupled to the memory;
executing each generated textual string to produce at least one object output;
executing the graphical model to produce at least one model output;
comparing the at least one object output with the at least model output; and
verifying the textual string generated for each occurrence of the target graphical block based on the comparing.
2. The method of
assembling, by the processor, a second graphical model, where the second graphical model corresponds to the graphical model, except that, in the second graphical model, each occurrence of the target graphical block is replaced with a code type graphical block that contains the executable textual string generated for the respective occurrence of the target graphical block of the graphical model;
storing the second graphical model in the memory; and
running the second graphical model to produce the at least one object output.
3. The method of
creating, by the processor, an object-oriented textual code file that contains the executable textual string generated for each occurrence of the target graphical block; and
storing the textual code file in the memory.
4. The method of
5. The method of
storing, in the memory, an object class library defining a plurality of object classes, wherein
the object instantiated for each occurrence of the target graphical block in the graphical model is instantiated from a selected class of the object class library.
6. The method of
interrogating the graphical model, by the processor; and
identifying each occurrence of the target graphical block in the graphical model based on the interrogating.
8. The computer implemented method of
running the graphical model to produce a model output; and
presenting, on a display device coupled to the processor, the object output and the model output.
9. The computer implemented method of
comparing the model output, produced by running the graphical model, with the object output, produced by executing the generated textual string; and
determining, in response to the comparing, whether the model output and the object output are the same.
11. The apparatus of
a display device, wherein
the processor is coupled to the display device and is further configured to present the object output and the model output on the display device.
12. The apparatus of
assemble a second graphical model that corresponds to the graphical model, except that, in the second graphical model, each occurrence of the target graphical block is replaced with a code type graphical block that contains the executable textual string generated for the respective occurrence of the target graphical block; and
run the second graphical model to produce the object output.
13. The apparatus of
15. The computer implemented method of
generating Hardware Description Language (HDL) code from the object-oriented, executable textual strings.
16. The computer implemented method of
synthesizing a programmable hardware device with the generated HDL code; and
testing the programmable hardware device.
17. The computer implemented method of
18. The computer implemented method of
20. The media of
assembling a second graphical model, where the second graphical model corresponds to the graphical model, except that, in the second graphical model, each occurrence of the target graphical block is replaced with a code type graphical block that contains the executable textual string generated for the respective occurrence of the target graphical block of the graphical model;
storing the second graphical model in the memory; and
running the second graphical model to produce the at least one object output.
21. The media of
creating an object-oriented textual code file that contains the executable textual string generated for each occurrence of the target graphical block; and
storing the textual code file in the memory.
22. The media of
23. The media of
storing, in the memory, an object class library defining a plurality of object classes, wherein
the object instantiated for each occurrence of the target graphical block in the graphical model is instantiated from a selected class of the object class library.
25. The media of
running the graphical model to produce a model output; and
presenting, on a display device coupled to the processor, the object output and the model output.
26. The media of
comparing the model output, produced by running the graphical model, with the object output, produced by executing the generated textual string; and
determining, in response to the comparing, whether the model output and the object output are the same.
28. The media of
generating Hardware Description Language (HDL) code from the object-oriented, executable textual strings.
29. The media of
synthesizing a programmable hardware device with the generated HDL code; and
testing the programmable hardware device.
30. The media of
31. The media of
|
The present application is a continuation-in-part of commonly assigned copending U.S. patent application Ser. No. 11/321,919, which was filed on Dec. 29, 2005, by David Koh and Brian K. Ogilvie for an Automatic Comparison and Performance Analysis Between Different Implementations and is hereby incorporated by reference in its entirety.
1. Field of the Invention
The present invention generally relates to technical computing, and, more particularly, to generating automatically an object-oriented, textual representation of a graphical model, and performing verification testing of the textual representation and the graphical model.
2. Background Information
Block diagrams are used to model real-world systems. Historically, engineers and scientists have utilized time-based block diagram models in numerous scientific areas, such as Feedback Control Theory and Signal Processing to study, design, debug, and refine dynamic systems. Dynamic systems, which are characterized by the fact that their behaviors change over time, are representative of many real-world systems. A dynamic system (either natural or man-made) is a system whose response at any given time is a function of its input stimuli, its current state, and the current time. Such systems range from simple to highly complex systems. Physical dynamic systems include, for example, a falling body, the rotating earth, biomechanical systems (muscles, joints, etc.), biochemical systems (gene expression, protein pathways), and weather and climate pattern systems. Examples of man-made or engineered dynamic systems include: a bouncing ball, a spring with a mass tied on an end, automobiles, airplanes, control systems in major appliances, communication networks, audio signal processing, nuclear reactors, and a stock market.
A block diagram model of a dynamic system is represented schematically as a collection of blocks interconnected by lines that represent signals. Each block represents an elemental dynamic system. A signal represents either the input or the output of a dynamic system. A line emanating at one block and terminating at another signifies that the output of the first block is an input to the second block. Each distinct input or output on a block is referred to as a “port”. Signals correspond to the time-varying quantities represented by each line connection and are assumed to have values at each time instant at which the connecting blocks are enabled. The source block of a signal writes to the signal at a given time instant when its system equations are solved. The destination blocks of this signal read from the signal when their system equations are being solved.
It should be noted that the term “block diagram,” as used herein, also refers to other graphical modeling formalisms. For instance, flow-charts are block diagrams of entities that are connected by relations. Flow-charts are used to capture process flow and are not generally suitable for describing dynamic system behavior. Data flow block diagrams are diagrams of entities with relations between them that describe a graphical programming paradigm where the availability of data is used to initiate the execution of blocks, where a block represents an operation and a line represents execution dependency describing the direction of data flowing between blocks. It will be appreciated that a block diagram model may include entities that are based on other modeling domains within the block diagram. A common characteristic among these various forms of block diagrams is that they define semantics on how to execute them.
In graphical modeling environments, such as model-based design tools, block diagram models can be created to represent a design, or algorithm, of an implementation for a computational hardware. One or more block diagram models may represent a design for a target hardware platform. A target hardware platform used in this application may include a single computing platform or multiple computing platforms. A target hardware platform may also have other elements such as memory, interfaces, or other integrated circuits (ICs). An automatic code generation application can automatically generate code and build programs from the block diagram model for implementation on the target hardware platform based on the design specified by the model. In this manner, the design of a block diagram model behaves as an implementation specification for automatic code generation. A graphical block diagram modeling environment can be used to produce designs and algorithms that can be implemented on a processor or computational IC, such as an FPGA or ASIC.
In conventional systems, users typically have no convenient way to verify that automatically generated code from a block diagram model will execute in an intended manner on a target platform, e.g., in a manner consistent with a design implemented in the block diagram model.
Briefly, the present invention in an embodiment is directed to a system and method for automatically generating an object-oriented, textual program from a graphical model, and for verifying the performance of the textual program as compared to the graphical model. The graphical model may have a plurality of executable, graphical blocks that are interconnected to define a function or procedure. Each block may have a plurality of parameters. A user may identify one or more target block types of the graphical model that is to be verified. The system interrogates the model and identifies each occurrence of the identified target block types, and obtains each block's parameters. The system maps each occurrence of the identified block types to a system object, and maps the block's parameters to properties of the system object. The system may include one or more predefined look-up tables (LUTs) for mapping executable, graphical blocks and their parameters to system objects and their properties. The system generates, for each occurrence of the target graphical block in the graphical model, an object-oriented, executable textual string. Each generated string includes at least one command to: instantiate a system object having functionality that matches the target graphical block; set one or more properties of the instantiated object based on the parameters of the respective block; and run the instantiated object. The generated strings may be loaded into embedded text blocks, which may be assembled into a verification model. The graphical model and the verification model may be simulated and the results produced by the two models compared in order to verify the objection of the system objects.
In another embodiment, the object-oriented, executable textual strings may be stored in a textual verification file. The file may be executed and the results produced during the execution of the file may be compared with the results produced by the graphical model.
The invention description below refers to the accompanying drawings, of which:
For the purpose of discussion in this application, the following terms are given the following meaning in this application.
A processor includes, but not limited to, general purpose processor (GPP), microcontroller, graphics processor, multi-core processor and Digital Signal Processor (DSP).
A computational IC includes, but not limited to, FPGA, ASIC, programmable logic device (PLD), and programmable logic array (PLA).
A host computer is a computing device with a processor wherein the simulation environment, such as the Simulink® model-based design system, resides.
A computing platform is a processor, computational IC, an emulator of a processor, an emulator of a computational IC, a simulator of a processor, a simulator of a computational IC, or a combination thereof. An emulator or a simulator of a processor or a computation IC is a software emulation or software simulation that resides on a host computer.
The simulator allows execution of standalone code implementation, such as C code or HDL, intended for the processor or computation IC. Examples of a simulator includes, but not limited to, Trace32 from Lauderbach, C6000 DSP Simulator from Texas Instruments, and ModelSim HDL Simulator from Mentor Graphics.
A design is an algorithm for a hardware or software architecture, components, modules, interfaces to satisfy specified requirements.
A simulation is for execution on a computing device with a simulation environment such as the MATLAB® programming environment or the Simulink® model-based design system both from The MathWorks, Inc. of Natick, Mass.
A model executes within a simulation environment, such as the MATLAB® programming environment and the Simulink® model-based design system, on a host computer. A model can include, but not limited to, application design that can be executed in simulation, application design from which code can be automatically generated, communications interface with ail external computing platform.
A block diagram model is a graphical representation of a model using block diagrams. A single block diagram may represent a design for one or more computing platforms. On the other hand, one or more block diagram models may represent a design for a single computing platform.
A standalone code implementation is a standalone software that can be executed on a host computer or a computing platform.
An implementation is the realization of the intended design in simulation or a standalone code implementation. Examples of an implementation include, but not limited to, a simulation of a design on a host computer, and execution of a standalone code implementation on a computing platform. One or more models can also be used to represent one implementation.
A subsystem is a hierarchical model abstraction that can include multiple blocks and other subsystems.
A parameter is a variable defined by an algorithm. For example, given a function y=K*u, where y is the output and u is the input, K is a parameter of the function that can be varied by a user manually or programmatically to determine what the function will be.
An intermediate output is an intermediate result of a simulation or execution of a standalone code implementation. For example, in a graphical block diagram modeling application, an intermediate output can be an output (or output signal) of a block within a block diagram model. In another example, in the execution of a standalone code implementation, an intermediate output can be an output of a function or execution results of a sequence of instructions.
The present invention provides a method and system for comparing different implementations of one or more designs. An illustrative embodiment of the present invention provides a method and system for automatic verification of automatically generated standalone code implementation intended for execution on a target computing platform against its original simulation design from which the standalone code is generated. A user can use this verification to double check if the automatically generated code performs as predicted in the original simulation design. The illustrative embodiment relieves the user's burden to write manual code to communicate with the target computing platform and administer manual tests.
The present invention provides a method and system for comparing simultaneous executions of different implementations. A block, a collection of blocks, a subsystem, a model, or a collection of integrated models can be used to represent an implementation. Comparison of different implementations can be done at different levels. Comparison of only the final execution results of the different implementations is not always helpful as different components of the implementations can affect the final execution results. Hence, one advantage of the present invention is that a user can choose to compare intermediate outputs and choose how errors between the different implementations should be propagated, such as if an error at an earlier stage should be allowed to propagate to a later stage in the execution.
The present invention also provides a method and system for comparing simultaneous executions of standalone code implementations on the same or different computing platforms. A host computer can communicate with the one or more computing platforms that execute the standalone code implementations and instruct the computing platforms to execute the standalone code implementations simultaneously in a locked-step manner. A user can compare how one standalone code implementation performs on two different computing platforms, or how two different standalone code implementations perform on the same platform.
For example, when the computing platforms are external to the host computer, the present invention allows an application program on the host computer to communicate with the external computing platforms and instruct the simultaneous execution of the standalone code implementations and further retrieve and compare the executions results on the host computer. A user does not need to analyze data after execution of the standalone code implementations. The present invention may allow real-time analysis and comparison of two executions of standalone code implementations. One of ordinary skill in the art will appreciate there are many combinations and modifications one can make with the exemplary embodiments described herein but still does not depart from the spirit and scope of the present invention.
In a preferred embodiment of the present invention, a block diagram can be used to represent a comparison model that compares two implementations, such as two simulations, two standalone code implementations, or one simulation and one standalone code implementation. The comparison can be done at a block level, a subsystem level, a model level, or multi-model level. The present invention may allow automatic comparison once a user identifies the intermediate outputs and/or signals that the user wants to compare and monitor. Reports can be generated to show the statistics of the comparison results.
Illustrative embodiments will be described below for illustrative purposes relative to the technical computing environment of the MATLAB® programming environment and the Simulink® model-based design system from The MathWorks, Inc. of Natick, Mass. Although the illustrative embodiments are described relative to a Math Works-based application, one of ordinary skill in the art will appreciate that the present invention may be applied to other graphical modeling environments and technical computing environments, such as any technical computing environments using software products of Rhapsody from I-Logix Inc., TargetLink and Real-Time Interface from dSPACE GmbH, RT-LAB™ from Opal-RT Technologies, Inc., EXITE from EXTESSY AG, LabVIEW and MATRIXx from National Instruments, Inc., SystemVue™ from Eagleware-Elanix Corporation, Mathematica® from Wolfram Research, Inc., Mathcad of Mathsoft Engineering & Education Inc., COSSAP from Synopsys, Inc., HyperSignal® from Hyperception, Inc., Dymola from Dynasim AB, or Maple™ from Maplesoft, a division of Waterloo Maple Inc. Furthermore, one ordinarily skilled in the art will appreciate that the present invention may apply to any graphical modeling environment, such as one providing modeling with a Unified Modeling Language (UML), Hardware Description Language (HDL), or that provides a physics modeling domain. Additionally, those skilled in the art will also appreciate that the principles and concepts are equally applicable to non-graphical modeling applications as well.
The memory 108 may comprise a computer system memory or random access memory such as DRAM, SRAM, EDO RAM, etc. The memory 108 may comprise other types of memory as well, or combinations thereof. A user may interact with the host computer 102 through a visual display device 116 such as a computer monitor, which may include a user interface 118. The host computer 102 may include other I/O devices such a keyboard 110 and a pointing device 112, for example a mouse, for receiving input from a user. Optionally, the keyboard 110 and the pointing device 112 may be connected to the visual display device 116. The host computer 102 may include other suitable conventional I/O peripherals. The host computer 102 may further comprise a storage device 104, such as a hard-drive or CD-ROM, for storing an operating system and other related software, and for storing application 120, such as the Simulink® model-based design system. Application 120 may include a concurrent execution environment 122 to enable concurrent execution and/or monitoring of simulations and/or standalone code implementations on the host computer 102. Concurrent execution environment 122 includes comparison mechanism 124 and communication control 126 (discussed later). Those skilled in the art will appreciate that communication control 126 is adaptable to be included as part of the application 120 or a stand alone application that responds to calls from the application 120, such as communication control 126′. Additionally, the application 120 can be run from a bootable CD, such as, for example, KNOPPIX®, a bootable CD for GNU/Linux.
Additionally, the host computer 102 may include a network interface 114 to interface to a Local Area Network (LAN), Wide Area Network (WAN) or the Internet through a variety of connections including, but not limited to, standard telephone lines, LAN or WAN links (e.g., 802.11, T1, T3, 56 kb, X.25), broadband connections (e.g., ISDN, Frame Relay, ATM), wireless connections, or some combination of any or all of the above. The network interface 114 may comprise a built-in network adapter, network interface card, PCMCIA network card, card bus network adapter, wireless network adapter, USB network adapter, modem or any other device suitable for interfacing the host computer 102 to any type of network capable of communication and performing the operations described herein. Moreover, the host computer 102 may be any computer system such as a workstation, desktop computer, server, laptop, handheld computer or other form of computing or telecommunications device that is capable of communication and that has sufficient processor power and memory capacity to perform the operations described herein.
The host computer 102 can be running any operating system such as any of the versions of the Microsoft® Windows® operating systems, the different releases of the Unix and Linux operating systems, any version of the MacOS® for Macintosh computers, any embedded operating system, any real-time operating system, any open source operating system, any proprietary operating system, any operating systems for mobile computing devices, or any other operating system capable of running on the computing device and performing the operations described herein.
In another embodiment of the present invention, comparison mechanism 124 can compare simulation 132 with simulation 132′ that is executed by application 140. Application 140 can execute on the same or different processor that executes application 120. Application 120 can also be controlled by the same or different operating system as the one that controls application 120. Communication control 126 is capable of communicating between application 120 and application 140. Communication control 126 is also capable of controlling execution of simulation 132′. In other words, communication control 126 can determine when to execute, pause, or terminate the simulation 132′. Communication control 126 can also determine what inputs simulation 132′ should use for execution. Communication control 126 can further determine if a portion or all of simulation 132′ should be executed. Communication control 126 can issue instructions to cause simultaneous execution of simulation 132 and simulation 132′ in a locked-step manner. Comparison mechanism 124 can automatically generate a comparison model to compare the simulation 132 with simulation 132′. The comparison model may be implemented as a block diagram model, where one or more blocks are used to represent semantics of the simulation 132 and 132′.
In a further embodiment of the present invention, comparison mechanism 124 can compare execute results of simulation 132′ executing by application 140 and simulation 134′ executing by application 142. Application 140 and application 142 can execute on the same or different processor and be controlled by the same or different operating system. Communication control 126 communicates with application 140 and application 142 regarding data related to simulation 132′ and simulation 134′ respectively. Communication control 126 can issue instructions to cause simultaneous execution of simulation 132′ and simulation 134′ in a locked step manner.
Semantics of simulation 132′ and simulation 134′ can be represented by model 136 and model 138 respectively. In a preferred embodiment of the present invention, model 136 and model 138 are built using a block diagram modeling application, such as the Simulink® model-based design system. Application 120 uses model 136 and model 138 in the concurrent execution environment to represent simulation 132′ and simulation 134′, respectively. Comparison mechanism 124 can request communication control 126 to obtain data from simulation 132′ and/or simulation 134′ for comparison purposes. Communication control 126 can make a function call to a specific portion of simulation 132′ or simulation 134′. Comparison mechanism 124 can automatically generate a comparison model to compare the simulation 132′ and simulation 134′. The comparison model may be implemented as a block diagram model, where one or more blocks are used to represent semantics of the simulation 134′ and 132′.
In another aspect of the present invention, comparison mechanism 124 can compare simulation 132 or simulation 132′ with simulation 132″ that executes on application 140′ which resides on host computer 150. Communication control 126 communicate between application 120 on host computer 102 and application 140′ on computing device regarding data related to simulation 132″. Application 120 can use a model in concurrent execution environment 122 to represent semantics of simulation 132″. The model can be stored locally in storage 104 or externally at computing 150, such as model 136′. Comparison mechanism 124 can make a function call to a specific portion of simulation 132″. Communication control 126 is also capable of controlling execution of simulation 132″. In other words, communication control 126 can determine when to execute, pause, or terminate the simulation 132″. Communication control 126 can also determine what inputs simulation 132″ should use for execution. Communication control 126 can further determine if a portion or all of simulation 132″ should be executed. Communication control 126 can issue instructions to cause simulation 132″ and simulation 132 or simulation 132′ to execute simultaneously in a locked-step manner. Comparison mechanism 124 can automatically generate a comparison model to compare the simulation 132″ and simulation 132 or simulation 132′. The comparison model may be implemented as a block diagram model, where one or more blocks are used to represent semantics of the simulation 132″ and simulation 132′ or simulation 132.
In a further embodiment of the present invention, comparison mechanism 124 can compare execution of simulation 132″ with execution of simulation 134″. Simulation 134″ can be executed by an application 142′ on a host computer 152 that is different from host computer 150. Host computer 152 can also include a model 138′ that application 120 uses to represent the semantics of simulation 134″. Communication control 126 can issue instructions to cause simultaneous execution of simulation 132″ and simulation 134″ in a locked step manner. Comparison mechanism 124 can automatically generate a comparison model to compare the simulation 132″ and simulation 134″. The comparison model may be implemented as a block diagram model, where one or more blocks are used to represent semantics of the simulation 134″ and 132″.
One of ordinary skill in the art will appreciate that any type of simulation may be used in the present invention. Additionally, applications 120, 140, and 140′ may be different applications, different instances of the same application, or a combination thereof.
In one aspect of the present invention, model 136 represents a design being simulated by simulation 132 and standalone code implementation 144 is automatically generated from the same design using specification information of computing platform 160, such as memory information, interface information, processing speed information of the computing platform 160. In this case, model 138 is used to represent the physical execution of standalone code implementation 144 on the computing platform 160, whereas model 136 represents a simulation of the design in a simulation environment, such as one provided by the Simulink® model-based design system. In one embodiment of the present invention, application 120 can automatically generate model 138. Application 120 or comparison mechanism 124 can automatically generate a comparison model to help illustrate the verification of the automatically generated standalone code implementation 144 against the design as simulated by simulation 132. Hence, the present invention provides an automatic method to verify the generated standalone code implementation 144 with the original design. The present invention also allows a user to specify how one wants to verify the automatically generated code with its original design (details later). One of ordinary skill in the art can appreciate that a user would generally like to know if the automatically generated standalone code implementation from the design behaves as predicted in the simulation simulating the design. Additionally, one of ordinary skill in the art will also appreciate that there is some discrepancy between the automatically generated code and the simulation due to many factors, such as design choices and quality of the automatically generated standalone code implementation, that a user would generally like to be able to compare the execution of the automatically generated standalone code implementation with the simulation to see how different the execution results are.
In a preferred embodiment of the present invention, model 138 is built using gateway blocks described in U.S. patent application Ser. No. 11/028,172, the content of which is incorporated herein by reference. In another embodiment of the present invention, the functionalities of the gateway block can be achieved by using the processor-in-the-loop (PIL) technology featured in Embedded Target for Motorola MPC555 from The MathWorks, Inc. of Natick, Mass. or TargetLink from dSPACE of Germany. One of ordinary skill in the art will appreciate that there are many different ways and technologies that can be used to achieve the purpose of a gateway block.
A gateway block can provide input to the standalone code implementation on the computing platform 160 and wait for the computing platform 160 to execute a portion of the standalone code implementation that is represented by the gateway block. Once the gateway block receives the output from the execution of the portion of the standalone code implementation that is represented by the gateway block, the gateway block can provide the received output as an input to another block in the block diagram model. The gateway block can carry out the above processing by using many different technologies, such as via APIs to the computing platform's debugger or IDE of the computing platform, and via direct interface device drivers to the computing platform (Universal Serial Bus (USB), Joint Test Action Group (JTAG), TCP/IP, RS-232). Additionally, a gateway block does not need to be a visible block in a block diagram model because the purpose of the use of the gateway block is to communicate with a computing platform external to the host computer.
When the standalone code implementation is implemented in HDL, model 138 can be automatically created using one or more gateway blocks or co-simulation blocks, such as ones from The MathWorks' product EDA Simulator Link, to communicate with a computing platform executing standalone HDL code implementation.
In another embodiment of the present invention, comparison mechanism 124 can compare simulation 132′ executing by application 140 with standalone code implementation 144 embedded on a computing platform 160. Communication control 126 can communicate with application 140 regarding data related to simulation 132′ and also communicate with computing platform 160 regarding data related to standalone code implementation 144. Communication control 126 can issue instructions to cause simultaneous execution of simulation 132′ and standalone code implementation 144 in a locked-step manner so that comparison mechanism 124 can make comparison during execution of simulation 132′ and standalone code implementation 144. Comparison mechanism 124 can automatically generate a comparison model to compare the simulation 132′ and standalone code implementation 144. The comparison model may be implemented as a block diagram model, where one or more blocks are used to represent semantics of the simulation 132′ and standalone code implementation 144.
In still another embodiment of the present invention, comparison mechanism 124 can compare simulation 132″ executing on host computer 150 with standalone code implementation 144 embedded on a target platform. Communication control can communicate with application 140′ regarding simulation 132″ and communicate with computing platform 160 regarding standalone code implementation 144. Communication control 126 can issue instructions to cause simultaneous execution of simulation 132″ and standalone code implementation 144 in a locked-step manner so that comparison mechanism 124 can make comparison during execution of simulation 132″ and standalone code implementation 144. Comparison mechanism 124 can automatically generate a comparison model to compare the simulation 132″ and standalone code implementation 144. The comparison model may be implemented as a block diagram model, where one or more blocks are used to represent semantics of the simulation 132″ and standalone code implementation 144.
One of ordinary skill in the art will appreciate that although the illustrated example only show the standalone code implementation 144 being executing on a computing platform external to the host computer 102, the present invention can be equally applied to standalone code implementations executed on a computing platform internal to the host computer 102.
In another embodiment of the present invention, comparison mechanism 124 can compare standalone code implementation 144 executed on computing platform 160 with standalone code implementation 144′ executed on host computer 102. Communication control 126 can issue instructions to cause simultaneous execution of standalone code implementation 144′ and standalone code implementation 144 in a locked step manner so that comparison mechanism 124 can make comparison during execution of the standalone code implementation 144 and standalone code implementation 144′. Models can be used to represent the execution of the standalone code implementation under a certain environment. Comparison mechanism 124 can automatically generate a comparison model to compare the standalone code implementation 144′ and standalone code implementation 144. The comparison model may be implemented as a block diagram model, where one or more blocks are used to represent semantics of the standalone code implementations 144 and 144′.
In a further embodiment of the present invention, comparison mechanism 124 can compare execution results of standalone code implementation 144′ and standalone code implementation 146′. Standalone code implementation 144′ and standalone code implementation 146′ mayor may not be executed by the same processor or controlled by the same operating system. Communication control 126 can also issue instructions to cause simultaneous execution of the standalone code implementations 144′ and 146′ in a locked step manner so that comparison mechanism can make comparison during execution of the standalone code implementations 144′ and 146′. Comparison mechanism 124 can automatically generate a comparison model to compare the standalone code implementation 146′ and standalone code implementation 144′. The comparison model may be implemented as a block diagram model, where one or more blocks are used to represent semantics of the standalone code implementations 144′ and 146′.
Once a user provides comparison instructions, comparison mechanism 124 can compare execution of two different standalone code implementations on the same type of computing platforms. In another embodiment of the present invention, comparison mechanism 124 can obtain comparison instructions from a specific location in the storage. Comparison mechanism 124 can also compare execution of the same standalone code implementations on different types of computing platforms. The present invention also allows comparison mechanism 124 to compare execution of different standalone code implementations on different types of computing platforms. Furthermore, the present invention can also compare execution of one standalone code implementation on an external computing platform with another standalone code implementation on an internal computing platform on the host computer. Additionally, the present invention also enables comparison of execution of two standalone code implementations on the same computing device.
Implementation 220 includes block 204′ that receives input signals from block 202 via input port 242 and outputs signals to output port 244. Block 204′ can represent execution of a portion of standalone code implementation 144 on the computing platform 160. Furthermore, block 204′ can represent execution of a function of the standalone code implementation 144 on the computing platform 160. Communication control 126 can make a function call via block 204′ to computing platform 160. For example, block 204′ can be a gateway block that is described in the U.S. patent application Ser. No. 11/028,172, which is incorporated herein by reference in its entirety. Alternatively, real-time data transfer such as Texas Instruments Real-Time Data Exchange (RTDX), processor in the loop (PIL), or hardware in the loop (HIL) technology may be used by communication control 126 to communicate with computing platform 160 to implement a gateway block. In another embodiment of the present invention, the gateway block can be built using the PIL technology featured in Embedded Target for Motorola MPC555 from Math Works of Natick, Mass., or TargetLink from dSPACE of Germany. One of ordinary skill in the art will appreciate that there are many technologies that can be used to construct a gateway block that is suitable to use in the present invention. In another embodiment of the present invention, block 204′ can be a co-simulation block, such as one from The MathWorks' product EDA Simulator Link, to communicate between the host computer and the computing platform that executes the standalone code implementation.
In one embodiment of the present invention, block 204′ can be viewed as the equivalent of block 204 that is in the standalone code implementation 144. A user can choose to compare output signals from block 204 with output signals from block 204′. Hence block 204′ is the part of the standalone code implementation 144 that the user wishes to compare with block 204. A user can use a difference block 256 to compare the output signals from blocks 204 and 204′. Difference block 256 takes the output signals of block 204′ and subtracted from the output signals of block 204. The output of the difference block 256 can then be supplied to sink block 212.
Implementation 220 also includes block 206′ that receives signals via input port 246. Switch 222 can be provided to choose between output signals from block 204 and the ones from block 204′. Hence, a user can choose if block 206′ will have the same inputs as block 206 and to prevent error propagation from one block to another. On the other hand, a user might want to know the cumulative error in the implementation 220 relative to implementation 200 so that in this case, the user would want to use output signals from block 204′ to feed into block 206′. Block 206′ has an output port 248 where a signal exits block 206′. Again, a use can choose to compare output signals from block 206 and block 206′ via a difference block 258. Difference block 258 takes the output signals from block 206′ and subtracted from the ones from block 206. The results from the difference block 258 are then inputted to sink block 214. Switch 224 allows a user to choose an input signal to block 208′ via input port 250. If switch 224 is used to choose output signals from block 206, then block 208′ will have the same input signals as block 208. Alternatively, if switch 224 is used to choose output signals from block 206′, then errors in the output signals of block 206′ are included as part of the input signals into block 208′. Block 208′ output signals via output port 252 and the signals are inputted to sink block 210′ via its input port 254. Output signals from 208 and block 208′ are compared using difference block 260 and the output from the difference block 260 is then inputted into block 216. Outputs from blocks 204′, 206′ and 208′ are considered as intermediate outputs of the implementation 220 as they are not inputs or the final outputs of the implementation 220. Hence the present invention provides a method and a system to compare intermediate outputs of different implementations.
One of ordinary skill in the art will appreciate that there are many ways to compare two signals and difference blocks 256, 258, and 260 are merely examples. Additionally, a user can choose if he wants to compare signals at every block, such as shown in
Block 204′, block 206′, block 208′ and block 210′ can be implemented as gateway blocks that is described in the U.S. patent application Ser. No. 11/028,172. A gateway block may transmit and receive data for exchange between the application 120 and the computing platform 160. A gateway block can contain discrete components capable of accomplishing a variety of tasks. For example, the gateway block can include a component for use in passing the input data and parameters of a function to be executed to the external processor, a component for use in executing the function, and a component which retrieves the intermediate outputs from the target platform. Using a plurality of discrete components designed for accomplishing individual tasks, the interaction between the application 120 and the computing platform 160 can be separated.
In one embodiment of the present invention, a communication channel can be set up by the gateway block or the application 120 to communicate with computing platform 160. An application program interface (API) containing a set of routines and protocols necessary for initialing control and data transfer communications to the target platform can be used. By invoking the API's individual functions of the processor in the external environment can be called with input data and parameters provided from the model environment for use in the processor environment. Additionally, with the API, several functions residing on the computing platform 160 can be called. Furthermore, for each target platform or external processor, using the API the application 120 can manage all context switching associated with calling the function, such as saving and restoring context, setting the program counter, setting a breakpoint at the end of the called function, and executing standalone code implementation on the target platform or external processor. After the function has executed, the API can be used in retrieving the output data via the communication channel for use in the block diagram model.
One of ordinary skill in the art will appreciate that although blocks 204′, 206′, 208′ and 210′ have been described to communicate with the same target platform, blocks in one model can communicate with different target platforms or external processors. The combination of the different target platforms and/or external processors can be viewed as one big system that communicates with one model. One of ordinary skill in the art will also appreciate that
Lastly, a comparison report can be generated in step 318. The report can include statistics that include, but not limited to, error rates, error distribution, and sensitivity. Error rates can be any commonly used error rate or ally user-defined error rate, such as mean time before error, mean time between errors, errors per unit time, and errors per run. Error distribution can include a commonly used distribution, or any user-defined distribution, such as a probability distribution function and a probability density function. Sensitivity can include, but not limited to, independent subsystem-level sensitivity to subsystem input, accumulated subsystem-level sensitivity to application input, independent subsystem-level sensitivity to subsystem parameters, and accumulated subsystem-level sensitivity to parameters. Commonly used statistic tools may be included as part of the application 120. Application 120 can also provide mechanisms so that a user can use a custom defined function implemented in a technical computing application, such as the MATLAB® programming environment, to calculate a user defined error rate, user defined error distribution, or user defined sensitivity. The report may also include statistics that include percentage of occurrences in which differences in value of two intermediate outputs are greater than a user-defined tolerance. The report may additionally include figures, such as plots of differences as a function of time, bar graphs showing sensitivity metrics of different intermediate outputs, pi charts showing percentage of error contribution factors.
The present invention provides a method for comparing and/or verifying by a user using user-defined information and/or rules. Reports can also be automatically generated using user-defined information and/or rules. The present invention relieves the user the burden to write manual code to compare two implementations. The present invention also relieves the user the burden to write manual code to communicate with an external computing platform to send instructions and retrieve execution data. The present invention allows easy verification between original design and the automatically generated standalone code implementation from the original design. The present invention also allows easy comparisons among a number of different simulations and/or standalone code implementations, such as multiple implementation techniques for a given computing platform, multiple automatically generated standalone code implementations from one design for multiple different computing platforms, simulations of a design with different optimization techniques, simulations of a design using different combinations of computing platforms.
The verification harness 1004 may include a plurality of components or modules. Specifically, the verification harness 1004 may include a target block identifier 1016, a textual string generator 1018, a plurality of look-up tables (LUTs) 1020, an embedded text block generator 1022, a verification model builder 1024, a text file builder 1026, an optimizer 1028, and a result comparator 1030. The textual string generator 1018 may include a mapper 1031.
A suitable text-based computing environment 1002 is the MATLAB® programming environment, which is a dynamically typed, matrix-based programming system. A suitable graphical modeling environment is the Simulink® model-based design system.
It should be understood that the arrangement of
As described herein, the verification harness 1004 receives a selected graphical model, as illustrated by arrow 1032, and one or more specified target blocks, as indicated by arrow 1034. The verification harness 1004 is configured to automatically generate a verification model 1036 and/or one or more executable text files 1038. The verification harness 1004 is further configured to perform simulation verification between the selected graphical model and the verification model 1036 and/or the text files 1038. Specifically, the verification harness 1004 may run or execute the selected graphical model and the verification model 1036 and/or the one or more executable text files 1038, and compare the results produced thereby.
The target block identifier 1016, textual string generator 1018, LUTs 1020, embedded text block generator 1022, verification model builder 1024, text file builder 1026, optimizer 1028, and result comparator 1030 as well as the system object class definition 1008 may be or may include software modules or libraries containing program instructions pertaining to the methods described herein, that may be stored on computer readable media, such as memory 108 (
The model 1200 includes a plurality of executable, graphical blocks that are interconnected by lines or edges. Depending on the type of graphical model, the lines may represent data flow, pathways for signals, etc. The model 1200 includes a plurality of Mean blocks 1210a-e. Each Mean block 1210, moreover, is coupled to a respective source block 1212 and a respective sink block 1214.
It should be understood that the graphical model 1200 of
Each block of graphical model 1200, such as the Mean blocks 1210a-e, may have one or more parameters or properties. Block parameters are attributes that may be specified by the user for the respective block, and are used during execution of the block. The user specifies an attribute of a block by setting the parameter to a corresponding value. For example, a Gain block may include a Gain parameter, a Mean block may include Running Mean and Dimension parameters, etc. The parameters of a block may be initialized to default values by the graphical modeling environment 1006. A user may set the block's parameters by calling up a parameter or property page for display on the visual display device 116.
Referring now to
In addition to inputting the selected model to the verification harness 1004, the user also may select one or more graphical, executable blocks of the model as target blocks, i.e., the blocks of the model that are to be verified, as indicated at block 1106. For example, upon selection of the Verify Model command, a pop window or dialog box may be presented to the user. The dialog box may include fields and command buttons for configuring the verification process. By manipulating one or more fields or buttons of the dialog box, the user may select one or more of the graphical, executable blocks of the selected graphical program for automatic verification. In an embodiment, the dialog box lists each of type of graphical, executable block that is present in the selected graphical model. The user may specify one or more types of blocks of the model as the target blocks to be verified.
It should be understood that, instead of selecting one or more target block types, the user may specify one or more particular blocks of the selected graphical model, one or more subsystem blocks, or the entire graphical model. The target block identifier 1012 may examine, e.g., parse, the received graphical model and identify each individual occurrence of the specified target block type in the selected graphical model, as indicated at block 1108. The target block identifier 1012 may pass information regarding each occurrence of the target block type in the graphical model to the textual string generator 1018. In particular, the target block identifier 1012 may determine the parameter values of each occurrence of the target block type based on its analysis of the selected graphical model, as indicated at block 1110. A block's parameters may be obtained by accessing the block mask of the block. The target block identifier 1012 also may determine the signals received by each occurrence of the target block type, i.e., the input data to the block, and the source of those signals, such as other blocks of the model. The target block identifier 1012 may also determine the signals produced by the block, i.e., the block's output data, and the other blocks of the model that receive those signals.
It should be understood that the target block identifier 1012 and the textual string generator 1018 may process an in-memory representation of the graphical model 1200 generated by the graphical modeling environment 1006.
In accordance with an embodiment of the present invention, the functionality of each target block type may be implemented through a corresponding system object 1012 instantiated by the system object constructor 1006. That is, for each target block type of the selected model, there is a corresponding system object class provided by the class packages 1011. For example, for a Mean block, there is a system object class that performs a similar mean function, for a Gain block, there is a system object class that performs a similar gain function, for a counter block, there is a system object class that performs a similar counter function. As indicated above, each executable, graphical block has a plurality of block parameters that are used by the block to implement the functionality of the block. Similarly, each system object 1012 has a plurality of object properties that are used by the system object to implement its functionality.
A suitable system object architecture for use with the present invention is described in commonly owned, co-pending U.S. patent application Ser. No. 11/519,255 filed Sep. 11, 2006 for a System and Method for Using Stream Objects to Perform Stream Processing in a Text-Based Computing Environment, which has been published as U.S. Patent Publication No. 2008/0127064 A1, and which is hereby incorporated by reference in its entirety. Notably, the application uses the term “stream object,” rather than “system object” as used herein.
The textual string generator 1014 preferably accesses information in the LUTs 1020 in order to automatically generate an object-oriented, textual string implementing a corresponding system object for each occurrence of a target block type in the selected graphical model. Each LUT 1020 represents a predefined mapping between block parameters and system object properties. In most cases, however, there is not a one-to-one mapping between block parameters and object properties.
As shown, while the Counter system object performs essentially the same function as the Counter block of the graphical model, the property types of the system object are not exactly the same as the parameter types of the block. Nonetheless, the LUT 1020 provides a mapping of each block parameter to one or more properties of the system object, as illustrated by arrows 1310a-k. Some block parameters map to a single system object property. For example, the Direction parameter 1304a maps to the Direction object property 1308a, the SamplesPerFrame parameter 1304c maps to the SamplesPerFrame object property 1308d, and the MaxCount parameter 1304f maps to the MaximumCount object property 1308g. Other block parameters, however, map to multiple object properties. For example, the CountEvent parameter 1304b maps to both the CountEventInputPort object property 1308b and the CountEventCondition object property 1308c. Similarly, the Output parameter 1304g maps to the CountOutputPort property 1308h and the HitOutputPort property 1308i.
In an embodiment, the mapping of block types to system object classes as well as the mapping of block parameters to system object properties is predefined and stored at the LUTs 1020 of the verification harness 1004. The mapping may be defined manually based on a review of the block types supported by the graphical modeling environment 1006 and the object classes defined by the class packages 1011. It should be understood that, in some cases, there may not be a suitable system object class for a given block type.
It should be understood that graphical blocks may be mapped to system objects based on name, as stored at the LUTs 1020. That is a Mean block may map to a Mean system object. A Counter block may map to a Counter system object. It should be further understood that a graphical block may map to a system object of another name. As mentioned above, the mapping of graphical blocks to system objects may be predefined and stored at the LUTs 1020. A single graphical block, moreover, may map to multiple system objects, and multiple graphical blocks may map to a single system object. The desired mapping may be implemented through the mapper 1031.
It should be further understood that, in addition to mapping block parameter types to object property types, the values of a block parameter also may need to be translated, converted or otherwise modified as they are mapped to one or more system object properties, as indicated at block 1112. In an embodiment, the LUTs 1020 are implemented through code snippets that, when executed, e.g., by the mapper 1031 of the textual string generator 1018, map block parameters to object properties and perform any conversion or processing of the block parameter values that may be required. In an embodiment, the code snippets may be written in a format that is executable by the execution engine 1010 of the text-based computing environment.
For those block parameter values that can be assigned directly to a system object property value, an assignment statement may be used, such as assignment 1406, which assigns the block parameter Direction to the system object property of the same name, and assignment 1408, which assigns the block parameter InitialCount to the system object parameter of the same name. For other block parameters condition statements, such as ‘switch’ statements, may be used to perform the mapping of block parameters to system object properties. A first condition section 1410 may be used to evaluate the block parameter “CountEvent” and assign values to one or more system object properties depending on the value of the block's CountEvent parameter. For example, if the CountEvent parameter is set to ‘Rising edge’, then the system object property CountEventInputPort is set to ‘true’, as indicated by line 1412, and the system object CountEventCondition is set to ‘Rising edge’, as indicated by line 1414. Alternatively, if the block's CountEvent parameter is set to ‘Free running,’ then the system object's CountEventInputPort property is set to ‘false’, as indicated by line 1416, and the object's SamplesPerFrame property is set to the same value as the block's SamplesPerFrame property, as indicated by line 1418.
A second condition section 1420 of the code snippet 1400 evaluates the block's CounterSize parameter, and sets the system object's CounterSize and MaximumCount properties. A third condition section 1422 evaluates the block's Output parameter, and sets the system object's CountOutputDataType, CountOutputPort, and HitOutputPort properties, among others. A fourth condition section 1424 evaluates the block's ResetInput parameter, and sets the system object's ResetInputPort property.
It should be understood that the other LUTs 1020 may be implemented through other such code snippets that may be executed by the mapper 1031.
The textual string generator 1018 processes the information received from the target block identifier 1012 regarding each occurrence of the target block type in the received graphical model as well as mapping information from the mapper 1031, and automatically generates one or more, executable, object-oriented (OO) textual strings for each such occurrence of the target block type in the graphical model, as indicated at block 1114. Specifically, the textual string generator 1018 may utilize the ‘props’ structures that are created by running the ‘getMap’ function for each occurrence of the target block type in order to automatically generate an object-oriented textual string for performing the functionality of the respective occurrence of the target block type, as indicated at block 1114.
Each textual string may include one or more commands that, when executed, instantiates an instance of a system object, sets the properties of the instantiated system object, and calculates one or more outputs based on one or more specified inputs and on the system object's properties. In addition to calculating the one or more outputs, the system object may also update one or more internal states. It should be understood that two or more, or even all of these commands, may be combined into a single command, depending on the syntax supported by the system object constructor 1008.
As shown, the command for instantiating the system object and setting its properties has the following syntax:
object_handle=<packagename>.<ObjectName>(property-value pair 1, property-value pair 2, property-value pair 3, . . . )
As shown in
The property-value pairs include:
‘RunningMean’, 0
‘Dimension’, ‘Column’
‘RoundingMethod’, ‘Floor’
‘OverflowAction’, ‘Wrap’
‘AccumulatorDataType’, ‘Same as input’, and
‘OutputDataType’, ‘Same as accumulator’.
It should be understood that the system object constructor 1008 may support other ways or techniques, besides the use of property-value pairs, to set the system object's properties.
The textual string 1500 also includes a line that terminates the ‘if’ statement, as indicated at line 1510. The textual string 1500 also includes a command that runs the instantiated object, as indicated at line 1512. The run command may have the following syntax:
output variable=step(object_handle, input variable)
The ‘step’ command or method causes the system object to calculate its outputs, using the inputs to the system object and the object's properties and internal states. The definition of the function ‘fcn’ is then terminated as indicated at line 1514.
It should be understood that an instantiated system object's properties may be set with a separate command, such as a ‘Set’ command. It should also be understood that the instantiation of the system object, the setting of its properties, and the running of the object all may be implemented through a single command or method.
In this way, the textual string generator 1018 may create an object-oriented, textual string automatically for each occurrence of the target block type in the selected graphical model. In an embodiment, the textual string generator 1018 may pass each generated textual string to the embedded text block generator 1022, which in turn may create an embedded text block containing the respective textual string, as indicated at block 1116. It should be understood that multiple textual strings corresponding to multiple system objects may be embedded in a single embedded text block. The embedded text blocks containing the generated strings may be passed to the verification model builder 1024. The verification model builder 1024 may be configured to create a verification model that is similar to the selected graphical model, except that, in the verification model, each occurrence of the target block type is replaced with the corresponding embedded text block that contains the textual string generated for that occurrence of the target block type, as indicated at block 1118. The verification model 1036 is designed to function like the selected graphical model that was received by the verification harness.
For those blocks of the graphical model that are not target blocks, the verification model builder 1024 uses the same executable, graphical blocks. In addition, the verification model builder 1024 assembles the verification model 1036 in the same way as the selected graphical model. The verification model 1036 created by the verification model builder 1024 may be output by the verification harness 1004.
The optimizer 1028 may perform one or more optimization operations on the verification model 1600, such as block reduction and insertion. Specifically, the optimizer 1028 may be configured to reduce the number of embedded text blocks in the verification model 1600. For example, the optimizer 1028 may analyze the verification model 1600 and determine that at least some of the embedded text blocks 1602a-e may be combined into a single embedded text block. That is, the object oriented textual strings that represent several graphical blocks may be combined into a single embedded text block of the verification model 1600. Such an optimization may facilitate efficient code generation from the verification model 1600, e.g., by reducing overhead and reducing the number of embedded text blocks to be compiled. The optimizer 1028 may be configured to perform other optimization operations, including other operations intended to further enhance code generation from the verification model 1600.
In another embodiment, the textual string generator 1018 may pass each of the automatically generated textual strings to the textual file builder 1026. The textual file builder 1026 may assemble the textual strings into one or more executable, textual verification files, as indicated at block 1120 (
It should be understood that the optimizer 1028 may be configured to perform one or more optimization operations on the textual verification files, e.g., to improve code generation from those files.
To perform simulation verification, the verification harness 1004 may cause both the selected graphical model and the verification model 1036 to be run, i.e., executed, as indicated at block 1122. In particular, the verification harness 1004 may cause the simulation engine 1015 of the graphical modeling environment 1006 to run both the selected graphical model and the verification model 1036. To execute the textual strings contained in the embedded text blocks of the verification model 1036, the simulation engine 1015 may access or pass the strings to the system object constructor 1008, e.g., via the API layer 1014. The system object constructor 1008 may invoke the methods or commands of the textual strings, thereby instantiating the system objects, setting their properties, and running the system objects to produce one or more outputs. The outputs produced by the system objects may be returned to the simulation engine 1015 for further processing as part of the verification model 1036.
The outputs produced by the graphical model and the verification model 1036 may be provided by the simulation engine 1015 to the verification harness 1004. The result comparator 1030 of the verification harness 1004 may examine the results from the graphical model and the verification model 1036, and determine whether or not the results are the same, as indicated at block 1124. If a textual verification file was created by the verification harness 1004, it may be provided to the text-based computing environment 1002 for execution by the execution engine 1010 in cooperation with the system object constructor 1008, as indicated at block 1126. The results, e.g., the outputs, of the execution of the textual verification file 1038 may be provided by the text-based computing environment 1002 to the verification harness 1004. These outputs may be analyzed by the result comparator 1030, as indicated at block 1128.
The result comparator 1030 may produce a report for the user that presents the results produced by both the selected graphical model and the verification model 1036 and/or the selected graphical model and the textual verification file 1038, as indicated at block 1130. For example, the report may indicate whether the results from the various implementations are the same or not. If the results are the same, then the system objects represent an equivalent manner of implementing the functionality or procedure represented by the selected graphical model. Processing may then terminate, as indicated by end block 1132.
It should be understood that data logging probes may be added to the selected graphical model so that signals may be obtained from the graphical model and provided as inputs to the system objects instantiated by the textual verification file. Similarly, outputs of the system objects may be returned to the graphical model through data logging probes.
It should be further understood that the verification harness 1004 may be configured to verify or compare the selected graphical model 1200 with the verification model 1036 as previously described in connection with
It should be understood that the verification harness 1004 may be used solely to create the verification model 1036 and/or the textual verification files 1038 without verifying their behavior as compared to the selected graphical model. A user may conduct further study and perform additional refinements to the verification model 1036 and/or the textual verification files 1038. The user may also compile the verification model 1036 and/or the textual verification file 1038 to generate stand-alone object code.
Suitable code generation engines for use with the present invention include the Real Time Workshop® code generation system and the Simulink HDL Coder system from The MathWorks, Inc., the DSP Builder product from Altera Corp. of San Jose, Calif., and the System Generator product from Xilinx, Inc. of San Jose, Calif. Additional code generation systems are described in U.S. Patent Publication No. 2008/0127057 for Specifying Implementations of Code for Code Generation from a Model, published May 29, 2008, and U.S. Patent Publication No. 2006/0064669 for Automatic Generation of Code for Component Interfaces in Models, published Mar. 23, 2006, each of which is hereby incorporated by reference in its entirety.
The code generation engine 1033 generates code for the received verification model or verification files utilizing the user-specified options, as indicated at block 1706. To the extent the code generation engine 1033 generates source code conforming to a high-level programming language, the source code may be compiled into object code, as indicated at block 1708. To the extent the code generation engine 1033 generates HDL code, the generated HDL code may be used to synthesize a target hardware device, as indicated at block 1710. More specifically, the HDL code may be provided to a synthesis tool and synthesized into a gate-level netlist, which may be used to create a layout for creating or configuring a physical hardware device, such as an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), a Programmable Array Logic (PAL), or other type of physical hardware devices.
The generated code may be subjected to testing, such as hardware-in-the-loop (HIL) testing, as indicated at block 1712. That is, a target platform configured to run the generated code may be connected to the computing device 1000. A graphical model simulated by the graphical modeling environment 1006 may interoperate with the generated code running on the target platform. The graphical model may provide input data to the target platform and may receive output data, e.g., for display, produced by the target platform.
Suitable systems for performing HIL testing including the xPC Target system from The MathWorks, Inc. With the xPC Target system, a target personal computer (PC), which operates as a real-time target, is connected to a host PC that is running a text-based computing environment and/or a graphical modeling environment.
It should be understood that the code generation process may be used to accelerate verification of a model based design.
Following the testing, if any, the generated code may be deployed in a finished, real-life component that operates wholly outside and independently of the confines of the text-based computing environment 1002 or the graphical modeling environment 1006, as indicated at block 1714.
It should be understood that other forms of target code execution, such as Rapid Prototyping, Embedded System Deployment, and Processor-in-the-Loop, which execute a graphical model or portions of a model via the generated code on a real-time system target, may be utilized.
The verification harness 1800 may be implemented in a computing device, such as device 1000 (
The block generator 1804 may pass the selected and configured graphical blocks to the graphical model builder 1808. The graphical model builder 1808 may examine the input and output data of the system objects of the textual program file. The graphical model builder 1808 may then use this information in determining how the executable, graphical blocks are to be interconnected to form the graphical model 1816, as indicated at block 1910. The graphical model 1816 may be output from the verification harness 1800, and may be simulated or run by the simulation engine 1015 (
The foregoing description of exemplary embodiments of the invention provides illustration and description, but is not intended to be exhaustive or to limit the invention to the precise form disclosed. Modifications and variations are possible in light of the above teachings or may be acquired from practice of the invention. For example, some of the steps illustrated in the flow diagrams may be performed in other orders and non-dependent steps may be performed in parallel.
In addition, implementations consistent with the principles of the invention may be implemented using devices and configurations other than those illustrated in the figures and described in the specification without departing from the spirit and scope of the invention. As mentioned, devices, modules or components may be added, removed or combined depending on a specific deployment or application of the invention. Further disclosed implementations may not be limited to any specific combination of hardware.
Ogilvie, Brian K., Koh, David, Zhang, Shi Chao, Li, Zhongxin, Ibrahim, Jihad E.
Patent | Priority | Assignee | Title |
Patent | Priority | Assignee | Title |
5819071, | May 01 1996 | Jet Propulsion Laboratory | Remote simulation of data transmission |
5838948, | Dec 01 1995 | Applied Microsystems Corporation | System and method for simulation of computer systems combining hardware and software interaction |
5857091, | Mar 14 1995 | UNIFY, INC | Machine and method for simulating a processor-based digital system |
5870585, | Jan 26 1996 | Advanced Micro Devices, INC | Design for a simulation module using an object-oriented programming language |
6148323, | Dec 29 1995 | HEWLETT-PACKARD DEVELOPMENT COMPANY, L P | System and method for managing the execution of system management |
6285914, | Dec 30 1997 | HANGER SOLUTIONS, LLC | Verification method by means of comparing internal state traces |
6385765, | Jul 02 1996 | NEW YORK, THE RESEARCH FOUNDATION OF STATE UNIVERSITY OF | Specification and verification for concurrent systems with graphical and textual editors |
6625759, | Feb 18 2000 | SAMSUNG ELECTRONICS CO , LTD | Method and apparatus for verifying the fine-grained correctness of a behavioral model of a central processor unit |
6675310, | May 04 2000 | Xilinx, Inc | Combined waveform and data entry apparatus and method for facilitating fast behavorial verification of digital hardware designs |
6728913, | Feb 25 2000 | VALLEY DEVICE MANAGEMENT | Data recycling in memory |
6751583, | Oct 29 1999 | Synopsys, Inc | Hardware and software co-simulation including simulating a target processor using binary translation |
6922819, | Jan 29 2003 | Hydro-Gear Limited Partnership | System and method of optimal waveform shaping |
7076420, | Oct 26 2000 | MORGAN STANLEY SENIOR FUNDING, INC | Emulator chip/board architecture and interface |
7139936, | Feb 18 2000 | Hewlett-Packard Development Company, L.P. | Method and apparatus for verifying the correctness of a processor behavioral model |
7447621, | Sep 29 2003 | Oracle America, Inc | PLI-less co-simulation of ISS-based verification systems in hardware simulators |
7606695, | Sep 30 2003 | Oracle America, Inc | Self-checking simulations using dynamic data loading |
20030135790, | |||
20040006722, | |||
20040044990, | |||
20060225008, | |||
20070109903, | |||
20080098349, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Mar 11 2010 | The MathWorks, Inc. | (assignment on the face of the patent) | / |
Date | Maintenance Fee Events |
Date | Maintenance Schedule |
Oct 21 2017 | 4 years fee payment window open |
Apr 21 2018 | 6 months grace period start (w surcharge) |
Oct 21 2018 | patent expiry (for year 4) |
Oct 21 2020 | 2 years to revive unintentionally abandoned end. (for year 4) |
Oct 21 2021 | 8 years fee payment window open |
Apr 21 2022 | 6 months grace period start (w surcharge) |
Oct 21 2022 | patent expiry (for year 8) |
Oct 21 2024 | 2 years to revive unintentionally abandoned end. (for year 8) |
Oct 21 2025 | 12 years fee payment window open |
Apr 21 2026 | 6 months grace period start (w surcharge) |
Oct 21 2026 | patent expiry (for year 12) |
Oct 21 2028 | 2 years to revive unintentionally abandoned end. (for year 12) |