Full Library / Defining_Flow / Processing
Code File Location: VisualSim/Actor/lib/Expression_Processing
o Define attributes of the traffic or transaction.
o Construct a sequence of mathematical expressions or calculations.
o Compute latency or processing time.
The Processing blocks 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.
Each output port can receive any value. The value to be sent on each output is specified by the combination of the two parameter fields- Output_Ports and Output_Values. Both are a comma separated list. The number of items in both rows must be the same. The first port name in Output_Ports will receive the value in the first element of the Output_Values. Similarly, the second, third and so on. The output value can contain any expression containing a combination of the input port name, memory, RegEx expression or value. If a expression is used in the Output_Value, then it must be enclosed within (). After the sequence of expressions have been executed, the output_value is sent on the output port.
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 /* and end with */. No ";" is required at end of each line.
Refer Processor_or_Logic 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 */ |
Output_Ports |
Comma separated list of Output Port Names, including
default of 'output' and user added ports. |
String |
output,Priority |
Output_Values |
Comma separated list of output Port Values. |
String |
input, input.A_Priority |
Port
|
Explanation
|
Type |
input |
This is a default input port. |
General |
output |
The Token or DS designated in Output_Values parameter. |
General |