Jump to content
mohitnegi

string directly as input ??/

Recommended Posts

hello ,,

 

i wish to use string as input data type i have used ...

sc_in<unsigned char> data_in;

and i am using data_in as static sensitivity ....and am getting error :

ca_fifo.h: In constructor ‘fifo::fifo(sc_core::sc_module_name)’:
ca_fifo.h:27:6: error: invalid static_cast from type ‘void (fifo::*)(char)’ to type ‘sc_core::SC_ENTRY_FUNC {aka void (sc_core::sc_process_host::*)()}’

please explain me the above error as i wish to sent a string literal from stimulus ...

 

and on page 199 of 1666-2011 string literals topic ...it is written

"

A string literal representation may be used as the value of a SystemC numeric or vector type object."

 

does it mean that we cannot sent a string literal directly ...

 

thanks

Mohit Negi

Share this post


Link to post
Share on other sites

Please show more of your code, including the line where the error occurs,

 

regards

Alan

 

P.S. I don't think the quote from the LRM is relevant. What that quote says is that you may write

 

  sc_lv<8> = "10101010";

 

i.e. mix vector types and string literals.

Share this post


Link to post
Share on other sites
#include <systemc.h>

SC_MODULE (fifo)
{
  sc_in<bool> read_write_n;
  sc_in<unsigned char> data_in;
  sc_in<bool> clock;
  sc_in<bool> reset;
  
  sc_out<bool> output;

  void fifo_read();
  void fifo_write(unsigned char c);
  void fifo_reset();

  sc_event write_event,read_event;
  enum e{MAX=10};
  char data[MAX];
  int num_element,first;

 SC_CTOR (fifo)
  {
     SC_THREAD(fifo_read);
     sensitive<<read_write_n;
     sensitive_pos<<clock;
      
     SC_THREAD(fifo_write);
     sensitive<<read_write_n;//<<data_in;
     sensitive<<data_in;
     sensitive_pos<<clock;

     SC_THREAD(fifo_reset);
     sensitive<<reset;
   }   
};

error is

mohit@ubuntu:~/Desktop/Untitled Folder$ g++ -I. -I$SYSTEMC_HOME/include -L. -L$SYSTEMC_HOME/lib-linux -Wl,-rpath=$SYSTEMC_HOME/lib-linux ca_fifo.h -lsystemc -lm
ca_fifo.h: In constructor ‘fifo::fifo(sc_core::sc_module_name)’:
ca_fifo.h:27:6: error: invalid static_cast from type ‘void (fifo::*)(unsigned char)’ to type ‘sc_core::SC_ENTRY_FUNC {aka void (sc_core::sc_process_host::*)()}’

Share this post


Link to post
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...