Jump to content

sc_port<> binding


Effiong

Recommended Posts

Hi all,

 

I created two modules with interfaces as below:

 

M1 :  sc_port<sc_fifo_out_if<T>, 0> a

M2 :  sc_port<sc_fifo_in_if<T>, 0> a2;

 

I have a third module which is also my top module i.e M3 and tried binding M1 output to M2 input to create a communication channel. I have tried using sc_fifo<T>  but it doesn't work.

 

How do I bind M1 output to M2 input inside M3 module?

 

Please not that T is a struct.

 

Thanks

 

 

Link to comment
Share on other sites

Hi all,

 

I created two modules with interfaces as below:

 

M1 :  sc_port<sc_fifo_out_if<T>, 0> a

M2 :  sc_port<sc_fifo_in_if<T>, 0> a2;

 

I have a third module which is also my top module i.e M3 and tried binding M1 output to M2 input to create a communication channel. I have tried using sc_fifo<T>  but it doesn't work.

 

How do I bind M1 output to M2 input inside M3 module?

 

Please not that T is a struct.

 

Thanks

 

Hello Sir,

I am afraid as SystemC at its core is a C++ library, all

the T can only be a primitive data type supported by

the core C++ language. To achieve your goal of fransferring

a struct between modules, you would have to create/

use a custom signal channel defined by you. This is

achieved simply by creating a buffer to hold the 

struct, and a blocking read/write scheme(using the

built-in SystemC sc_mutex, sc_semaphore etc.,) 

to ensure that the empty buffer cannot be read, and

no writes are possible during a read operation. Hope

that helps.

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.

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