ExpressionList

Parent Previous Next

Behavior / ExpressionList
Block Name: ExpressionList

Code File Location: VisualSim/actor/lib/Expression_Decision

Block Overview

  o  Define attributes of the traffic or transaction. 

  o  Construct a sequence of mathematical expressions or calculations.

  o  Compute latency or processing time.

  o  This block has a output port condition that determines if the data is sent on that port.

Description

The ExpressionList block executes a sequence of expressions in order. The default block contains one input and one output. The user can add multiple input and output ports. To add ports right-click on the block and select Customize -> Ports. The block starts executing when all the input ports receive data. The input can be of any data type including a data structure.

The expressions can use the data on all the Input ports, Memories (Global and Local), Parameters, Numerical values and String Constants. The user can define block memories that will maintain its value only while the current set of data inputs are being executed. The expressions are executed in synchronous time i.e., there is no time delay for the execution. The data structure or token value at each input is identified by the port_name.  So, the time field on the data structure at input_port_2 will be used in the expression as input_port_2.time.  For example, input_port_2.time=TNow, where the field is updated with the current simulation time.

The entire power of the RegEx language can be used in the expressions.

Every port in the Output_Port list has an equivalent expression or a true/false value in the Output_Condition parameter. If the expression evaluates to a true or the value is true, the Output_Value is sent on the Output_Port. If the Output_Condition is false, no value is sent on the particular Output_Port. The number of items separated by comma in the Output_Condition must match the number in the Output_Ports and Output_Values.

There are two types of  expressions that are used this block:

Standard equation such as X=Y+Z or X = irand (1,2) + 24
Transitional if-statement such as X = (Y>10)?1:(A+C).

The user can enter comments anywhere in the Expression window.  The comments must start with a /* and end with */.  No ";" is required at end of each line.

Refer Adding Logic, Control and Processing Delay demo model.


Parameter

Explanation

Type

 Example 

Expression_List

This window contains the sequence of expressions.  The expressions are executed in order.

String

/* Template to enter multiple RegEx lines */
   input.A_Time = TNow
   input.A_Priority = 1
   input.A_Destination = "Cache_1"
/* Add as many RegEx lines are required */

Output_Ports

Comma separated list of output Port Names, including default of 'output' and user added ports.

String

output

Output_Values

Comma separated list of output Port Values.

String

input

Output_Conditions

Comma-separated list of boolean values that determine whether the Output_Value must be sent on this port or not.  True indicates an output and a false indicates that nothing is transferred.

String

true, false



Port

Explanation

Type

Input

This is a default input port.

General

Output

The Token or DS designated in Output_Values parameter.

General




 

Created with the Personal Edition of HelpNDoc: Easily create EBooks