Part 2- Memory, Parameters and Timed Resources

Parent Previous Next

VisualSim                                                                                                                              


Variables, Parameters and Timed Resources


Tutorial Goals

The following is a summary of the concepts and tasks you will learn in this session.

  1. Update DS fields using Expression List block.
  2. Provide input to the Timed_Resource block.
  3. Generate resource statistics
  4. Extract the statistics fields and provide multiple formats of the output - textual and graphical.


Target

The purpose of this session is


The block diagram of this system is shown in Figure 1.

Block??Diagram of the Lab Model

Figure 1 : Block Diagram of the system design

VisualSim Tutorial Model Location

Open this model in VisualSim from the following location:

File->Open File  $VS/doc/Training_Material/Tutorial/WebHelp/Tutorial/General_Applications/Gen_Lab2.xml

Genlab_2

Figure 2. Gen_Lab2 Model


    Model Objectives

  1. Create parameters and memories.
    1. Initialize the memory using the VariableList block.
    2. Instantiate parameters and customize its name and value.
  2. Store values in memory and perform operations based on parameters the values from memory.
    1. Use the ExpressionList block to modify memory values.
    2. Add ports to the 'ExpressionList' block to extract data from specific transaction fields.
  3. Add resources to perform processing
    1. Instantiate the 'Timed_Queue_N_Priority' block.
    2. Provide values and connect all input ports to the 'Timed_Queue_Priority' block.

   4. Obtain statistics from the resource blocks and view the output in either textual or graphical form.

Blocks Used

   

Sl No

Library Block

Description

1

Digital Simulator


Model > Simulator >Digital

This Simulator is used to model protocols, hardware, and mapping of behavior to architecture. This simulator is used when the model is being triggered as an event or based on time. The Digital Simulator implements the discrete-event Model of Computation (MoC). This Simulator maintains a notion of current time, and processes events chronologically in this time.


2

Traffic


Traffic > Traffic

Transaction_Source or Traffic outputs a new Data Structure (DS) at time intervals specified by the "Time_Distribution" setting. A Data Structure is a transaction containing a list of Field Names + Values.


3

Expression List


Behavior > Expression List

The Decision/Expression List 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.


4

TimedQueue_N_Priority


Full Library > Resource > Timed Queue > TimedQueue_N_Priority

This TimedQueue (First-Come, First-Server) block contains multiple sets of Queue + Server Resource.  The Queue to use for a data structure is identified by an integer number in the dimension_input port.  The Queue is ordered based on the priority of the data structure. 


5

Parameter


Model > Parameter > Parameter

Parameter is a variable containing a constant that can be any VisualSim data type, function and/or a RegEx expression.


6

Variable List


ModelSetup > Variable List

The block is used to define local/global variables that can be used in Expression, Decision/Expression List, Basic Processing (Statement etc.), Smart_Machine, and Virtual_Machine blocks.


7

Text Display


Result > Text_Display

Display the values arriving in the input port in a text display dialog. This block buffers the display data and updates the screen after the buffer is full.


8

TimeDataPlotter


Result > TimeDataPlotter

This block plots the incoming data on the Y-Axis against the current simulation time on the X-axis. Every wire connected to this block input is considered a separate dataset and plotted separately.



Building the Model

  1. Instantiate the 'VariableList' block and specify values for its parameters.
Hint: FirstMem local 1;
  1. Modify the 'Expression List' blocks to use the variables, 'transitional-if', adding new ports, block variable, and parameter.
Hint: DS Header fields
Hint: Use the same expression that was used for creating the boolean to control the flow.  
  1. After instantiating the 'ExpressionList' block, consider the following:
Hint: Temporary or local Variable
  1. After instantiating the 'TimedQueue_N_Priority' block, consider the following:
  2. After instantiating the 'ExpressionList' and the 'TimeDataPlotter' blocks, consider the following:
Hint: 'Total_Delay_Max'
Hint: Feed a trigger input to the stats_in port, set the time to trigger the stats and provide a value.
Hint: The value at the stats_in port must be 'Number of Resources'.

 


Running the Model



  1. What should be the input to the 'TimedQueue_N_Priority' block?
  2. How does one generate plots?

  Hint: First extract the data structure from an array index and then extract the field.

  1. Data Structure field usage?


Modeling Considerations


  1. How will the blocks of this tutorial be utilized in a real model?
  2. What will the role of the 'Timed_Queue' block be in a real system?

Congrats Congrats

You now understand how to associated flows with hardware/software resources in VisualSim!!!