Full library / Model / Utility /  Diagnostic
Block Name: Diagnostic

Code File Location: VisualSim\actor\arch\Diagnostic_Block

Block Overview

o       It generates statistic for resource blocks and hardware blocks in the library.

o       Analyzes variables present in the script block.

o       Identify error in the resource block.

o       List all the virtual connections.


Diagnostic Block

Description

Diagnostic blocks deals with F.I.R (Failure, Identify and Resolve) series where it  identifies the failure in the model as per given conditions from input file and generate the results in terms of utilization percentage, buffer capacity of the resource block, buffer occupancy at every instance, latency of each packet, maximum buffer usage by each block at every instance of time.
It also helps in analyzing the values stored in the variables present in the script block and the statistics generated by the hardware block, based on the variables entered in the input file.


File required for generating Statistics:

  • Input CSV file:  .csv statistic file (below image: Statistic_file parameter) for giving file name.
             Image not found in the local folder
    • Mandatory Columns :  Block, Metrics, Constraint, Constraint Value, Statistic Type
    • Optional Column : Reference Variable
             Image Not Found in local folder

Statistic evaluations supported in Diagnostic block.


Blocks
Statistics
Type
System Resource
Time_in_Block
Utilization
Buffer_Occupancy
All / Max / Min / Mean / Standard Deviation
System Resource Extend
Time_in_Block
Utilization
Buffer_Occupancy
All / Max / Min / Mean / Standard Deviation
Server
Time_in_Block
Utilization
Buffer_Occupancy
All / Max / Min / Mean / Standard Deviation
Queue
Time_in_Block
Utilization
Buffer_Occupancy
All / Max / Min / Mean / Standard Deviation
VariableList
Any variables defined in the Variable list
Ex:
1. id_count , type = local, value type = int
2. Res_Util,  type = global, value type = array
All / Max / Min / Mean / Standard Deviation
Script
Any variables defined in the script block
Ex:
1. local_Thrgpt, value type = double
2. priority_reorder, value type = array
All / Max / Min / Mean / Standard Deviation
ArchitectureSetup
Any statistics that are sent to the Architecture setup
Ex:
1. DRAM_Throughput_MBs_Max
2. Bus_1_Input_Buffer_Occupancy_in_Words_Max
3. Processor_2_PROC_Utilization_Pct_Max
All / Max / Min / Mean / Standard Deviation



Statistic evaluations supported in Diagnostic block.

  • Time_in_Block

  • Utilization

  • Buffer_Occupancy

  • Script Block Variables - Int, Double & Array Data Types

  • Mean, Maximum, Minimum & Standard Deviation values of all the aforementioned stats

  • Max, min, mean and standard deviation of the hardware stats that are sent to architecture setup.

 

Constraint supported in Diagnostic block-

  • < 
  • > 
  • >=
  • <=
  • =
  • !=


Columns Description -

    Number  

    Heading  

    Description  

Example

1
BLOCK
(Should be in Upper case)
The "BLOCK" parameter value of the module which we want to monitor. Every components we use in a demo model will be having a unique name. We need to provide it here.

Block_Name_Example.PNG

Resource Blocks

Block_Name_Example_2.PNG

Script Blocks

2
METRICS
(Should be in Upper case)
For standard resource blocks (like Queue block, Server block, System resource block, system resource extend block), following list of stats are only supported:
           1. Time_in_Block
           2. Utilization
           3. Buffer_Occupancy

For Script blocks, we can use any variable defined within the script under this column


Stats_Name_Script_Variable_Example.PNG

Variables - idx, arr1, arr2, index

Stats_Name_Script_Array_Example.PNG

Variables - prioArr, id_arr, id, index, prio

Script Blocks
3
CONSTRAINT
(Should be in Upper case)
Following types are supported:
     1.  >
     2.  <
     3.  >=
     4.  <=
     5.  !=
     6.  =

Constraint_Snap.PNG
4
CONSTRAINT VALUE
(Should be in Upper case)
Specifies the threshold value to which the comparison is being made by diagnostic block.

Supported values:
    1. Integer
    2. Double
    3. A structure (for array alone)


The structure should be of the following format:
{id1=value;id2=value;id3.......;default=value}
 default value must be specified if user is choosing this format. This is because, if an id which is not specified in the value structure comes in, then the default value will be used as the threshold value.

id1, id2 etc. used in the above structure can either correspond to an index value in the array (starting from 0 to n-1, where n is the length of the array) or to the corresponding value in the correlated array mentioned in the optional 'REFERENCE VARIABLE' column for the array. 

Values_Array_Snap.PNG


All Stats_Name have 'Value' in Integer/Double except arr (for Mean 'Type')

arr has the value in the structured form. Here '0' and '2' signifies the indexes of the array.
While '10' and '20' signifies the threshold values for indexes 0 and 2, and the other indexes
have the threshold value as the value mentioned against default value.


For Correlate structured value :

Values_Array_Snap.PNG

Input File

Values_Array_Snap.PNG

Output File

So from the above Output file, we can see the value '6.0' correlated to '0x13' present in id_arr variable. According to this we create the Structure value in the Input file with the threshold values.

5
STATISTIC TYPE
(Should be in Upper case)
Specifies the type of calculation we have to do.
Supported values:

    1. Max
    2. Min
    3. Mean
    4. All
    5. Standard Deviation

"All" simply means that we will be monitoring instantaneous value of a variable or a stat (Latency/Buffer Occupancy/ Utilization).


Type_Column_Snap.PNG

Results generated :

different_files.PNG


1. Results -> Resource with Type set to be "All"

Result_1.PNG



2. Results -> Resource with Type set to be "Max", "Min", "Mean" or "Standard Deviation"

Result_2.PNG


3. Results -> Script variables (no array variable) with Type set to be "Max", "Min",  "Mean", "Standard Deviation" or "All"

Result_3.PNG


4. Results -> Script variables (including array variables) with Type set to be "Max", "Min",  "Mean", "Standard Deviation" or "All"

Result_4.PNG
6
REFERENCE VARIABLE
(Should be in Upper case)
Used only for an array variable monitoring.
Example: Latency array variable only stores the latency value, but to correlate it with id array we need to specify the id array.

For an array, if we don't specify the Reference variable, then the array index will be used for correlation.

Correlate_Snap.PNG

Input File

Tracker_Column_Snap.PNG

Output File

Matched Constraint
column will list out the values which pass the threshold condition (only for array).

Format:

{<array index (if reference variable column is empty) or reference array corresponding value>_<variable value which we are monitoring> || <>_<> || .......}


Examples for Resource Block -

Stats_Name

Type

Input File

Description

Output File

     

    Demo     

Time_in_Block
All csv demo Outputs the details of all the data packets which have
Time_in_Block > 2

csv demo

Model

Input File

Output File
Time_in_Block Max/Min/Mean
/Standard Deviation




Outputs a single value  - MeanMax/Min/Standard Deviation, for the Time_in_Block of all the data
packets and gives a Result - TRUE, if the value satisfies the
given constraint ,else FALSE
Model

Input File

Output File
Utilization All csv demo Outputs the details of all the data packets which have
Utilization >= 0

csv demo

Model

Input File

Output File
Utilization Max/Min/Mean
/Standard Deviation




Outputs a single value  - Mean/Max/Min/Standard Deviation, for the Utilizations of all the data packets and gives a Result - TRUE, if the value satisfies the given constraint ,else FALSE Model

Input File

Output File
Buffer_Occupancy All csv demo Outputs the details of all the data packets which have
Buffer_Occupancy >= 3.05

In this case the Buffer_Occupancy is an array. So we check if any
element of the array has a value >= 3.05. If it does, we print the
details of that packet.

csv demo

Model

Input File

Output File
Buffer_Occupancy Max/Min/Mean
/Standard Deviation


Outputs a single value  - Mean/Max/Min/Standard Deviation, for the Buffer_Occupancies of all the data packets and gives a Result - TRUE, if the value satisfies the given constraint, else FALSE Model

Input File

Output File
Combined
( Time_in_Block, Buffer_Occupancy, Utilization )
All
combined demo

Outputs the details of all the data packets which have satisfy
anyone of the given constraints

combined demo

Model

Input File

Output File
Combined
( Time_in_Block, Buffer_Occupancy, Utilization )
Max/Min/Mean
/Standard Deviation



Outputs a single value for each Stats_Name, for all the data packets
and gives Result - TRUE, if the value satisfies the
given constraint else, FALSE



Model

Input File

Output File


Examples for Script Block -

Metrics

Type


(Data Type)

Statistics

Type


Reference

Variable

(Optional Column)

Input File

Description

Output File

Script Block

 Demo 

Int / Double All Absent
Outputs all the values stored by each VARIABLE (idx and index, in this case) that passes the given constraint,  for the entire simulation.

So here we get all the values of idx which are >=0 and all the values of index which are >=0





S2_Test_Case

Model

 Input File
 
Output File
Array
All Absent


Outputs all the values stored by each METRICS (prioArr, in this case) if any one of the value present in the array passes the given constraint, for the entire simulation.

So here we get all the values of prioArr in which
any one element of the array is >= 5.

We get all the values(of the array) which passes the constraint in the MATCHED CONSTRAINT column with its index or correlated value as explained in the Columns Description Table above.



Pack_1_lat_09

Model

Input File
  
Output File
Combined
( Int, Double & Array )
Max/Min/Mean
/Standard Deviation
Absent

Outputs a single value  - Mean/Max/Min/Standard Deviation, for the each METRICS for the entire simulation and gives
 Result - TRUE if the value satisfies the given constraint, else FALSE 



Array File



Non-Array File






S1_Test_Case



S2_Test_Case



S1_Test_Case_3

Model

Input File
  
Output Array File

Output Non-Array File
Combined
( Int, Double & Array )
All Present


Outputs all the values stored by each METRICS for the entire simulation based on the respective method for Int/Double/Array data types, as explained above.

Here we have an additional
REFERENCE VARIABLE column for Arrays. It gives the value stored
by the corresponding Correlate array at the same time.

So when prioArr stored {6.0}, id_arr stored {0x13} etc.



Array File




Non-Array File




Pack_1_lat_09



Buff_1_ch_2


Model

Input File
  
Output Array File

Output Non-Array File
Combined
( Int, Double & Array )
Max/Min/Mean
/Standard Deviation
Present Outputs a single value  - Mean/Max/Min/Standard Deviation, for each METRICS for the entire simulation, along with the REFERENCE VARIABLE column and gives, Result - TRUE if the value satisfies the given constraint, else FALSE 



Array File



Non-Array File




Pack_1_lat_09



Buff_1_ch_2


Model

Input File
  
Output Array File

Output Non-Array File
Array Max/Min/Mean
/Standard Deviation
Present

Outputs a single value  - Mean/Max/Min/Standard Deviation, for each Metrics for the entire simulation, along with the Reference Variable column and gives, Result - TRUE if the value satisfies the given constraint else FALSE

For the Arrays, you can enter the value in the structured form as explained in the Column Description Table.




Pack_1_lat_09



Buff_1_ch_2

Model

Input File  

Output File

Examples for VariableList Block -

The Variable list blocks can be used with diagnostic block by adding the requirements for the variables defined in the variable list. It is similar to the script block variable types. Please check the following links for more details.
    Model
    Input file
    Output file1  Output file2

Examples for Hardware Block -
   
The hardware blocks can be used with diagnostic block by adding the requirements based on the statistics provided by each. The statistics of the blocks observed through the architecture setup are eligible to use with the diagnostics feature.

The Block column contains the block name of the device. The Metrics column contains the statistic name that can be observed through the architecture setup port. For example Hit ratio of Cache_D1 will be displayed as “Cache_D1_Cache_A_Hit_Ratio”, user must enter the stats name without the block name, such as “Cache_A_Hit_Ratio”.

The Constraint column determines the condition that user want to evaluate. The constraint value is the threshold value which is compared with the values obtained based on the stats type.

The Stats type define the type of comparison, for example Max defines the comparison will be made with constraint value and the maximum value of the stats that is obtained.

User can use any block variable of hardware devices such as the block variable in the script block. Check section 7.5 above for more details.
 
Input file:
             

Once the simulation is over user can get the result folders according to the blocks used in the design. The detailed description about the folders and files are given in the next section (Output File).

The results folder will contain the detail for the constraints listed in the requirement file as shown below.   
                

    Please click the following links for more details
   
    Model
    Input File
    Ouptu File

NOTE:

    a. The contents of the CSV file specified are CASE SENSITIVE except the STATISTIC TYPE column.

    b. The columns should be entered in the same order as shown above, in the Input.csv file.

    c. The "STATISTIC TYPE" should be the 5th column in the input file with any one of the following values :

          i)   All - Outputs all the values for the Stats_name which pass the given constraint.

          ii)  Mean - Outputs a single Average value for all the values stored in Stats_name.

          iii) Min - Outputs a single Minimum value for all the values stored in Stats_name.

          iv) Max - Outputs a single Maximum value for all the values stored in Stats_name.

          v)  Standard Deviation - Outputs a single Standard Deviation value for all the values stored in Stats_name.

    d. "REFERENCE VARIABLE" is an optional column, should be added after the "STATISTIC TYPE" column.

    e. The format shown in the last example for Script Block for comparing array values for the index/correlated value comparison needs to be followed strictly. Any deviation from the given format will lead to errors.


 Output files:

Two output files are generated by this block-

  • Recommendation file -
  • Result file -
  • Virtual Connection


1)  Recommendation file will contain the warning conditions like –

  •  If the packet doesn’t enter in the Queue block or if the packet doesn’t exit from the block. It captures any anomaly if present, inside the block.
  •  If any of the block name specified in the CSV file doesn’t match the Block_Name parameter of particular resource block then no constraint evaluation will be performed for that block. 
  • BufferUsage txt file shows the maximum buffer usage by the block.
  • A file named 'Diagnostic_ScriptAnalysis.txt' will be created and the analysis that have been performed on the script block will be recorded.
  • Analysis such as,
    • Scope of the variable
    • Line Count
    • Time consumed by each statement
    • Trace Array for Control Statements
    • Number of 'if' statements executed
    • Number of 'for' statements executed
    • Number of 'while' statements executed
    • Total Number of lines executed
    • Total Number of lines not executed
    • Total Number of variables used
  • All these analysis can be performed for multiple scripts and it will be recorded in the same text file.
  • Diagnostic_ScriptAnalysis file  file-           -       Diagnostic_Stats_Resource_All_<Model Name> - Contais statistics for the Resource Blocks with ‘All’ in the “Type” column.diag_file
  • Diagnostic_ScriptAnalysis file  file-           -       diag_file2

 

2) Result files :


    i)      Diagnostic_Stats_Resource_All_<Model Name>   -   Contains statistics for the Resource blocks with 'All' in the "STATISTIC TYPE" column
   
ii)     Diagnostic_Stats_Resource_Type_<Model Name>   -   Contains statistics for the Resource blocks with 'Max/Min/Mean/Standard Deviation' in the "STATISTICS TYPE" column
   
iii)    Diagnostic_Stats_Script_Array_<Model Name>   -   Contains statistics for the Script block variables of 'Array' data type
   
iv)    Diagnostic_Stats_Script_Non-Array_<Model Name>   -   Contains statistics for the Script block variables of 'Int/Double' data types


Supported VisualSim blocks for Diagnostic are-

  • Queue
  • Server
  • SystemResource
  • SystemResource_Extend


Virtual Connection in Diagnostic Block:


How to use?

  • Drag and Drop Diagnostic block from Library/Instantiate class.         
  • Save the model to generate Output file.
  •  Run the model.
  • Output file demo:                       
  • The .txt file will contain the list of block sending data from Source to Destination

 

  Supported block 

  • IN
  • OUT
  • MUX
  • DEMUX
  • Script
  • Expression List


Refer Diagnostic example1 , Diagnostic example2 , Diagnostic Script Test Demo Model.


Parameter

Explanation

 Type 

Example

Statistic_File This is the path to the input file..
File Parameter
My_Path + “/Latency.csv”  or none
writeStatsToFile "true" to view the generated output on the .txt/.csv file and "false" if no  data required. Boolean True or False
activate Activate/Deactivate the block
Boolean True or False