• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification Shared Code
  3. c interface with specman

Stats

  • Locked Locked
  • Replies 0
  • Subscribers 38
  • Views 13449
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

c interface with specman

archive
archive over 18 years ago

Hi,

 I need to call a  c function form specman . I had followed the below steps.


File vb_pattern.e
---------------------------------

 
struct vb_pattern_s
{
  %data_in_ch0 : uint (bits : 4);   // data on channel 0
  %data_in_ch1 : uint (bits : 4);   // data on channed 1
  %data_in_ch2 : uint (bits : 4);   // data on channel 2
  %mode : uint (bits : 1);          // mode 
  %enable : uint (bits : 1);        // enable

};

C export vb_pattern_s;

------

file  x_output_bfm.e
--------------------------------------------

check_patterns()@clk_e is
{

  ...
 exp_viterbi_op();

}

routine exp_viterbi_op() is C routine viterbi_c_func;

---- EOF------

X.c
#include "vb_pattern.h"

void viterbi_c_func ()
{
 SN_TYPE(vb_pattern_s) vb_packet;
 SN_TYPE(mode)   mode;
 vb_packet = SN_SYS->ops
 mode = vb_packet->mode;
 printf("\n Printing from C environment MODE = %h \n", mode);

}


------------------- EOF----

x_top.e
------------
import  tb/vb_pattern.e;
import  tb/x_input_bfm.e;
import  tb/x_output_bfm.e;
import  tb/x_cover_dut.e;
import  tb/x_env.e;




I  did the following comand


>> sn_compile.sh -h_only x_top.e -o vb_pattern.h
>> gcc -c viterbi.c -o viterbi.o

I am getting the following error


viterbi.c: In function `viterbi_c_func':
viterbi.c:6: error: `t__mode' undeclared (first use in this function)
viterbi.c:6: error: (Each undeclared identifier is reported only once
viterbi.c:6: error: for each function it appears in.)
viterbi.c:6: error: syntax error before "mode"
viterbi.c:7: error: `mode' undeclared (first use in this function)


Please help me resolve this.

Kesav



  








 


Originally posted in cdnusers.org by kesava
  • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information