Part-1 Traffic, Attributes, Decisions

Parent Previous Next

VisualSim                                                                                                                              


Traffic, Attributes, and Decisions

Tutorial Goals

This section is an introduction to using the VisualSim library. You can also construct models using standard operations. The following is a summary of the concepts and tasks you will learn in this session.

  1. Define statements using the Expression List block.
  2. Instantiate the data structure fields with randomly generated values.
  3. Make block decisions using the content of the data structure fields.

Target

The purpose of this session is to build a system model to generate traffic and to define the attributes of the transactions through the fields of the data structures. The block diagram of this system is shown in Figure 1.

Lab??1 Block Diagram

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_Lab1.xml



Lab??1 Block Diagram

Figure 2: Model


Model Objectives

  1. Construct a simple traffic generator, using the default 'Header' data structure.
  2. Dynamically add a new field to the transaction using the VisualSim ExpressionList block.
  3. Make If-Else decisions based on a specific field of a transaction.
  4. Debug models.


Blocks Used



Sl No

Library Block

Description

1

Digital Simulator

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

ExpressionList

The 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.


3

Text Display

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



Building the Model

   For instatiating a particular block  you can search for that block name on the search bar and drag and drop that block to the modelling window.

After instantiating the 'Traffic' block in the block diagram, consider the following questions:

  1. Where should the data structure name be entered?
  2. How can one generate a "Fixed" transaction every 1.0 seconds?
  3. How can one test that the transaction is being generated?
Hint: Display or Listen-to-Port

After instantiating the 'Decision or Expression List' block into the block diagram, consider the following questions.

  1. How should one connect the 'Traffic' and 'Behavior/Expression List' blocks?
  2. How does one enter a field name?
  3. How does one create a new field "Probability_Num" and generate field values from 1 to 100?
Hint: 'input.Probability_Num = irand(min, max)'. If the field does not exist, the Processing block will create it.
  1. How would you use the 'Behavior/Expression List' block to control the flow?
  2. How does one create a transitional if statement and use the result for routing the transaction.
        3.  If the transaction field Probability_Num has a value of 1 to 5, or 95 to 100, then this transaction should exit through the output port, or else it should exit through the out_of_range port.
Hint: 'Probability_Num <= X || Probability_Num >= Y' or refer to the block documentation
        4.  Notice that the decision can be assigned to a local memory variable in the block. This can be used as the output_condition. An alternate way is to put the condition directly in the output_condition field. Try to create the model using both modes.

Running the Model


Add 'Text_Display' blocks for observing transactions leaving the 'ExpressionList' block.

What happens if "Listen-to-Port" is used to monitor transactions leaving the 'Expression List' block instead of the 'Text_Display' block?

What is the "Listen-to-Block" capability and what output does it provide?

Can we use animation to test the model?

Hint: Use Debug->Animate Execution

Modeling Considerations

Congrats  Congrats

You now understand how to create flows and use the debugging features in VisualSim!!!