The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 11th, 2024, 11:26am
Pages: 1
Send Topic Print
Strange XNOR behavior in veriloga using spectre (Read 2563 times)
naone
New Member
*
Offline



Posts: 2
San Diego
Strange XNOR behavior in veriloga using spectre
Apr 13th, 2007, 9:25am
 
Hello,

I am using veriloga in spectre.  When I use the xnor built in function of ^~ or ~^ I get funny results.

integer a,b
a=1;
b=1;

c=a~^b;

c evaluates to -1

integer a,b;
a=0;
b=1;
c=a~^b;

c evaluates to -2

I think what is going on is all the integers are represented as a multi-bit integer and the ~^ is going the operation bit-wise.  The resulting number is then a negative number in 2s complement.  Is there a way to implement a and b as a binary value?

BTW c=!(a^b) works for me now but I would like to understand this a little better.

Thanks,

Naone
Back to top
 
 
View Profile   IP Logged
Andrew Beckett
Senior Fellow
******
Offline

Life, don't talk to
me about Life...

Posts: 1742
Bracknell, UK
Re: Strange XNOR behavior in veriloga using spectr
Reply #1 - Apr 16th, 2007, 3:53am
 
This seems reasonable behaviour to me.

If you only want to use an integer for single bit operation, you can always and the results with 1:

(a~^b)&1

which will give what you're expecting.

In Verilog-AMS you can use logic signals, and so define the bit length of the word you want. But in Verilog-A, you just have integers.

Regards,

Andrew.
Back to top
 
 
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.