Reputation: 3
In module hierarchy, on connecting inout port with sc_signal it shows error, So is there any other type of signal I need to connect with inout (bidirectional port) ?
Error: (E115) sc_signal cannot have more than one driver:
signal Dha.signal_0' (sc_signal)
first driver
Dha.Memory.port_4' (sc_inout)
second driver `Dha.Alloc.port_3' (sc_inout)
Upvotes: 0
Views: 997
Reputation: 323
You need to instantiate the sc_signal
with a writer policy of SC_MANY_WRITERS
to drive a signal from multiple ports/processes.
#include <systemc.h>
SC_MODULE(Foo) {
sc_inout<bool> port;
SC_CTOR(Foo)
: port("port")
{}
// ...
};
SC_MODULE(Bar) {
sc_inout<bool> port;
SC_CTOR(Bar)
: port("port")
{}
// ...
};
int sc_main(int, char*[])
{
sc_signal<bool, SC_MANY_WRITERS> signal; // <-- policy here
Foo foo("foo");
Bar bar("bar");
foo.port(signal);
bar.port(signal);
sc_start();
return 0;
}
Upvotes: 1
Reputation: 4038
You need sc_signal_rv. Check example here http://www.asic-world.com/systemc/ports_signals4.html#Example_:_Resolved_Vector_Signals
Upvotes: 0