Jump to content

A void value confusion


Recommended Posts

In my testbench

     void Dendrit_Set(int index, int value)
       { *mNeuron->dendrit[index].write(value);}

     Neuron* mNeuron;

I receive the error message

 error: void value not ignored as it ought to be
      { *mNeuron->dendrit[index].write(value);}

The relevant declaration/definition

typedef sc_dt::sc_uint<DENDRIT_WIDTH> SC_DENDRIT_TYPE;

SC_MODULE(Neuron) {
    // Ports
    sc_signal<SC_DENDRIT_TYPE > dendrit[NO_OF_DENDRITS];

What is wrong here? (I simple do not understand the error message)

Link to comment
Share on other sites

Hello @katang,

The compiler message is quite right as mentioned by @Eyck.

The Compiler sees the code something like this:

void Dendrit_Set(int index, int value)

Basically the operator precedence is at play here(refer here for more details).

Compiler sees that you are trying to dereference a void type, since the write method of the sc_signal returns void.

Hope it helps.

Best Regards,

Ameya Vikram Singh

Link to comment
Share on other sites

Based on what I see, the * shouldn't even be there at all since the -> takes care of it.

Either use:




However, I'm more concerned that you're not using ports to access members of a module (assuming Dendrit_Set is not part of module Neuron). That violates a rather fundamental principle of SystemC. It's legal C++, but questionable SystemC.

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.

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...