The above and other features and advantages of the present invention will become more apparent by describing in detail preferred embodiments thereof with reference to the attached drawings in which;
Hereinafter, the present invention will be described in detail by explaining preferred embodiments of the invention with reference to the attached drawings. Like reference numerals in the drawings denote like elements.
The storage device 140 stores an expression-token table, the expression-token table comprising an expression that can be included in a USB packet trace and a token corresponding to the expression and a syntax tree forest generated based on at least one token corresponding to the expression that can be included in the USB packet trace.
The expression-token table and the syntax tree forest may be stored in the storage device 140 in advance. The USB packet trace signifies a sequence of packets that a USB host 210, for example, a computer, outputs to a USB device 220.
When an overall syntax tree is generated by a combination of the syntax trees shown in
Each of the syntax trees can be realized as an array, a linked-list, a doubly linked-list, 8+ tree, etc. The scope of the syntax trees is not limited thereto.
In a process of converting the USB packet trace according to an exemplary embodiment of the present invention, the USB device 220 is tested by assuming a logic error of the USB device 220 or an error of firmware that drives the USB device 220. Since it is assumed that there is no syntax error of the USB packet trace output from the USB host 210, the sentences included in the USB packet trace conform to the syntax expressed by the syntax tree forest. Thus, the USB packet trace is converted to a code that can be used in the RTL/NET simulation by using the expression-token table and the syntax tree forest.
The token generation module 110 receives the USB packet trace output S from the USB host 210 (S10) and generates at least one token corresponding to the received USB packet trace based on the expression-token table stored in the storage device 140 (S20). The token generation module 110 searches the expression-token table stored in the storage device 140 for an expression included in the received USB packet trace (S21) and generates the searched -10 expression as at least one token from the token stored in the expression-token table corresponding to the expression (S23). The operations S21 and S23 for generating the expression as a token can be repeated until all the expressions included in the USB packet trace are generated as tokens corresponding thereto (325).
The syntax tree determination module 120 determines the syntax tree corresponding to at least one token that is generated based on the syntax tree forest stored in the storage device 140 (S30). The syntax tree determination module 120 searches the syntax tree forest stored in the storage device 140 for the token that is generated (S31) and determines whether the searched syntax tree corresponds to the token (333).
The host code generation module 130 generates a code for a USB host model corresponding to the determined syntax tree (S40). The host code generation module 130 converts a sub-tree of the determined syntax tree to a host model code (S41). When all sub-trees of the syntax tree are converted (S43), the host code generation module 130 converts a root of the syntax tree to the host model code (S45).
An operation of the USB packet trace converting apparatus 100 will be described in detail with reference to
The token generation module 110 searches the expression-token table for the first expression of “ping” of the packet trace (S21). The token generation module 110 generates the token of “PING” corresponding to the first expression of “ping” (S23). Also, the token generation module 110 determines whether all expressions are generated as tokens corresponding thereto (S25) and generates tokens until there is no expression that is not generated as a token. The generated token, the combination of the tokens corresponding to the received USB packet traces is shown in (2) of
The syntax tree determination module 120 determines the syntax tree based on the generated token (S30). The syntax tree forest shown in FIGS. SA through 3S is searched for a syntax tree having the first token of “PING” as a node (S31). Since the syntax tree of
Since the second sub-tree of the syntax tree of
The next sub-tree is “endp_state” and the syntax tree forest shown in
The next sub-tree is “idel_state” and the syntax tree forest shown in
The host code generation module 130 generates a host model code based on the syntax tree shown in (3) of
The first sub-tree of the syntax tree shown in (3) of FIG, 5, that is, a sub-tree having “PING” as a root, is converted to a host model code (S41). Since the first sub-tree is a sub-tree having a token “PING” as a root, no code is generated.
Since all sub-trees are not converted to the host model code (S43), the host code generation module 130 converts the next sub-tree, that is, a sub-tree having “addr_state“ as a root, to the host model code (541). The conversion begins from a sub-tree of the sub-tree, that is, the sub-tree having “addr_state” as a root, to convert the sub-tree having “addr_state” as a root to the host model code (S41). Since all sub-trees include tokens of “ADDR”, “EO”, and “NUM”, no code is generated as a result of the conversion of all sub-trees to codes. When the root of the sub-tree, that is, the sub-tree having “addr_state” as a root, is converted to the host model code (S45), “USB_pkt.addr=atoi($3);” is generated.
The host code generation module 130 converts the next sub-tree, that is, a sub-tree having “endp_state” as a root, to the host model code (S41). The conversion begins from a sub-tree of the sub-tree, that is, the sub-tree having “endp_state” as a root, to convert the sub-tree having “endp_state” as a root to the host model code (S41). Since all sub-trees include tokens of “ENDP”, “EQ”, and “NUM”, no code is generated as a result of the conversion of all sub-trees to codes, When the root of the sub-tree, that is, the sub-tree having “endp_state” as a root, is converted to the host model code (S45), “USB_pkt.endp=atoi($3),” is generated.
The host code generation module 130 converts the next sub-tree, that is, a sub-tree having “idle state” as a root, to the host model code (S41). The process of converting the sub-tree, that is, sub-tree having “idle_state” as a root, to the host model code is similar to that of converting the above sub-trees, that is, the sub-tree having “addr_state” or “endp_state” as a root, to the host model code. No code is generated for the sub-tree having “idle_state” as a root (S45).
Since the code conversion of all sub-trees of the syntax tree, that is, the syntax tree having “out_ping_state” as a root, is complete (S43), when the root is converted to the host model code (S45), “USB_opkt.do(ping);” is generated. The host model code corresponding to the syntax tree shown in (3) of
The representation of the method for converting the above determined syntax tree to the host model code with yacc_notation (yet another compiler compiler_notation) is shown below. However, the following code is merely an exemplary embodiment of a case in which the host model code is a USB eVC (e Verification Components) code. However, the code can be embodied in other different methods according to the type and embodiment method of the host model code; the scope of the present invention is not limited thereto.
Referring back to
The host model 300 receives the host model code output from the host code generation module 130 and outputs a host signal corresponding to the received host model code. The host model 300 outputs the host signal to a USB device model (not shown). The USB device model receiving the host signal outputs a signal in response to the host signal. A user may check the signal output from the USB device model through a simulator to test the USB device.
The USB packet trace converting apparatus 100 converts the USB packet trace that the USB host 210 outputs to the USB device 220, to the host model code that can be used by the host model 300. The host model 300 outputs a host signal corresponding to the host model code to the USE device model, The USB device model outputs a signal In response to the host signal. Thus, the operation and generated signal of the USB device is tested using the same error situation as an actual situations
The host model 300 may be a USB eVC (e Verification Components) and the USB device model can model an RTL level through Verilog, Synopses' VCS, or Mentor's Modelism.
The present invention can be embodied as computer readable codes on a computer readable recording medium. The computer readable recording medium may be any data storage device that can store data that can be read by a computer system Examples of the computer readable recording medium include read-only memory (ROM), random-access memory (RAM), CO-ROMs, magnetic tapes, floppy disks optical data storage devices, and carrier waves (such as data transmission through the Internet). The computer readable recording medium can also be distributed over network coupled computer systems so that the computer readable code is stored and executed in a distributed fashion. Functional programs, codes, and code segments for implementing embodiments of the present invention can be understood by those of ordinary skill in the art to which the present invention pertains.
As described above, the method and system for testing a USB device according to an embodiment of the present invention reproduce an error of an actual situation and simulate the same internal signal and device status as those in an RTL/NET (netlist: gate level) simulation,
While this invention has been particularly shown and described with reference to preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the disclosure.
Number | Date | Country | Kind |
---|---|---|---|
10-2006-0070589 | Jul 2006 | KR | national |