Quantcast
Channel: SystemC Language Forum RSS Feed
Viewing all articles
Browse latest Browse all 595

syntax for copying the bit vector , systemC 2.3.1 version

$
0
0

Hi All ,

I am trying to copy a particular bit  from one bit vector to other . I tried several ways of assigning the values but could not get it right. Also ,I want to assign a variable 'i' to a constant value in the loop . Below is the code . I have highlighted the lines where I am getting error. I would really appreciate if anyone could help in this . Thank you. 

 

#include "systemc.h"
SC_MODULE(S_R){
sc_in <bool> clk;
sc_in < sc_bv<8> > din;
sc_in <bool> rst;
sc_out< sc_bv<8> > dout;
sc_in<bool> load;
 
sc_bv<8> dinp;
sc_int<1> i ;
 
 
void shift()
{
if(rst)
{
dout=0;
}
else if(load)
{
dinp=din;
i.write('0');
dout[0].write(dinp[7]);
cout<<sc_time_stamp()<<"\tDESIGN1 --> input data:"<<dinp<<"\toutput data:"<<dout<<"\n";
}
else
{
dinp=dinp<<1;
dout[i].write(dinp[7]);
i=i+1;
cout<<sc_time_stamp()<<"\tDESIGN --> input data:"<<dinp<<"\toutput data:"<<dout<<"\n";
 
}
 
}
 
 
SC_CTOR(S_R)
{
SC_METHOD(shift);
sensitive<<clk.pos();
 
}
 
};
 

Viewing all articles
Browse latest Browse all 595

Trending Articles