katang Posted July 18, 2018 Report Share Posted July 18, 2018 In my testbench void Dendrit_Set(int index, int value) { *mNeuron->dendrit[index].write(value);} protected: 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) Quote Link to comment Share on other sites More sharing options...
katang Posted July 18, 2018 Author Report Share Posted July 18, 2018 I am sorry, the '*' is obsolete here. The error message, however, is strange, I think. Quote Link to comment Share on other sites More sharing options...
kartikkg Posted July 18, 2018 Report Share Posted July 18, 2018 3 minutes ago, katang said: I am sorry, the '*' is obsolete here. The error message, however, is strange, I think. Can you share some more code ? Where are you calling the function Dendrit_Set Quote Link to comment Share on other sites More sharing options...
Eyck Posted July 18, 2018 Report Share Posted July 18, 2018 Well, actually the error message from the point of the compiler is quite right: using the '*'-operator you intent to dereference the return value of write() which is 'void'. BR Quote Link to comment Share on other sites More sharing options...
AmeyaVS Posted July 18, 2018 Report Share Posted July 18, 2018 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) { *(mNeuron->dendrit[index].write(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 Quote Link to comment Share on other sites More sharing options...
katang Posted July 18, 2018 Author Report Share Posted July 18, 2018 You are both right. However, I would formulate the error message something like 'You are attempting to use a void value' and would print the location pointer at after the '*' rather than at the beginning of 'value' Quote Link to comment Share on other sites More sharing options...
David Black Posted July 18, 2018 Report Share Posted July 18, 2018 Based on what I see, the * shouldn't even be there at all since the -> takes care of it. Either use: mNeuron->dendrit[index].write(value); or (*mNeuron).dendrit[index].write(value); 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.