Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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
 

Sande

Newbie level 1
Joined
Jan 31, 2006
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,290
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top