⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tan_noc_worm_node_source.pr.c

📁 片上网络
💻 C
📖 第 1 页 / 共 2 页
字号:
				/* schedule it at current time with the appropriate code value.		*/
				if (start_time == SSC_INFINITE_TIME)
					{
					op_intrpt_schedule_self (op_sim_time (), SSC_STOP);
					}
				else
					{
					op_intrpt_schedule_self (start_time, SSC_START);
				
					/* In this case, also schedule the interrupt when we will stop	*/
					/* generating packets, unless we are configured to run until	*/
					/* the end of the simulation.									*/
					if (stop_time != SSC_INFINITE_TIME)
						{
						op_intrpt_schedule_self (stop_time, SSC_STOP);
						}
					
					next_intarr_time = oms_dist_outcome (interarrival_dist_ptr);
				
					/* Make sure that interarrival time is not negative. In that case it */
					/* will be set to 0.												 */
					if (next_intarr_time <0)
						{
						next_intarr_time = 0.0;
						}
				
					}
				
				/* Register the statistics that will be maintained by this model.	*/
				bits_sent_hndl     	= op_stat_reg ("Generator.Traffic Sent (bits/sec)",			OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
				packets_sent_hndl   = op_stat_reg ("Generator.Traffic Sent (packets/sec)",		OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
				packet_size_hndl    = op_stat_reg ("Generator.Packet Size (bits)",              OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
				interarrivals_hndl  = op_stat_reg ("Generator.Packet Interarrival Time (secs)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
				
				}
				FSM_PROFILE_SECTION_OUT (state0_enter_exec)

			/** blocking after enter executives of unforced state. **/
			FSM_EXIT (1,"tan_noc_worm_node_source")


			/** state (init) exit executives **/
			FSM_STATE_EXIT_UNFORCED (0, "init", "tan_noc_worm_node_source [init exit execs]")
				FSM_PROFILE_SECTION_IN ("tan_noc_worm_node_source [init exit execs]", state0_exit_exec)
				{
				/* Determine the code of the interrupt, which is used in evaluating	*/
				/* state transition conditions.										*/
				intrpt_code = op_intrpt_code ();
				}
				FSM_PROFILE_SECTION_OUT (state0_exit_exec)


			/** state (init) transition processing **/
			FSM_PROFILE_SECTION_IN ("tan_noc_worm_node_source [init trans conditions]", state0_trans_conds)
			FSM_INIT_COND (START)
			FSM_TEST_COND (DISABLED)
			FSM_TEST_LOGIC ("init")
			FSM_PROFILE_SECTION_OUT (state0_trans_conds)

			FSM_TRANSIT_SWITCH
				{
				FSM_CASE_TRANSIT (0, 1, state1_enter_exec, ss_packet_generate();, "START", "ss_packet_generate()", "init", "generate")
				FSM_CASE_TRANSIT (1, 2, state2_enter_exec, ;, "DISABLED", "", "init", "stop")
				}
				/*---------------------------------------------------------*/



			/** state (generate) enter executives **/
			FSM_STATE_ENTER_UNFORCED (1, "generate", state1_enter_exec, "tan_noc_worm_node_source [generate enter execs]")
				FSM_PROFILE_SECTION_IN ("tan_noc_worm_node_source [generate enter execs]", state1_enter_exec)
				{
				/* At the enter execs of the "generate" state we schedule the		*/
				/* arrival of the next packet.										*/
				next_intarr_time = oms_dist_outcome (interarrival_dist_ptr);
				
				/* Make sure that interarrival time is not negative. In that case it */
				/* will be set to 0.												 */
				if (next_intarr_time <0)
					{
					next_intarr_time = 0;
					}
				
				next_pk_evh      = op_intrpt_schedule_self (op_sim_time () + next_intarr_time, SSC_GENERATE);
				
				}
				FSM_PROFILE_SECTION_OUT (state1_enter_exec)

			/** blocking after enter executives of unforced state. **/
			FSM_EXIT (3,"tan_noc_worm_node_source")


			/** state (generate) exit executives **/
			FSM_STATE_EXIT_UNFORCED (1, "generate", "tan_noc_worm_node_source [generate exit execs]")
				FSM_PROFILE_SECTION_IN ("tan_noc_worm_node_source [generate exit execs]", state1_exit_exec)
				{
				/* Determine the code of the interrupt, which is used in evaluating	*/
				/* state transition conditions.										*/
				intrpt_code = op_intrpt_code ();
				
				}
				FSM_PROFILE_SECTION_OUT (state1_exit_exec)


			/** state (generate) transition processing **/
			FSM_PROFILE_SECTION_IN ("tan_noc_worm_node_source [generate trans conditions]", state1_trans_conds)
			FSM_INIT_COND (STOP)
			FSM_TEST_COND (PACKET_GENERATE)
			FSM_TEST_LOGIC ("generate")
			FSM_PROFILE_SECTION_OUT (state1_trans_conds)

			FSM_TRANSIT_SWITCH
				{
				FSM_CASE_TRANSIT (0, 2, state2_enter_exec, ;, "STOP", "", "generate", "stop")
				FSM_CASE_TRANSIT (1, 1, state1_enter_exec, ss_packet_generate();, "PACKET_GENERATE", "ss_packet_generate()", "generate", "generate")
				}
				/*---------------------------------------------------------*/



			/** state (stop) enter executives **/
			FSM_STATE_ENTER_UNFORCED (2, "stop", state2_enter_exec, "tan_noc_worm_node_source [stop enter execs]")
				FSM_PROFILE_SECTION_IN ("tan_noc_worm_node_source [stop enter execs]", state2_enter_exec)
				{
				/* When we enter into the "stop" state, it is the time for us to	*/
				/* stop generating traffic. We simply cancel the generation of the	*/
				/* next packet and go into a silent mode by not scheduling anything	*/
				/* else.															*/
				if (op_ev_valid (next_pk_evh) == OPC_TRUE)
					{
					op_ev_cancel (next_pk_evh);
					}
				
				}
				FSM_PROFILE_SECTION_OUT (state2_enter_exec)

			/** blocking after enter executives of unforced state. **/
			FSM_EXIT (5,"tan_noc_worm_node_source")


			/** state (stop) exit executives **/
			FSM_STATE_EXIT_UNFORCED (2, "stop", "tan_noc_worm_node_source [stop exit execs]")


			/** state (stop) transition processing **/
			FSM_TRANSIT_MISSING ("stop")
				/*---------------------------------------------------------*/



			}


		FSM_EXIT (0,"tan_noc_worm_node_source")
		}
	}




void
tan_noc_worm_node_source_diag (OP_SIM_CONTEXT_ARG_OPT)
	{
	/* No Diagnostic Block */
	}




void
tan_noc_worm_node_source_terminate (OP_SIM_CONTEXT_ARG_OPT)
	{

#if !defined (VOSD_NO_FIN)
	int _op_block_origin = __LINE__;
#endif

	FIN_MT (tan_noc_worm_node_source_terminate ())


	/* No Termination Block */

	Vos_Poolmem_Dealloc_MT (OP_SIM_CONTEXT_THREAD_INDEX_COMMA pr_state_ptr);

	FOUT
	}


/* Undefine shortcuts to state variables to avoid */
/* syntax error in direct access to fields of */
/* local variable prs_ptr in tan_noc_worm_node_source_svar function. */
#undef own_id
#undef format_str_header
#undef start_time
#undef stop_time
#undef interarrival_dist_ptr
#undef pksize_dist_ptr
#undef generate_unformatted
#undef next_pk_evh
#undef next_intarr_time
#undef bits_sent_hndl
#undef packets_sent_hndl
#undef packet_size_hndl
#undef interarrivals_hndl
#undef format_str_data
#undef flit_num

#undef FIN_PREAMBLE_DEC
#undef FIN_PREAMBLE_CODE

#define FIN_PREAMBLE_DEC
#define FIN_PREAMBLE_CODE

VosT_Obtype
tan_noc_worm_node_source_init (int * init_block_ptr)
	{

#if !defined (VOSD_NO_FIN)
	int _op_block_origin = 0;
#endif
	VosT_Obtype obtype = OPC_NIL;
	FIN_MT (tan_noc_worm_node_source_init (init_block_ptr))

	obtype = Vos_Define_Object_Prstate ("proc state vars (tan_noc_worm_node_source)",
		sizeof (tan_noc_worm_node_source_state));
	*init_block_ptr = 0;

	FRET (obtype)
	}

VosT_Address
tan_noc_worm_node_source_alloc (VOS_THREAD_INDEX_ARG_COMMA VosT_Obtype obtype, int init_block)
	{

#if !defined (VOSD_NO_FIN)
	int _op_block_origin = 0;
#endif
	tan_noc_worm_node_source_state * ptr;
	FIN_MT (tan_noc_worm_node_source_alloc (obtype))

	ptr = (tan_noc_worm_node_source_state *)Vos_Alloc_Object_MT (VOS_THREAD_INDEX_COMMA obtype);
	if (ptr != OPC_NIL)
		ptr->_op_current_block = init_block;
	FRET ((VosT_Address)ptr)
	}



void
tan_noc_worm_node_source_svar (void * gen_ptr, const char * var_name, void ** var_p_ptr)
	{
	tan_noc_worm_node_source_state		*prs_ptr;

	FIN_MT (tan_noc_worm_node_source_svar (gen_ptr, var_name, var_p_ptr))

	if (var_name == OPC_NIL)
		{
		*var_p_ptr = (void *)OPC_NIL;
		FOUT
		}
	prs_ptr = (tan_noc_worm_node_source_state *)gen_ptr;

	if (strcmp ("own_id" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->own_id);
		FOUT
		}
	if (strcmp ("format_str_header" , var_name) == 0)
		{
		*var_p_ptr = (void *) (prs_ptr->format_str_header);
		FOUT
		}
	if (strcmp ("start_time" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->start_time);
		FOUT
		}
	if (strcmp ("stop_time" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->stop_time);
		FOUT
		}
	if (strcmp ("interarrival_dist_ptr" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->interarrival_dist_ptr);
		FOUT
		}
	if (strcmp ("pksize_dist_ptr" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->pksize_dist_ptr);
		FOUT
		}
	if (strcmp ("generate_unformatted" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->generate_unformatted);
		FOUT
		}
	if (strcmp ("next_pk_evh" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->next_pk_evh);
		FOUT
		}
	if (strcmp ("next_intarr_time" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->next_intarr_time);
		FOUT
		}
	if (strcmp ("bits_sent_hndl" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->bits_sent_hndl);
		FOUT
		}
	if (strcmp ("packets_sent_hndl" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->packets_sent_hndl);
		FOUT
		}
	if (strcmp ("packet_size_hndl" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->packet_size_hndl);
		FOUT
		}
	if (strcmp ("interarrivals_hndl" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->interarrivals_hndl);
		FOUT
		}
	if (strcmp ("format_str_data" , var_name) == 0)
		{
		*var_p_ptr = (void *) (prs_ptr->format_str_data);
		FOUT
		}
	if (strcmp ("flit_num" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->flit_num);
		FOUT
		}
	*var_p_ptr = (void *)OPC_NIL;

	FOUT
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -