cipher_crypto
Junior Member level 3

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