Asifhasan Rizvi
Asifhasan Rizvi

Reputation: 3

Bi-direction port connection with signal in SystemC

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 driverDha.Memory.port_4' (sc_inout) second driver `Dha.Alloc.port_3' (sc_inout)

Upvotes: 0

Views: 997

Answers (2)

pah
pah

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

random
random

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

Related Questions