Jump to content

Bind a vector of sc_signal<bool> with an sc_signal<sc_uint<4> >


Recommended Posts

Hi,

I'm trying to understand if there's the chance of bind a vector of 4 sc_signal<bool> with an sc_signal<sc_uint<4> >

I have a Ripple Carry Adder composed of 4 1-bit Full Adder. I create and bind my RIpple Carry Adder with the below code

sc_vector<sc_signal<bool> > Gen_1;
Gen_1.init(N);
sc_vector<sc_signal<bool> > Gen_2;
Gen_2.init(N);
sc_signal<bool > Cin;
sc_vector<sc_signal<bool> > Out;
Out.init(N);
sc_signal<bool> Cout;

Where Gen_1 and Gen_2 are the input signals, Cin and Cout are the carry IN and OUT and Out is the output signal

I bind the ports with the following method

sc_vector<sc_out<bool> >::iterator itout; 
sc_vector<sc_in<bool> >::iterator itin;

RIPPLECARRYADDER fulladd_0("RIPPLECARRYADDER",N);
itin = fulladd_0.FirstNum(Gen_1);
itin = fulladd_0.SecondNum(Gen_2);
itout = fulladd_0.AddOut.bind(Out);
fulladd_0.Cin(Cin);
fulladd_0.Cout(Cout);

Where FIrstNum, SecondNum and AddOut are

 sc_vector<sc_in<bool> > FirstNum;
 sc_vector<sc_in<bool> > SecondNum;
 sc_vector<sc_out<bool> > AddOut;

In the RippleCArryAdder.h

Now, I have a module which has an input port in the form of

sc_signal<sc_uint<4> > ALUout;

Is there a way to bind Out with ALUout for example?

Link to post
Share on other sites
  • 1 month later...

Not directly. You need to bind Out to a vector of signals of type bool and create a method being sensitive to all signals in the vector. This method then does the conversion and drives the ALUout signal.

Link to post
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...