quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bullet_green_ball.gif e Operators

e language includes all the operators of the regular programming language, and few additional ones.

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Bit Wise Operators

Bit wise operators work at bit level, so they are called bit wise operators. Below table list each operator and its description.

   

space.gif

Operator

Description

~

Unary bitwise negation

&

Binary bitwise AND

|

Binary bitwise OR

^

Binary bitwise XOR

>>

Shift bits right

<<

Shift bits left

   

space.gif

  ../images/main/bullet_star_pink.gif Example - Bit Wise Operator
   

space.gif


  1 <'
  2 extend sys {
  3  run() is also {
  4    var a : byte;
  5    var b : byte;
  6    var c : byte;
  7    a = 0xAA;
  8    b = 0x55;
  9    outf (" a = %b b = %b\n", a, b);
 10    // Bitwise negation
 11    c = ~a;
 12    outf ("Bitwise negation a  is     :%b\n", c);
 13    // Bitwise AND operation
 14    c = a & b;
 15    outf ("Bitwise AND of a with b is :%b\n", c);
 16    // Bitwise OR operation
 17    c = a | b;
 18    outf ("Bitwise OR of a with b is  :%b\n", c);
 19    // Bitwise XOR operation
 20    c = a ^ b;
 21    outf ("Bitwise XOR of a with b is :%b\n", c);
 22    // Left shift
 23    c = a << 2;
 24    outf ("Left shift a by 2 bits is  :%b\n", c);
 25    // Right shift
 26    c = b >> 2;
 27    outf ("Right shift b by 2 bits is :%b\n", c);
 28  };
 29 };
 30 '>
You could download file e_basics5.e here
   

space.gif

  ../images/main/bullet_star_pink.gif Specman Output
   

space.gif

 a = 10101010 b = 1010101
Bitwise negation a  is     :1010101
Bitwise AND of a with b is :0
Bitwise OR of a with b is  :11111111
Bitwise XOR of a with b is :11111111
Left shift a by 2 bits is  :10101000
Right shift b by 2 bits is :10101
   

space.gif

  ../images/main/bulllet_4dots_orange.gif Boolean Operators

Boolean operators are used in condition checking as in other languages. Below table shows e boolean operators

   

space.gif

Operator

Description

! (not)

Returns TRUE when an expression evaluates to FALSE, and vice versa.

&& (and)

Returns TRUE if two expressions are both TRUE.

|| (or)

Returns TRUE if one of two expressions is TRUE.

=>

Returns TRUE when the first expression of two expressions is FALSE, or when both expressions are TRUE.

now

Returns TRUE if an event has occurred in the current cycle.

   

space.gif

  ../images/main/bullet_star_pink.gif Example - Boolean Operators
   

space.gif


  1 <'
  2 extend sys {
  3  run() is also {
  4    var a : bool;
  5    var b : bool;
  6    var c : bool;
  7    var d : bool;
  8    outf (" a = %b b = %b c = %b\n", a, b,c);
  9    // Not Operator
 10    d =  ! (TRUE);
 11    outf ("Not of  (TRUE) is     :%b\n", d);
 12    // Boolean AND operation
 13    d = a && c;
 14    outf ("Boolean AND of a with c is :%b\n", d);
 15    // Boolean OR operation
 16    d = a || b;
 17    outf ("Boolean OR of a with b is  :%b\n", d);
 18    // Boolean implication operation
 19    d = (2 > 3) => (3 > 2);
 20    outf ("Boolean implication of (2 > 3) => (3 > 2) :%b\n", d);
 21    // Boolean implication operation
 22    d = (4 > 3) => (3 > 4);
 23    outf ("Boolean implication of (4 > 3) => (3 > 4) :%b\n", d);
 24    // Below code does not make sense
 25    if now @sys.any then {
 26     out("sys.any occurred");
 27    };
 28  };
 29 };
 30 '>
You could download file e_basics6.e here
   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Specman Output
   

space.gif

 a = 0 b = 0 c = 0
Not of  (TRUE) is     :0
Boolean AND of a with c is :0
Boolean OR of a with b is  :0
Boolean implication of (2 > 3) => (3 > 2) :1
Boolean implication of (4 > 3) => (3 > 4) :0
   

space.gif

  ../images/main/bulllet_4dots_orange.gif Arithmetic Operators

Arithmetic operators are same in any other programming language.

   

space.gif

Operator

Description

Unary +

Unary plus

Unary -

Unary minus

+

Binary addition

-

Binary addition

   

space.gif

  ../images/main/bullet_star_pink.gif Example - Arithmetic Operators
   

space.gif


  1 <'
  2 extend sys {
  3  run() is also {
  4    out("10    = ",+10);
  5    out("-10   = ",-10);
  6    out("10+10 = ", 10 +10);
  7    out("10-1  = ", 10 -1);
  8    out("10*2  = ", 10 *2);
  9    out("10/2  = ", 10 /2);
 10    out("10%3  = ", 10 %3);
 11  };
 12 };
 13 '>
You could download file e_basics7.e here
   

space.gif

  ../images/main/bullet_star_pink.gif Specman Output
   

space.gif

10    = 10
-10   = -10
10+10 = 20
10-1  = 9
10*2  = 20
10/2  = 5
10%3  = 1
   

space.gif

  ../images/main/bulllet_4dots_orange.gif Comparison Operators

Same as in Verilog, and few more

   

space.gif

Operator

Description

<<=>>=

Compares two numeric expressions or HDL pathnames.

== !=

Determines whether two expressions are equal or not.

=== !==

Performs a 4-state, Verilog-style comparison of HDL objects.

~ !~

Determines whether two string expressions are equal or not.

in

Determines whether an expression is in a list or a range.

   

space.gif

  ../images/main/bulllet_4dots_orange.gif String Matching

String matching is performed with AWK-style regular expressions. You can use the standard AWK regular expression notation to write complex patterns. This notation uses the /&/ format for the pattern to specify AWK-style regular expression syntax.

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Extraction and Concatenation Operators
   

space.gif

Operator

Description

[ ]

Extracts or sets a single item from a list.

[ ; ]

Extracts or sets consecutive bits or slices of a scalar, a list of bits, or a list of bytes.

[ .. ]

List slicing operator

[ range,...]

Range list operator

{ ; }

List concatenation

%{&}

Bit concatenation

   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com