SystemC::Problem in sc_bv relational operator

Status
Not open for further replies.

cipher_crypto

Junior Member level 3
Joined
Jan 28, 2006
Messages
28
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,283
Activity points
1,508
sc_bv systemc

Hello Guys,

I am trying to design a vector comparator. I declared my inputs as sc_bv.Since this data type dont deal with relational operators ...I converted them into intger file using "=". Now my program compiled well. But the output is making mistake. Same way when I used only integer type input it worked perfectly. I am pasting part of my comparator module. Please enlight me why I am having problem converting the sc_bv into sc_int type.



SC_MODULE(comp_rtr) { // declare comparator sc_module

sc_in <sc_bv<8> > comp_A, comp_B; // input signal ports
sc_out <bool> GE,LE,EQ; // output signal ports
sc_signal <sc_int<8> > temp_A,temp_B;

void comp8() {
temp_A = comp_A.read(); //converting sc-bv into sc-int
temp_B = comp_B.read();
LE.write(false);
EQ.write(false);
GE.write(false);
if (temp_A == temp_B)

{
EQ.write(true);
}
else if(temp_A > temp_B)
{
GE.write(true);
}

else if(temp_A < temp_B)
{
LE.write(true);
}
else {}
}


Thank you.

Cipher
 

sc_bv read

temp_A = comp_A.read(); //converting sc-bv into sc-int
temp_B = comp_B.read();

Try with this, it mostly works.
temp_A = comp_A.read().to_int();
temp_B = comp_B.read().to_int();
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…