Full Library / Resource / Channel and Pipeline / Channel
Block Name: Channel
Code File Location: VisualSim/actor/lib/Channel_Basic
Block Overview
o Used to model any system that requires additional processing before the resource can be released
o Extends the ability of the TimedQueue
o Consists of a single Queue and multiple channels
o Application examples include virtual channels, DMA, wireless, buses, and multiple execution step software tasks
o Can identify errors and lost packets and force retransmissions
Description
- The Channel block can be used to model a multi-channel network interface, DMA channel, wireless channel or a bus. The channel block contains a queue and multiple channels. The channels are released for the next Data Structure in the Channel_Release block. The block accepts data structures on the input port and places them in a single queue. When a channel becomes available, it places the first data structure in the queue on the output port and record the channel to be busy. This channel number is written into the channel_id_field of the Data Structure. The channel is blocked by this Data Structure until it is released by the Task_Complete block. If the Data Structure is sent to the accept_input port of the Channel_Complete, a successful transmission has been made and the next Data Structure is sent on this channel. If the Data Structure is sent to the reject_output port, then the original data structure is resent on the same channel. The channel block can have multiple channels that work in parallel.
-
- The speed of the channel, the number of channels and the size of the fragment transmitted on the channels are specified as parameters. The data structure on the accept_input port of the Channel_Complete is placed on the output for connection to other blocks. The latency through this channel is a combination of the Queue waiting time + the latency on the channel. The latency is computed multiplying packet data size and channel speed. The Data Structure is delayed by that many units of time in the channel block before being send on the output port. Additional latency can be added using blocks between the Channel and the Channel_Release.
-
The Channel block models multiple requests to a fixed number of channels ('Number_of_Channels'). Each channel has a specified bandwidth ('Channel_Rate_Mhz'). The Channel block takes an incoming Data Structure and puts it on one of the channels. It then places the assigned channel number (Integer) in the Data Structure Field 'Channel_Number'. The Channel_NUmber field is added to the incoming Data Structure. The Data Structure can then be sent through a series of processing blocks to emulate channel activity. Once the processing has completed, the Channel_Release block is called to remove the packet from the channel. If the Data Structure is sent to the 'accept_input' port, then the transmission has been successful and the Data Structure continues on it's way. It is possible to setup retranmission of the packet through the channel by terminating the Data Structure in the channel at 'reject_input' port of the 'Channel_Release' block. This calls back the Channel_Release block to initiate a re-transmission of the same packet.
- The size of the Data Structure is in the 'Packet_Size_Bytes' parameter which can be fixed value or extracted from an incoming Data Structure Field. The Channel_Release and the Channel_Basic blocks are linked using the 'Channel_Name'. A channel is busy between the time a Data Structure acquires a Channel and when it arrives on the accept_port of the Channel_Release. The channel block looks for an available channel (assuming there are multiple channels) and if unavailable, enqueues in the order of arrival. Max_Channel_Packets is the maximum number of packets that can enqueued, waiting for a channel. When this number is reached, the next Data Structure is rejected and placed on the reject_output port.
- The Channel_Name must be the same in both the Channel and the Channel_Release blocks. Channel_Rate_Mhz is the data rate of each channel. Max_Channel_Length is the maximum number of transaction that can be buffered in the input Queue of the Channel_Priority. When this number is reached, the next Data Structure is rejected and placed on the reject_output port.
Statistics
The statistics for the Channel are generated using the getBlockStatus RegEx function or using the Resource_Statistics_Generator block. The Channel length is received by using the getBlockStatus while the status (Active or Free) by simply looking at the array Channel_Name + "_" + Length. The array method is best used when the length is required during the simulation. getBlockStatus is best used at the end of the simulation for output of the statistics. The function and array lookup can be called in either the Virtual_Machine, Processing or Decision blocks.
Result_B = Channel_Length(2) where the array index starts at 1 for Channel number 1. This returns whether the Channel is busy or not.
Statistics_A = getBlockStatus(Channel_Name,"stats",Channel_Number) -> To get the statistics. This returns a single Data Structure for the Queue. The Channel_Number field is ignored.
Reset_Stats_A = getBlockStatus(Channel_Name,"stats",-(Channel_Number)) -> To reset the statistics. This resets the single Data Structure for the Channel. The Channel_Number field is ignored.
There is a pre-created "Generator" block and is used in the Resource_Statistics Example in the BDE.
Copy_A = getBlockStatus(Channel_Name,"copy",Channel_Number, position) -> To get the copy of the current Data Structure at any position of the Queue. This does not include the items that are currently in the Channels. In this case, it can take any item out of the Queue.
Length_A = getBlockStatus(Channel_Name,"length",Channel_Number) -> To get the length of the Queue. The Channel_Number is ignored.
Remove_A = getBlockStatus(Channel_Name,"take",Channel_Number, position) -> To remove a transaction in any position of the Queue. This does not include the items that are currently in the Channels. In this case, it can take any item out of the Queue.
isAvailable = getBlockStatus(Channel_Name,"array",Any Integer)- Returns an array of which Channels are free (true) or busy (false)
-
- Use Model: One might model a multi communication channel, or DMA channel to memory with this block. The Channel blocks can add the effect of delay, contention and limited resources to a processor or networking model through N channels (Number_of_Channels). The 'Channel_Release' Block can model re-tranmissions through it's two inputs: 'accept_input' for no re-transmission and 'reject_input' to calls back this block to retransmit a packet that is rejected due to noise (communication channel) or buffer overflow (memory).
- Data Structure of the Statistics Output
{BLOCK = "Channel_Stop_n_Wait_Test.Channel_Priority", DELTA = 0.0, DS_NAME = "Queue_Common_Stats", ID = 2, INDEX = 0, Number_Entered = 94, Number_Exited = 94, Number_Rejected = 0, Occupancy_Max = 1.0, Occupancy_Mean = 0.5, Occupancy_Min = 0.0, Occupancy_StDev = 0.5, Queue_Number = 1, TIME = 199.0000000081, Total_Delay_Max = 199.0000000081, Total_Delay_Mean = 99.3936170309085, Total_Delay_Min = 2.0000000081, Total_Delay_StDev = 58.5856743223995 Utilization = 0.0 }
|
- Discussion of the Statistics Output
- Number_Entered: Number entering channel block
Number_Exited: Number exiting channel block
- Number_Rejected: Number exiting channel block
Occupancy_Max: Maximum statistics of the buffer occupancy
Occupancy_Mean: Mean statistics of the buffer occupancy
- Occupancy_Min: Min statistics of the buffer occupancy
Occupancy_StDev: Standard Deviation statistics of the buffer occupancy
- Queue_Number: Not used
Total_Delay_Max: Maximum wait time through this channel
Total_Delay_Mean: Mean wait time through this channel
Total_Delay_Min: Minimum wait time through this channel
Total_Delay_StDev: Standard Deviation Maximum wait time through this channel
- Utilization: Not used
- See Also:
- Channel_N
- Channel_Priority
- Channel_Release
stats_input
public TypedIOPort stats_input
- Input port. if a '-1' is sent on this port, then all the statistics for the block are reset. if '1' is sent on this port, then the statistics for this block are placed on the stats_out port. The port type is integer.
stats_output
public TypedIOPort stats_output
- Output port. The Data Structure (format shown above) containing all the fields of the statistics is output on this port everytime the input port is triggered with the value '1'. The type is data structure. See top for details on the fields of this Data Structure.
Channel_Name
public Parameter Channel_Name
- Parameter, Channel_Name. This is a unique name in the whole model and is a required field. This name is used to match Channel_Release with the Channel. The type is string.
Channel_Rate_Mhz
public Parameter Channel_Rate_Mhz
- Parameter. This is the speed of each channel. All channels have the same speed. The Channel_Rate_Mhz and the 'Packet_Size_Bytes' are used to determine the delay through this block. The type is double.
Number_of_Channels
public Parameter Number_of_Channels
- Parameter. This is the number of simultaneous channels from this block. The incoming Data Structure is sent to the first channel that becomes available. The type is integer.
-
Channel_Width_Bytes
public Parameter Number_of_Channels
Parameter. This is the width of all channels in bytes. The type is integer.
Packet_Size_Bytes
public Parameter Packet_Size_Bytes
- Parameter. This is the size of the Data Structure that is transmitted on the channel. The Packet_Size_Bytes combines with the 'Channel_Rate_Mhz' to determine latency through a channel. The type is string if field name, or integer.
Max_Channel_Packets
public Parameter Max_Channel_Packets
- Parameter. This is the length of the queue where the data structures are buffered before a channel becomes available. If the queue is full, all new incoming data structures are placed on the reject output port. The type is integer.
Created with the Personal Edition of HelpNDoc: iPhone web sites made easy