gsachin Posted April 11, 2014 Report Share Posted April 11, 2014 Hi,I have a set of signals defined as:sc_signal<sc_logic> bit0;sc_signal<sc_logic> bit1;sc_signal<sc_logic> bit2;I have another buses defined assc_signal<sc_bv<3> > bus_input;sc_signal<sc_bv<3> > bus_output;I would like to do this operation:bus_output = bit(i) & bus_input where i = 0,1,2For this, I am writing this code:bus_output = (bit2.read(), bit1.read(), bit0.read()) & bus_input.read();But this does not work. Compile is fine but only the bus_output[0] is correctly being written. other bits are not getting updated.Can you please let me know what is the issue?Thanks,Sachin Quote Link to comment Share on other sites More sharing options...
apfitch Posted April 11, 2014 Report Share Posted April 11, 2014 I'm not sure what's wrong - but it's probably better to use a temporary variable, e.g. // SC_METHOD void proc() { sc_lv<3> bv3 = (bit2.read(), bit1.read(), bit0.read()); bus_output.write ( bv3 & bus_input.read() ); } Can you try that and see if it works? If it doesn't, then something else is wrong. regards Alan Quote Link to comment Share on other sites More sharing options...
Hans64 Posted April 11, 2014 Report Share Posted April 11, 2014 Hi Sachin, For concatenation one of the arguments should be a vector. bus_output = (bit2.read(), bit1.read(), bit0.read()) This will fail as all the arguments are sc_logic. See LRM section 7.2.7 Regards, Hans. www.ht-lab.com Philipp A Hartmann 1 Quote Link to comment Share on other sites More sharing options...
dakupoto Posted April 12, 2014 Report Share Posted April 12, 2014 Hi, I have a set of signals defined as: sc_signal<sc_logic> bit0; sc_signal<sc_logic> bit1; sc_signal<sc_logic> bit2; I have another buses defined as sc_signal<sc_bv<3> > bus_input; sc_signal<sc_bv<3> > bus_output; I would like to do this operation: bus_output = bit(i) & bus_input where i = 0,1,2 For this, I am writing this code: bus_output = (bit2.read(), bit1.read(), bit0.read()) & bus_input.read(); But this does not work. Compile is fine but only the bus_output[0] is correctly being written. other bits are not getting updated. Can you please let me know what is the issue? Thanks, Sachin Hello Sir, there appears to be some confusion here. You have defined : sc_signal<sc_bv<3> > bus_output; that is bus_output is an object of type sc_core::sc_signal, and the template type is sc_dt::sc_bv<3>. So, ONLY bit vectors of size 3 can be written into signal channel bus_output; To do that, declare/define a bit vector f size 3, concatenate all bits as desired, and then write that bit vector into the output sugnal channel. Hope that helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.