コード例 #1
0
ファイル: lib.c プロジェクト: HackLinux/sveditor-ref-designs
/*-------------------------------------------------------------------------------
 if find x in the variable, kill simulation.
--------------------------------------------------------------------------------*/
void x_checker_call()
{
  char* avalPtr, *bvalPtr;
  int  word, groups, size;
  s_tfnodeinfo node_info;

  tf_nodeinfo(1, &node_info);
  switch(node_info.node_type){
  case TF_MEMORY_NODE :
    word = node_info.node_ngroups * 2;
    for(size = 0;size < node_info.node_mem_size;size++){
      avalPtr = node_info.node_value.memoryval_p + size * word;
      bvalPtr = avalPtr + node_info.node_ngroups;
      for(groups = node_info.node_ngroups - 1; groups >= 0;groups--)
	if(bvalPtr[groups])handle_error(1);
    }
    break;
  case TF_REG_NODE :
    for(groups = 0; groups < node_info.node_ngroups ; groups++){
      if(node_info.node_value.vecval_p[groups].bvalbits)handle_error(1);
    }
    break;
  case TF_NETVECTOR_NODE :
    for(groups = 0; groups < node_info.node_ngroups ; groups++){
      if(node_info.node_value.vecval_p[groups].bvalbits)handle_error(1);
    }
    break;
  }
  tf_putp(0, 0);//indicates error
}
コード例 #2
0
ファイル: plimfil2.c プロジェクト: kammoh/cvcx
/*
 * check the fill memory user PLI function
 * notice calling tf_error here will inhibit simulation
 * probably sould also check 2nd index argument 
 */
static void check_plimemfil2(int data, int reason)
{
 if (tf_nump() != 2)
  {
   tf_error("$pli_memfil2 has %d arguments - 2 required", tf_nump());
   return;
  }
 /* this associates nodeinfo struct with argument */
 tf_nodeinfo(1, &ninfo);
 if (ninfo.node_type != TF_MEMORY_NODE)
  {
   tf_error("$pli_memfil2 first argument not read/write memory select");
   return;
  }
}