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

📄 tan_noc_worm_node_arbiter.pr.c

📁 片上网络
💻 C
📖 第 1 页 / 共 3 页
字号:
/* Process model C form file: tan_noc_worm_node_arbiter.pr.c */
/* Portions of this file copyright 1992-2004 by OPNET Technologies, Inc. */



/* This variable carries the header into the object file */
const char tan_noc_worm_node_arbiter_pr_c [] = "MIL_3_Tfile_Hdr_ 105A 30A modeler 7 49E69711 49E69711 1 05934b0918b5482 Administrator 0 0 none none 0 0 none 0 0 0 0 0 0 0 0 a0a 3                                                                                                                                                                                                                                                                                                                                                                                             ";
#include <string.h>



/* OPNET system definitions */
#include <opnet.h>



/* Header Block */

/*定义FIFO产生请求的统计中断,下级FIFO空满的控制信号以及crossbar是否为忙的控制信号*/
#include "math.h"
#include "stdlib.h"
#define FIFO_mid       		0
#define FIFO_east      		1
#define FIFO_south    		2
#define FIFO_west      		3
#define FIFO_north    		4

#define FIFO_next      		5

#define FIFO_mid_busy       6
#define FIFO_east_busy      7
#define FIFO_south_busy     8
#define FIFO_west_busy      9
#define FIFO_north_busy     10

#define cro_free     		11


//&&(op_stat_local_read(FIFO_mid)  !=5)


#define REQUEST_mid      (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == FIFO_mid)  
#define REQUEST_east     (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == FIFO_east) 
#define REQUEST_south    (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == FIFO_south)
#define REQUEST_west     (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == FIFO_west) 
#define REQUEST_north    (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == FIFO_north)
#define REQUEST 		 (REQUEST_mid||REQUEST_east||REQUEST_south||REQUEST_west||REQUEST_north)

#define FLOW_CONTROL	 (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == FIFO_next)

#define BUSY_mid         (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == FIFO_mid_busy)  &&(op_stat_local_read(FIFO_mid_busy)  !=0)
#define BUSY_east		 (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == FIFO_east_busy) &&(op_stat_local_read(FIFO_east_busy) !=0)
#define BUSY_south       (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == FIFO_south_busy)&&(op_stat_local_read(FIFO_south_busy)!=0)
#define BUSY_west        (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == FIFO_west_busy) &&(op_stat_local_read(FIFO_west_busy) !=0)
#define BUSY_north       (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == FIFO_north_busy)&&(op_stat_local_read(FIFO_north_busy)!=0)

#define CROSSBAR_BUSY    (BUSY_mid||BUSY_east||BUSY_south||BUSY_west||BUSY_north)
#define CROSSBAR_FREE    (op_intrpt_type() == OPC_INTRPT_STAT)&&(op_intrpt_stat() == cro_free) &&(op_stat_local_read(cro_free) !=0)

#define SELF_INTRPT      (op_intrpt_type() == OPC_INTRPT_SELF)




/* End of Header Block */


#if !defined (VOSD_NO_FIN)
#undef	BIN
#undef	BOUT
#define	BIN		FIN_LOCAL_FIELD(_op_last_line_passed) = __LINE__ - _op_block_origin;
#define	BOUT	BIN
#define	BINIT	FIN_LOCAL_FIELD(_op_last_line_passed) = 0; _op_block_origin = __LINE__;
#else
#define	BINIT
#endif /* #if !defined (VOSD_NO_FIN) */



/* State variable definitions */
typedef struct
	{
	/* Internal state tracking for FSM */
	FSM_SYS_STATE
	/* State Variables */
	int	                    		next_fifo_full                                  ;
	int	                    		crossbar_busy                                   ;
	double	                 		t_flag                                          ;
	int	                    		req_pk_num                                      ;
	int	                    		wait                                            ;
	int	                    		priority                                        ;
	Stathandle	             		mid_allow                                       ;
	Stathandle	             		east_allow                                      ;
	Stathandle	             		south_allow                                     ;
	Stathandle	             		west_allow                                      ;
	Stathandle	             		north_allow                                     ;
	int	                    		flag_mid                                        ;
	int	                    		flag_east                                       ;
	int	                    		flag_south                                      ;
	int	                    		flag_west                                       ;
	int	                    		flag_north                                      ;
	int	                    		dest_address_mid                                ;
	int	                    		dest_address_east                               ;
	int	                    		dest_address_south                              ;
	int	                    		dest_address_west                               ;
	int	                    		dest_address_north                              ;
	int	                    		isoccupy                                        ;
	int	                    		isoccupy_mid                                    ;
	int	                    		isoccupy_east                                   ;
	int	                    		isoccupy_south                                  ;
	int	                    		isoccupy_west                                   ;
	int	                    		isoccupy_north                                  ;
	int	                    		req_east                                        ;
	int	                    		req_mid                                         ;
	int	                    		req_south                                       ;
	int	                    		req_west                                        ;
	int	                    		req_north                                       ;
	} tan_noc_worm_node_arbiter_state;

#define pr_state_ptr            		((tan_noc_worm_node_arbiter_state*) (OP_SIM_CONTEXT_PTR->mod_state_ptr))
#define next_fifo_full          		pr_state_ptr->next_fifo_full
#define crossbar_busy           		pr_state_ptr->crossbar_busy
#define t_flag                  		pr_state_ptr->t_flag
#define req_pk_num              		pr_state_ptr->req_pk_num
#define wait                    		pr_state_ptr->wait
#define priority                		pr_state_ptr->priority
#define mid_allow               		pr_state_ptr->mid_allow
#define east_allow              		pr_state_ptr->east_allow
#define south_allow             		pr_state_ptr->south_allow
#define west_allow              		pr_state_ptr->west_allow
#define north_allow             		pr_state_ptr->north_allow
#define flag_mid                		pr_state_ptr->flag_mid
#define flag_east               		pr_state_ptr->flag_east
#define flag_south              		pr_state_ptr->flag_south
#define flag_west               		pr_state_ptr->flag_west
#define flag_north              		pr_state_ptr->flag_north
#define dest_address_mid        		pr_state_ptr->dest_address_mid
#define dest_address_east       		pr_state_ptr->dest_address_east
#define dest_address_south      		pr_state_ptr->dest_address_south
#define dest_address_west       		pr_state_ptr->dest_address_west
#define dest_address_north      		pr_state_ptr->dest_address_north
#define isoccupy                		pr_state_ptr->isoccupy
#define isoccupy_mid            		pr_state_ptr->isoccupy_mid
#define isoccupy_east           		pr_state_ptr->isoccupy_east
#define isoccupy_south          		pr_state_ptr->isoccupy_south
#define isoccupy_west           		pr_state_ptr->isoccupy_west
#define isoccupy_north          		pr_state_ptr->isoccupy_north
#define req_east                		pr_state_ptr->req_east
#define req_mid                 		pr_state_ptr->req_mid
#define req_south               		pr_state_ptr->req_south
#define req_west                		pr_state_ptr->req_west
#define req_north               		pr_state_ptr->req_north

/* These macro definitions will define a local variable called	*/
/* "op_sv_ptr" in each function containing a FIN statement.	*/
/* This variable points to the state variable data structure,	*/
/* and can be used from a C debugger to display their values.	*/
#undef FIN_PREAMBLE_DEC
#undef FIN_PREAMBLE_CODE
#if defined (OPD_PARALLEL)
#  define FIN_PREAMBLE_DEC	tan_noc_worm_node_arbiter_state *op_sv_ptr; OpT_Sim_Context * tcontext_ptr;
#  define FIN_PREAMBLE_CODE	\
		if (VosS_Mt_Perform_Lock) \
			VOS_THREAD_SPECIFIC_DATA_GET (VosI_Globals.simi_mt_context_data_key, tcontext_ptr, SimT_Context *); \
		else \
			tcontext_ptr = VosI_Globals.simi_sequential_context_ptr; \
		op_sv_ptr = ((tan_noc_worm_node_arbiter_state *)(tcontext_ptr->mod_state_ptr));
#else
#  define FIN_PREAMBLE_DEC	tan_noc_worm_node_arbiter_state *op_sv_ptr;
#  define FIN_PREAMBLE_CODE	op_sv_ptr = pr_state_ptr;
#endif


/* No Function Block */


#if !defined (VOSD_NO_FIN)
enum { _op_block_origin = __LINE__ };
#endif

/* Undefine optional tracing in FIN/FOUT/FRET */
/* The FSM has its own tracing code and the other */
/* functions should not have any tracing.		  */
#undef FIN_TRACING
#define FIN_TRACING

#undef FOUTRET_TRACING
#define FOUTRET_TRACING

#if defined (__cplusplus)
extern "C" {
#endif
	void tan_noc_worm_node_arbiter (OP_SIM_CONTEXT_ARG_OPT);
	VosT_Obtype tan_noc_worm_node_arbiter_init (int * init_block_ptr);
	VosT_Address tan_noc_worm_node_arbiter_alloc (VOS_THREAD_INDEX_ARG_COMMA VosT_Obtype, int);
	void tan_noc_worm_node_arbiter_diag (OP_SIM_CONTEXT_ARG_OPT);
	void tan_noc_worm_node_arbiter_terminate (OP_SIM_CONTEXT_ARG_OPT);
	void tan_noc_worm_node_arbiter_svar (void *, const char *, void **);


	VosT_Obtype Vos_Define_Object_Prstate (const char * _op_name, unsigned int _op_size);
	VosT_Address Vos_Alloc_Object_MT (VOS_THREAD_INDEX_ARG_COMMA VosT_Obtype _op_ob_hndl);
	VosT_Fun_Status Vos_Poolmem_Dealloc_MT (VOS_THREAD_INDEX_ARG_COMMA VosT_Address _op_ob_ptr);
#if defined (__cplusplus)
} /* end of 'extern "C"' */
#endif




/* Process model interrupt handling procedure */


void
tan_noc_worm_node_arbiter (OP_SIM_CONTEXT_ARG_OPT)
	{

#if !defined (VOSD_NO_FIN)
	int _op_block_origin = 0;
#endif
	FIN_MT (tan_noc_worm_node_arbiter ());
		{
		/* Temporary Variables */
		int mid_req;
		int east_req;
		int south_req;
		int west_req;
		int north_req;
		
		/* End of Temporary Variables */


		FSM_ENTER ("tan_noc_worm_node_arbiter")

		FSM_BLOCK_SWITCH
			{
			/*---------------------------------------------------------*/
			/** state (init) enter executives **/
			FSM_STATE_ENTER_FORCED_NOLABEL (0, "init", "tan_noc_worm_node_arbiter [init enter execs]")
				FSM_PROFILE_SECTION_IN ("tan_noc_worm_node_arbiter [init enter execs]", state0_enter_exec)
				{
				next_fifo_full = 0;
				
				mid_req        = 0;
				east_req       = 0;
				south_req      = 0;
				west_req       = 0;
				north_req      = 0;
				
				crossbar_busy  = 0;
				t_flag		   = 0;
				req_pk_num	   = 0;
				wait 		   = 0;
				
				priority	   = 1;
				
				
				
				mid_allow   = op_stat_reg ("FIFO_mid_allow",   OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
				east_allow  = op_stat_reg ("FIFO_east_allow",  OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
				south_allow = op_stat_reg ("FIFO_south_allow", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
				west_allow  = op_stat_reg ("FIFO_west_allow",  OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
				north_allow = op_stat_reg ("FIFO_north_allow", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
				
				
				/********************************************/
				
				flag_mid = 0;
				flag_east = 0;
				flag_south = 0;
				flag_west = 0;
				flag_north = 0;
				dest_address_mid = 0;
				dest_address_east = 0;
				dest_address_south = 0;
				dest_address_west = 0;
				dest_address_north = 0;
				isoccupy = 0;
				isoccupy_mid = 0;
				isoccupy_east = 0;
				isoccupy_south = 0;
				isoccupy_west = 0;
				isoccupy_north = 0;
				
				req_mid = 0;
				req_east = 0;
				req_south = 0;
				req_west = 0;
				req_north = 0;
				/********************************************/
				}
				FSM_PROFILE_SECTION_OUT (state0_enter_exec)

			/** state (init) exit executives **/
			FSM_STATE_EXIT_FORCED (0, "init", "tan_noc_worm_node_arbiter [init exit execs]")


			/** state (init) transition processing **/
			FSM_TRANSIT_FORCE (1, state1_enter_exec, ;, "default", "", "init", "idel")
				/*---------------------------------------------------------*/



			/** state (idel) enter executives **/
			FSM_STATE_ENTER_UNFORCED (1, "idel", state1_enter_exec, "tan_noc_worm_node_arbiter [idel enter execs]")

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


			/** state (idel) exit executives **/
			FSM_STATE_EXIT_UNFORCED (1, "idel", "tan_noc_worm_node_arbiter [idel exit execs]")


			/** state (idel) transition processing **/
			FSM_PROFILE_SECTION_IN ("tan_noc_worm_node_arbiter [idel trans conditions]", state1_trans_conds)
			FSM_INIT_COND (REQUEST)
			FSM_TEST_COND (CROSSBAR_BUSY)
			FSM_TEST_COND (SELF_INTRPT)
			FSM_TEST_COND (CROSSBAR_FREE)
			FSM_TEST_COND (FLOW_CONTROL)
			FSM_TEST_LOGIC ("idel")
			FSM_PROFILE_SECTION_OUT (state1_trans_conds)

			FSM_TRANSIT_SWITCH
				{
				FSM_CASE_TRANSIT (0, 3, state3_enter_exec, ;, "REQUEST", "", "idel", "arbiter_start")
				FSM_CASE_TRANSIT (1, 4, state4_enter_exec, ;, "CROSSBAR_BUSY", "", "idel", "corssbar_busy")
				FSM_CASE_TRANSIT (2, 5, state5_enter_exec, ;, "SELF_INTRPT", "", "idel", "arbiter")
				FSM_CASE_TRANSIT (3, 6, state6_enter_exec, ;, "CROSSBAR_FREE", "", "idel", "crossbar_free")
				FSM_CASE_TRANSIT (4, 10, state10_enter_exec, ;, "FLOW_CONTROL", "", "idel", "flow_control_0")
				}
				/*---------------------------------------------------------*/



			/** state (flow_control) enter executives **/
			FSM_STATE_ENTER_FORCED (2, "flow_control", state2_enter_exec, "tan_noc_worm_node_arbiter [flow_control enter execs]")
				FSM_PROFILE_SECTION_IN ("tan_noc_worm_node_arbiter [flow_control enter execs]", state2_enter_exec)
				{
				/*modify the flag value about next_fifo state*/
				if(op_stat_read(FIFO_next)==1)
					next_fifo_full = 1;
				else
					next_fifo_full = 0;
				}

⌨️ 快捷键说明

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