Code File Location: VisualSim/actor/lib/DS_Insert_K
This is a block that executes a mathematical expression on each of the four Field_Statement lines based on the Data Structure Expression language. 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. The updated Data Structure is sent on the output port. The expression entered in the fields use the Data Structure Expression Language. Parameters, fields or memories and operator for performing mathematical and memory operations can be used in this expression. The field statements are executed in sequence. This block is also used to create memories. For creating the memories, this block must be triggered before any of the blocks using this memory name is fired.
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.
int, 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 and 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 (DS Blocks or Memory BLocks) 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 (DS Blocks).
Refer Statement_if_else 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 '='. TheExpression 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 '='. TheExpression 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 |
Random_Seed | Random Number Seed. | String | 123457L |
Port | Explanation | Type |
Input | This input port is used to accept the incoming Data Structure. | String |
Output | This output port is used to sent the modified Data Structure out. | String |