Open this model in VisualSim from the following location:
File->Open File
$VS/doc/Training_Material/Tutorial/WebHelp/Tutorial/Architecture_Exploration/Event_Based_Traffic_Generator/Event_TG_Model.xml
The construction steps of the model are described below:
Step 1
- Open a new Block Diagram by selecting File > New > Block Diagram.
- Instantiate the
Digital block from Model > Simulator > Digital. Double-click the
block and set the "StopTime" parameter as Sim_Time. The remaining
values should be unchanged. (Sim_Time is the name of Model Parameter.)
- To set up the model parameter in the model, click select Model > Parameter > Parameter=.
- Double-click
the Parameter=. Enter the parameter name Sim_Time and click OK.
Similarly, set the model parameters for the model as shown in figure 1.
Figure 1. Event Based Traffic Generator Step 1
Step 2
- Instantiate the Virtual Machine block from Script_Programming > Script > Virtual_Machine.
- To add the
Block Parameter, double-click the block and add the block parameters
such as Start_Time, Mean_Time, Data_Structure, Name_of_Event, Source,
Destination, and Size_of_Data_Transferred.
- To define the script, right-click the block and select Open Block.
Figure 2. Parameters for VM_Traffic
The VM Scripting for the event-based traffic generator is explained below.
Token can be generated
Token
=
newToken (Data_Structure)
Assign the model parameter to a variable
Mean_Time_ = Mean_Time
Name_of_Event_ = Name_of_Event
Hold the traffic source until it reaches Start Time
WAIT (Start_Time)
Token field values are set
Token.ID = 1
Token.TIME = TNow
Token.A_Task_Flag = true
Token.A_Source = Source
Token.A_Destination = Destination
Token.Event_Name = Name_of_Event_
Token.A_Bytes_Sent = Bus_Width_Bytes
Token.A_Instruction = newToken("{100:\"INT\"}")
Token.A_Command = "Write"
Token.A_Bytes = Size_of_Data_Transferred
Token.A_Bytes_Remaining = Token.A_Bytes - Bus_Width_Bytes
Send the token to an output port
SEND (output,Token)
Loop the process using while loop
while (true)
Queue all the tokens and triggered out after an user-defined mean time
TIMEQ (Name_of_Event_)
TIMEQ ("Traffic", Token, 0, Mean_Time_)
Token field values are set again after a Mean_Time
(Token.ID).incr()
Token.TIME = TNow
Token.A_Command = "Write"
Token.A_Bytes = Size_of_Data_Transferred
Token.A_Bytes_Remaining = Token.A_Bytes - Bus_Width_Bytes
Send the token to an output port
SEND (output,Token)
Figure 3. Event Based Traffic Generator Step 2
Step 3
- Instantiate an AXI Bus from Hardware_Modeling > Emerging_Bus_Standard > AMBA_AXI > AXI_Bus.
- Setup the
parameters such as Bus_Name, AXI_Speed_Mhz, AXI_Cycle_Time,
Device_Attached_to_Slave_by_Port and Slave_Throttle_Enable. The
remaining values should be unchanged. The output port of the Traffic
Block is connected to one of the AXI Bus input ports.
Figure 4. Event Based Traffic Generator Step 3
Figure 5. Parameters for AXI_Bus
Step 4
- Instantiate the DRAM block from Hardware_Modeling > Core_Architecture > DRAM.
- Set up the parameters for Memory_Name and Memory_Speed_Mhz.
The remaining values should be unchanged. First connect the DRAM output
port to one of the output port sof AXI Bus and then connect the AXI to
the DRAM input port.
Figure 6. Event Based Traffic Generator Step 4
Figure 7. Parameters for DRAM
Step 5
- Instantiate the Bridge from Hardware_Modeling > Bus_Switch_Ctrl > Bridge.
- Set up the parameter such as Bridge_Name and Bridge_Speed_in_Mhz. The remaining values should be unchanged.
Figure 8. Event Based Traffic Generator Step 5
Figure 9. Parameters for Bridge
Step 6
Instantiate the AXI Bus and DRAM and make a similar set up on block parameters.
- Instantiate the AXI Bus from Hardware_Modeling > Emerging_Bus_Standard > AMBA_AXI > AXI_Bus.
- Set
up the parameters such as Bus_Name, AXI_Speed_Mhz, AXI_Cycle_Time,
Device_Attached_to_Slave_by_Port, and Slave_Throttle_Enable. The
remaining values should be unchanged. The output port of the Traffic
Block is connected to one of the AXI Bus input ports.
- Instantiate the DRAM from Hardware_Modeling > Core_Architecture > DRAM.
Figure 8. Event Based Traffic Generator Step 6