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

📄 tan_noc_worm_fifo_in_test.pr.c

📁 片上网络
💻 C
📖 第 1 页 / 共 2 页
字号:
				
				/*generate REQ signal    */
				//op_stat_write(req,0.0);			/*in this case, the packets always transfer to node0 */
				
				
				
				
				if((next == 1))
				    {op_intrpt_schedule_self (op_sim_time () + pk_svc_time, 0);
					 op_stat_write(crossbar_busy, 1.0);
					server_busy = 1;}
				/*else if((dest_address==1)&&(next_1 == 1))
					{op_intrpt_schedule_self (op_sim_time () + pk_svc_time, 0);
					op_stat_write(crossbar_busy, 1.0);
					server_busy = 1;}
				else if((dest_address==2)&&(next_2 == 1))
					{op_intrpt_schedule_self (op_sim_time () + pk_svc_time, 0);
					op_stat_write(crossbar_busy, 1.0);
					server_busy = 1;}	
				else if((dest_address==3)&&(next_3 == 1))
					{op_intrpt_schedule_self (op_sim_time () + pk_svc_time, 0);
					op_stat_write(crossbar_busy, 1.0);
					server_busy = 1;}
				else if((dest_address==4)&&(next_4 == 1))
					{op_intrpt_schedule_self (op_sim_time () + pk_svc_time, 0);
					op_stat_write(crossbar_busy, 1.0);
					server_busy = 1;}*/
				else 
					{
					server_busy = 0;
					//op_stat_write(crossbar_busy, 0.0);
					}
				
				
				
				/* schedule an interrupt for this process 		*/
				/* at the time where service ends. 				*/
				
				
				/* the server is now busy. 						*/
				
				
				
				}
				FSM_PROFILE_SECTION_OUT (state3_enter_exec)

			/** state (svc_start) exit executives **/
			FSM_STATE_EXIT_FORCED (3, "svc_start", "tan_noc_worm_FIFO_in_test [svc_start exit execs]")


			/** state (svc_start) transition processing **/
			FSM_PROFILE_SECTION_IN ("tan_noc_worm_FIFO_in_test [svc_start trans conditions]", state3_trans_conds)
			FSM_INIT_COND (server_busy)
			FSM_TEST_COND (!server_busy)
			FSM_TEST_LOGIC ("svc_start")
			FSM_PROFILE_SECTION_OUT (state3_trans_conds)

			FSM_TRANSIT_SWITCH
				{
				FSM_CASE_TRANSIT (0, 2, state2_enter_exec, ;, "server_busy", "", "svc_start", "idle")
				FSM_CASE_TRANSIT (1, 5, state5_enter_exec, ;, "!server_busy", "", "svc_start", "wait")
				}
				/*---------------------------------------------------------*/



			/** state (svc_compl) enter executives **/
			FSM_STATE_ENTER_FORCED (4, "svc_compl", state4_enter_exec, "tan_noc_worm_FIFO_in_test [svc_compl enter execs]")
				FSM_PROFILE_SECTION_IN ("tan_noc_worm_FIFO_in_test [svc_compl enter execs]", state4_enter_exec)
				{
				pkptr = op_subq_pk_remove (0, OPC_QPOS_HEAD);   
				
				
				
				/*
				if(op_pk_convert_to_vvec(pkptr) == OPC_COMPCODE_FAILURE) {
					printf("convert is failed\n");
				}
				else {
					err_vec = op_vvec_create(OPC_VVEC_NATIVE_INT);
					op_pk_vvec_get(pkptr, &err_vec);
					printf("value vector size : %d\n", op_vvec_size_get(err_vec));
				}
				*/
				op_pk_send_forced (pkptr, 0);
				
				/* server is idle again. 					*/
				server_busy = 0;
				
				
				op_stat_write (fifo_full, (op_subq_stat (0,OPC_QSTAT_FREE_PKSIZE) == 0));
				}
				FSM_PROFILE_SECTION_OUT (state4_enter_exec)

			/** state (svc_compl) exit executives **/
			FSM_STATE_EXIT_FORCED (4, "svc_compl", "tan_noc_worm_FIFO_in_test [svc_compl exit execs]")


			/** state (svc_compl) transition processing **/
			FSM_PROFILE_SECTION_IN ("tan_noc_worm_FIFO_in_test [svc_compl trans conditions]", state4_trans_conds)
			FSM_INIT_COND (QUEUE_EMPTY)
			FSM_TEST_COND (!QUEUE_EMPTY)
			FSM_TEST_LOGIC ("svc_compl")
			FSM_PROFILE_SECTION_OUT (state4_trans_conds)

			FSM_TRANSIT_SWITCH
				{
				FSM_CASE_TRANSIT (0, 2, state2_enter_exec, ;, "QUEUE_EMPTY", "", "svc_compl", "idle")
				FSM_CASE_TRANSIT (1, 7, state7_enter_exec, ;, "!QUEUE_EMPTY", "", "svc_compl", "req_get")
				}
				/*---------------------------------------------------------*/



			/** state (wait) enter executives **/
			FSM_STATE_ENTER_UNFORCED (5, "wait", state5_enter_exec, "tan_noc_worm_FIFO_in_test [wait enter execs]")

			/** blocking after enter executives of unforced state. **/
			FSM_EXIT (11,"tan_noc_worm_FIFO_in_test")


			/** state (wait) exit executives **/
			FSM_STATE_EXIT_UNFORCED (5, "wait", "tan_noc_worm_FIFO_in_test [wait exit execs]")


			/** state (wait) transition processing **/
			FSM_PROFILE_SECTION_IN ("tan_noc_worm_FIFO_in_test [wait trans conditions]", state5_trans_conds)
			FSM_INIT_COND (FLOW_CONTROL)
			FSM_TEST_COND (ARRIVAL)
			FSM_TEST_LOGIC ("wait")
			FSM_PROFILE_SECTION_OUT (state5_trans_conds)

			FSM_TRANSIT_SWITCH
				{
				FSM_CASE_TRANSIT (0, 3, state3_enter_exec, ;, "FLOW_CONTROL", "", "wait", "svc_start")
				FSM_CASE_TRANSIT (1, 1, state1_enter_exec, ;, "ARRIVAL", "", "wait", "arrival")
				}
				/*---------------------------------------------------------*/



			/** state (FLOW_CON) enter executives **/
			FSM_STATE_ENTER_FORCED (6, "FLOW_CON", state6_enter_exec, "tan_noc_worm_FIFO_in_test [FLOW_CON enter execs]")
				FSM_PROFILE_SECTION_IN ("tan_noc_worm_FIFO_in_test [FLOW_CON enter execs]", state6_enter_exec)
				{
				/*if(op_intrpt_type () == OPC_INTRPT_STAT)
					{
					if(op_intrpt_stat ()==NEXT_FIFO_FULL_0)
						if(op_stat_local_read (NEXT_FIFO_FULL_0) == 1)
				            next_0=1;
				        else
					        next_0=0;
					if(op_intrpt_stat ()==NEXT_FIFO_FULL_1)
						if(op_stat_local_read (NEXT_FIFO_FULL_1) == 1)
				            next_1=1;
				        else
					        next_1=0;	
					if(op_intrpt_stat ()==NEXT_FIFO_FULL_2)
						if(op_stat_local_read (NEXT_FIFO_FULL_2) == 1)
				            next_2=1;
				        else
					        next_2=0;	
					if(op_intrpt_stat ()==NEXT_FIFO_FULL_3)
						if(op_stat_local_read (NEXT_FIFO_FULL_3) == 1)
				            next_3=1;
				        else
					        next_3=0;	
					if(op_intrpt_stat ()==NEXT_FIFO_FULL_4)
						if(op_stat_local_read (NEXT_FIFO_FULL_4) == 1)
				            next_4=1;
				        else
					        next_4=0;	
					}
				*/
				
				// Because the statistic interrupt only have one, it's arbiter's allow message, 
				// so the variable have only one(next) is enough.
				if(op_intrpt_type() == OPC_INTRPT_STAT)
					{
						if(op_intrpt_stat() == NEXT_FIFO_ALLOW)
							if(op_stat_local_read(NEXT_FIFO_ALLOW) == 1)
								next = 1;
							else 
								next = 0;
					}
				}
				FSM_PROFILE_SECTION_OUT (state6_enter_exec)

			/** state (FLOW_CON) exit executives **/
			FSM_STATE_EXIT_FORCED (6, "FLOW_CON", "tan_noc_worm_FIFO_in_test [FLOW_CON exit execs]")


			/** state (FLOW_CON) transition processing **/
			FSM_TRANSIT_FORCE (2, state2_enter_exec, ;, "default", "", "FLOW_CON", "idle")
				/*---------------------------------------------------------*/



			/** state (req_get) enter executives **/
			FSM_STATE_ENTER_FORCED (7, "req_get", state7_enter_exec, "tan_noc_worm_FIFO_in_test [req_get enter execs]")
				FSM_PROFILE_SECTION_IN ("tan_noc_worm_FIFO_in_test [req_get enter execs]", state7_enter_exec)
				{
				pkptr = op_subq_pk_access (0, OPC_QPOS_HEAD);
				op_pk_nfd_get_int32 (pkptr, "dest_address",&dest_address);
				printf("dest_address : %d\n", dest_address);
				
				op_stat_write(req, 0);  
				
				
				}
				FSM_PROFILE_SECTION_OUT (state7_enter_exec)

			/** state (req_get) exit executives **/
			FSM_STATE_EXIT_FORCED (7, "req_get", "tan_noc_worm_FIFO_in_test [req_get exit execs]")


			/** state (req_get) transition processing **/
			FSM_TRANSIT_FORCE (5, state5_enter_exec, ;, "default", "", "req_get", "wait")
				/*---------------------------------------------------------*/



			}


		FSM_EXIT (0,"tan_noc_worm_FIFO_in_test")
		}
	}




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




void
tan_noc_worm_FIFO_in_test_terminate (OP_SIM_CONTEXT_ARG_OPT)
	{

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

	FIN_MT (tan_noc_worm_FIFO_in_test_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_FIFO_in_test_svar function. */
#undef service_rate
#undef own_id
#undef fifo_full
#undef pk_destroy
#undef server_busy
#undef next
#undef crossbar_busy
#undef req

#undef FIN_PREAMBLE_DEC
#undef FIN_PREAMBLE_CODE

#define FIN_PREAMBLE_DEC
#define FIN_PREAMBLE_CODE

VosT_Obtype
tan_noc_worm_FIFO_in_test_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_FIFO_in_test_init (init_block_ptr))

	obtype = Vos_Define_Object_Prstate ("proc state vars (tan_noc_worm_FIFO_in_test)",
		sizeof (tan_noc_worm_FIFO_in_test_state));
	*init_block_ptr = 0;

	FRET (obtype)
	}

VosT_Address
tan_noc_worm_FIFO_in_test_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_FIFO_in_test_state * ptr;
	FIN_MT (tan_noc_worm_FIFO_in_test_alloc (obtype))

	ptr = (tan_noc_worm_FIFO_in_test_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_FIFO_in_test_svar (void * gen_ptr, const char * var_name, void ** var_p_ptr)
	{
	tan_noc_worm_FIFO_in_test_state		*prs_ptr;

	FIN_MT (tan_noc_worm_FIFO_in_test_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_FIFO_in_test_state *)gen_ptr;

	if (strcmp ("service_rate" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->service_rate);
		FOUT
		}
	if (strcmp ("own_id" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->own_id);
		FOUT
		}
	if (strcmp ("fifo_full" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->fifo_full);
		FOUT
		}
	if (strcmp ("pk_destroy" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->pk_destroy);
		FOUT
		}
	if (strcmp ("server_busy" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->server_busy);
		FOUT
		}
	if (strcmp ("next" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->next);
		FOUT
		}
	if (strcmp ("crossbar_busy" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->crossbar_busy);
		FOUT
		}
	if (strcmp ("req" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->req);
		FOUT
		}
	*var_p_ptr = (void *)OPC_NIL;

	FOUT
	}

⌨️ 快捷键说明

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