Full Library / Defining_Flow / Basic Processing / Statement_Select
Block Name: Statement_Select
Code File Location: VisualSim/actor/lib/DS_Switch_K
This block combines two blocks- Statement and the Select. The Four Field_Statements execute mathematical expression based on the Data Structure Expression language. The field or memory matching the 'Switch_Field_Name' address is sent on the "switch_output" port. This block evaluates the expressions in the RHS (Right-Hand Side) and places the result on the LHS (Left-Hand Side). for each Field_description line. After the four Field_Description lines are resolved, the updated Data Structure is placed on the output port. This block also has the added ability to output a selected field or memory on the switch_output port. The value on the switch_output port is the content of the field or memory specified in the 'Switch_Field_Name' parameter. The switching is done after all the four fields execute and the Data Structure is passed on the output port. The switched value can be a full value of a field or it can be part of a value. The switching can also be used to extract individual bits from a binary word. The format for the entry in the parameter is (0, n) which corresponds to the bit positions starting from 0.
For example, one could extract the second byte with "fld (8, 15)" of a four byte word in bit format. This capability is available for 'fld' with types-integer, binary, or binary string.
Expression Language Syntax: X Op Y, or X = Y Op Z
Where X can be a Memory or Field, OP is the Operator (See below), Y can be Memory, Field, Time, Parameter or Value and Z can be Memory, Parameter, Field, Time or Value.
Integer, long, double, string, binary, boolean and data structure.
For the format of X Op Y, Operators are: =, +=, -=, *=, /=, 1/=, %=, !, ^, sqrt, ~, &, |, xor
For the format of Y Op Z, Operators are: +, -, *, /, 1/, %, &, |, xor
Additional operators include binary functions for Y Op Z: & (AND), | (OR), ~ (NOT), ! and 'xor' (Exclusive OR).
Additional operators include binary functions for Y Op Z: '&=', '|=', '~=', 'xor='
Other operators are for Y Op Z: <<', '<<=', '>>', '>>='
Random: irand(lower, upper), rand(lower, upper), exp(mean), norm(mean, stdev)
This block can also be used to define a memory as: MyMemL local 0, MyMemG global 1.0
DSNow, TNow, TLast, TDelta, TReal, TRealLast, TRealDelta
Binary and shift operators can be applied only on int, binary and binary strings.
The Use Model for the Data Structure Blocks is to modify user-defined data structures or memories to implement an architectural abstraction, or cycle accurate model. Data Structure Blocks provide for communication between model flows via memory elements (Traffic or VariableList) and with composite Data Structures to quickly and efficiently implement a modeling abstraction. One can think of Data Structure Blocks as operating on Data Structures, similar to individual EXCEL spreadsheets with flow oriented operators
Refer Statement_Select_Delay Demo Model.
Parameter |
Explanation |
Type |
Example |
Field_Description_1 |
The field description 1 (op_x, assign, op_y, op, op_z) is a string that utilizes the DS Expression language. op_x represents the result of the asssignment (assign) operator, typically '='. The expression formats, operators, types and Time values listed in the summary section can be used here. The assignment operator can also be '+=', '-=', '*=', '/=', etc. similar to C/C++. The assign can also be 'local' or 'global' for declaring memories. op_x can be a memory (local, global), composite data structure field, or combination 'memory:field'. op_x cannot be a constant or numerical value, like C/C++. op_y, op_z can be a memory, composite data structure field, 'memory.field', constant, or numerical value. |
String |
Name_X Assign Name_Y OP Name_Z |
Field_Description_2 |
The field description 2 (op_x, assign, op_y, op, op_z) is a string that utilizes the DS Expression language. op_x represents the result of the asssignment (assign) operator, typically '='. The expression formats, operators, types and Time values listed in the summary section can be used here. The assignment operator can also be '+=', '-=', '*=', '/=', etc. similar to C/C++. The assign can also be 'local' or 'global' for declaring memories. op_x can be a memory (local, global), composite data structure field, or combination 'memory:field'. op_x cannot be a constant or numerical value, like C/C++. op_y, op_z can be a memory, composite data structure field, 'memory.field', constant, or numerical value. |
String |
Name_X Assign Name_Y OP Name_Z |
Field_Description_3 |
The field description 3 (op_x, assign, op_y, op, op_z) is a string that utilizes the DS Expression language. op_x represents the result of the asssignment (assign) operator, typically '='. The expression formats, operators, types and Time values listed in the summary section can be used here. The assignment operator can also be '+=', '-=', '*=', '/=', etc. similar to C/C++. The assign can also be 'local' or 'global' for declaring memories. op_x can be a memory (local, global), composite data structure field, or combination 'memory:field'. op_x cannot be a constant or numerical value, like C/C++. op_y, op_z can be a memory, composite data structure field, 'memory.field', constant, or numerical value. |
String |
Name_X Assign Name_Y OP Name_Z |
Field_Description_4 |
The field description 4 (op_x, assign, op_y, op, op_z) is a string that utilizes the DS Expression language. op_x represents the result of the asssignment (assign) operator, typically '='. The expression formats, operators, types and Time values listed in the summary section can be used here. The assignment operator can also be '+=', '-=', '*=', '/=', etc. similar to C/C++. The assign can also be 'local' or 'global' for declaring memories. op_x can be a memory (local, global), composite data structure field, or combination 'memory:field'. op_x cannot be a constant or numerical value, like C/C++. op_y, op_z can be a memory, composite data structure field, 'memory.field', constant, or numerical value. |
String |
Name_X Assign Name_Y OP Name_Z |
Switch_Field_Name |
The field or memory name containign the content that needs to be sent on the switch_output port is provided here. For fields or memory, the format is "MyField" or "MyMem". To extract specific range of bits from a integer, binary or binary string, the Field Select format is "MyField (0, n)", where n is an integer and is the last bit location. MyField must be either integer, binary string, or binary format. |
String |
Switch_Field_Memory_Name |
Random_Seed |
Random Number Seed. |
String |
123457L |
Port |
Explanation |
Type |
Input |
This is a default input port. |
General |
Output |
The Token or DS designated in Output_Results parameter, plus Output_Conditionals (true, false, or all) to send to the output port. |
General |
Switch_output |
Output the value in the memory or field name identified by the block parameter- Switch_Field_Name. |
General |
Created with the Personal Edition of HelpNDoc: Write EPub books for the iPad