stop_fin.c

来自「通向ip设计的必看的一本书籍」· C语言 代码 · 共 53 行

C
53
字号
#include "veriuser.h"

int my_stop_finish()
{

	if(tf_nump() == 1) /* if 1 argument is passed to the my_stop_finish 
												task, execute the following code */
	{
		if(tf_getp(1) == 0)	/* get value of argument. if the argument 
													 is 0 then stop the simulation*/				
		{
			io_printf("Mymessage: Simulation stopped at time %d\n", tf_gettime());
			tf_dostop(); /*stop the simulation*/
		}
		else if(tf_getp(1) == 1)	/* if the argument is 0 then terminate 
													 the simulation*/				
		{
			io_printf("Mymessage: Simulation finished at time %d\n", tf_gettime());
			tf_dofinish(); /*terminate the simulation*/
		}
		else
			/* Pass warning message */
			tf_warning("Bad arguments to \$my_stop_finish at time %d\n", 
																										tf_gettime());

	}

	else if(tf_nump() == 2) /* if 1 argument is passed to the my_stop_finish 
                        task, then print module instance from which the
												task was called */
  {
    if(tf_getp(1) == 0) /* if the argument is 0 then stop 
                           the simulation*/
    { 
      io_printf("Mymessage: Simulation stopped at time %d in instance  %s \n", 
																tf_gettime(), tf_mipname()); 
      tf_dostop(); /*stop the simulation*/
    }
    else if(tf_getp(1) == 1)  /* if the argument is 0 then terminate
                           the simulation*/
    {    
      io_printf("Mymessage: Simulation finished at time %d in instance  %s \n", 
																tf_gettime(), tf_mipname()); 
      tf_dofinish(); /*terminate the simulation*/
    }   
    else
			/* Pass warning message */
			tf_warning("Bad arguments to \$my_stop_finish at time %d\n", 
																										tf_gettime());
  }

}

⌨️ 快捷键说明

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