Jump to content
worm&chicken

Method sensitive with sc_inout port

Recommended Posts

Dear all,

 

I have a problem when using sc_inout port as described in source file below.

When I using inout port in a module, a method to sensitive with this port also a thread to write to this port.

when the thread writes to inout port it also calls the method which is sensitive with this port.

Is it OK for my modeling mindset: this port is output when I do write, and i expected that the method will did not call?

Or did I get a mistake in somewhere?

//Sorry for my english if it difficult to understand.

main.cpp

Share this post


Link to post
Share on other sites

I don't quite understood what is your problem. I suggest you to run simulation and check if works as you expected. If it is not, try to reformulate a problem as "I expected (something), but I got (something else) in simulation".

 

Share this post


Link to post
Share on other sites

Your SC_THREAD has  no static sensitivity, but you call the signature `wait( void )`, which requires static sensitivity. Did you mean `wait(in1_InOut->changed_event())`?

You call SC_SIGNAL_MANY_WRITERS, which strongly suggests to mean that you don't understand sc_signal channel. Probably, you should be using sc_signal_resolved.

Share this post


Link to post
Share on other sites
On 10/24/2018 at 12:06 PM, Roman Popov said:

I don't quite understood what is your problem. I suggest you to run simulation and check if works as you expected. If it is not, try to reformulate a problem as "I expected (something), but I got (something else) in simulation".

 

5

I have any class Initiator and target. In initiator, I have a thread, a method  and a inout port,  method sensitive with that port and thread is used to write to this port.

In class Target, I have a method, that sensitive with inout port. In the top class. I instanced 2 class above and connected the inout port.

 

I expected that in initiator, when thread writes to inout port, i expected only method of target is call but both method of Initiator and Target was called.

 

 

Share this post


Link to post
Share on other sites
1 hour ago, worm&chicken said:

I expected that in initiator, when thread writes to inout port, i expected only method of target is call but both method of Initiator and Target was called.

In your code sample both Initiator and Target SC_METHODs are sensitive to value change event of signal. So when signal value changes, both of them are triggered. 

Why did you expect different outcome?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×