Processor Generator / TaskGenerator
Block Name: TaskGenerator
Code File Location: VisualSim\actor\arch\SoftGen
o It generates instruction sequence to represent one or multiple tasks. This is used to emulate the operation of a software task on the processor.
o This block can be used in the model and can dynamically generate the sequences.
TaskGenerator is located in Processor Generator. Examples of usage are located in Pre-Built Models->Using Hardware Architecture Blocks.
The TaskGenerator block is used to generate tasks containing a profile- based sequence of instructions to execute on the processor. The mix of instructions in the task is read from the file that is referenced by the parameter Read_My_Instruction_Mix_Table.
The instructions are placed in the A_Instruction field of the Processor_DS template Data Structure and sent on the output port.
The generated instruction assumes that each instruction takes exactly one cycle to execute for the purpose of generating the tasks. The actual execution will depend on the Instruction_Mix_Table.
The Read_My_Instruction_Mix_Table file has two parts. The first Part defines a type, abbreviation used in the lower part and a list of instruction mnemonics for each type. There is a line delimiter ';' at the end of every line. Each section must start with a comment. The first part must have a comment that ends wit- /* Mnemonic List */ and the second part must end with- /* Task_Name */. An example of this file is shown below.
/* My Instruction Mix Table -- First Part defines instruction mnemonics for each type, line delimiter ';' |
To view a more extensive file, go to VS_AR\doc\Training_Material\Architecture\Software_Generation directory and select- Instruction_Mix_Table.txt.
The second Part of the file defines individual tasks, and the mix within each task. Each line starts with the task name and is followed by the number of instructions. This generator assumes that each task has an execution time of 1 cycle. This will be followed by the Type Name and Percentage for each of the types in Part One. Each task line must end with the line delimiter ';' The number of types must match the number of items in Part One. The total percentages of all types cannot exceed 100%.
There are three modes of operation. This determines which tasks are generated.
The three options are- Field, Random and Loop.
Field: The task name can be looked up in the A_Task_Name field of the incoming Data Structure (Field). This will be appended to the A_Instruction field of the incoming data structure and sends on the output port.
Random: This picks one of the tasks based on a random number. It also creates a new data structure and sends on the output port.
Loop: This generates the tasks in the order listed in the instruction_mix_table. In the option 2 and 3, the TIME and ID field are updated.
Refer Using TaskGenerator to generate profile-based synthetic instructions for the Processor Demo Model.
Parameter |
Explanation |
Type |
Example |
Block_Name |
Unique name for this block. This must be different from all Global memories, SystemResource, Scripts, Queues and Hardware blocks. |
String |
“ARM9_Instructions_Generator” |
My_Path |
This is the path to the input file. |
String |
“C:/VisualSim/VS_AR” |
Read_My_Instruction_Mix_Table |
Input file name containing the instruction mix and the task information. |
Concatenation of Strings |
My_Path + “/Files1.txt” |
Mode_of_Operation |
Field gets task name from A_Task_Name of input Data Structure, Random selects a random Task from the list and Loop is sequential ordering of the task as listed in the mix table. |
String |
“Loop”, “Field” or “Random” |
DEBUG |
"true" to view the generated sequence on the Command Window and "false" if no DEBUG data required. |
Boolean |
True or False |
Sim_Time |
Link this to the Simulation Time of the model. |
Double |
parameters (SimTime) or value 2.0e-6 |
Parameter |
Explanation |
port |
This input port receives a data structure that triggers the block to generate a sequence of instructions in an array. |
port2 |
This output port takes the incoming data structure, adds the instruction array into a field called A_Instruction and send it out on this port. |
Debug |
The status and debug information are output on this port. |
Created with the Personal Edition of HelpNDoc: News and information about help authoring tools and software