The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Modeling >> Behavioral Models >> Strange XNOR behavior in veriloga using spectre https://designers-guide.org/forum/YaBB.pl?num=1176481506 Message started by naone on Apr 13th, 2007, 9:25am |
Title: Strange XNOR behavior in veriloga using spectre Post by naone on 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 |
Title: Re: Strange XNOR behavior in veriloga using spectr Post by Andrew Beckett on 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. |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |