NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

User:DVT/UserDocumentation/DVT Component Reference Guide/DVT Expressions

From Texas Instruments Wiki
Jump to: navigation, search

Appendix: Expressions[edit]

Overview[edit]

A number of features in the toolkit (including those listed below) supports expression evaluation:


  • Filtering in the Tap
  • Filtering in views
  • Find in views
  • Passthru in the Generic Translator


The following is a list of Operators and Values supported by the Tool kit


Operators[edit]

Arithemetic Operators[edit]

  +             addition operator (can also be use for concatenating strings)
  -             subtraction operator
  *             multiplication operator
  /             division operator
  %             remainder operator

Logical Operators[edit]

  &&            Logical AND. E.g (A == 5) && (B == 20) will be true if A is equal to 5 and B is equal to 20
  ||            Logical OR. E.g. (A == 5) || (B == 20) will be true if A is equal to 5 or B is equal to 20

Relational Operators[edit]

  ==            Equal
  !=            Not equal
  >             Less than
  >=            Less than or equal
  <             Greater than
  <=            Greater than or equal

Bitwise Operators[edit]

  &             AND. E.g. A & 0x000F will maintain only the value of the lower 4 bits of A
  |             Inclusive OR. E.g A | 0x000F will maintain all bits in A and set all of the 4 lower bits to 1
  ^             Exclusive OR
  <<            Shift Left
  >>            Shift Right

Unary Operators[edit]

  -             negate the value
  ~             2’s complement
  !             logical NOT

like[edit]

Specify a Java regular expression. E.g. A like ‘MA%’ is true for any A values which begins with ‘MA’. For more info refer to documentation on regular-expression constructs from the Java 2 SDK Developer's web page


Values[edit]

Bit Field[edit]

Syntax I[n…m] where I is the identifier, n is the starting bit and m is the ending bit. E.g. X[0..7] represents the first 8 bits of “X”

Array[edit]

Syntax I[n] where I is the array and n is the element in the array. e.g. A[1] represents the second element of array “A”.

This operation will typically be used when working with Data Records which contains Block Type field(s). Block Type fields are arrays.

Type Cast[edit]

 (int)          cast to integer type
 (float)       cast to float type
 (unsigned) cast to unsigned integer type
 

Literals[edit]

 Integer
 Boolean
 Float
 Character
 String

Field Names[edit]

Field names from Data Records can be used in expressions.

 Note: Spaces in field name must be substituted with underscore character. Previous values are obtained by using the 


DataField name post-pended with ‘$x’, where ‘x’ is the numerical t-x value.

If ‘x’ is ‘0’, it is the current value, equivalent to just the DataField name itself. If ‘x’ is ‘1’, it is the previous value If ‘x’ is ‘2’, it is the second previous value

Previous valid values are obtained by using the DataField name post-pended with '$valid'


Example Solution[edit]

<dvt install>\dvt_resources\Example\FieldTranslator\FieldTranslator.sol

Also See[edit]

TODO: Add references to tutorials in which component is used

Enhancement Requests[edit]

Gforge Tracker ID:

Known Issues[edit]

Gforge Tracker ID: 740