Jump to content

sc_ufixed symbols could not resolved.


srahulkumar1989

Recommended Posts

Hi all,

 

  I am working with  sc_fixed point types in systemc and i tried a small code with the usage of fixedpoint types.

 

#define SC_INCLUDE_FX
#include "systemc.h"
#include <stdlib.h>  //for srand() and rand()

SC_MODULE(rand){
sc_out<sc_ufixed<8,8,SC_TRN,SC_SAT> > output;
sc_ufixed<8,8,SC_TRN,SC_SAT> A;

void process(){    
while(true)
{
wait(19, SC_NS); 
A=rand() % 254 ; // range 0 to 253
output.write(A);
}
}
SC_CTOR(rand)
{
SC_THREAD(process);
}
};
 

 

The above code is just a source module which provides the rand numbers in the fixed point format to the next module. But when i compile i am getting the syntax error as "sc_ufixed symbols could not be resolved"
 
Even i defined locally the SC_INCLUDE_FX macro to work with the fixed point types. But i cant figure out what is the syntax problems while working with fixed point types.
when i work the same with the integers, it works fine.
 
Note: i am working in ubuntu 12.04 OS in eclipse C++ software.
 
please help me to proceed with a solution
Link to comment
Share on other sites

You should make sure that SC_INCLUDE_FX is consistently defined through all header files, preferably by setting it on the compiler command-line (option -DSC_INCLUDE_FX).  I would suspect that you included systemc.h already from somewhere else before defining SC_INCLUDE_FX locally.

 

Did you try your example separately?  It compiles mostly fine here, except for the fact that the module is called "rand" which locally shadows the "rand()" function, you try to call from the process.

 

Greetings from Oldenburg,

  Philipp

Link to comment
Share on other sites

Thanks for the response Philipp.

I tried to figure out what was the problem in my code.

I used a source file (.cpp file) to instantiate the rand module and its connections . So, when i defined SC_INCLUDE_FX in the main file also, the error was solved.

So i understood that we need to define the macros related to fixed point types in the related cpp files also

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...