testing multiple bit gates (values interpretation)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

testing multiple bit gates (values interpretation)

lodowcowy_rowerzysta
Can someone explain me how to interpret values of pins that are shown in hardware simulator while testing gates with multiple bit input? For example:

why input 0001 0010 0011 0100 corresponds with value 4660, input 1001 1000 0111 0110 corresponds with value -26506 and value of output is 4148? I am also curious what "%B" means in the script.
Reply | Threaded
Open this post in threaded view
|

Re: testing multiple bit gates (values interpretation)

ivant
Just switch the Format (from the dropbox in the toolbar or from the View / Format menu) to Binary.
Reply | Threaded
Open this post in threaded view
|

Re: testing multiple bit gates (values interpretation)

lodowcowy_rowerzysta
Thanks, but why b input is negative? Why -26506? When I convert 1001 1000 0111 0110 to decimal I am getting 39030.
And what that "%B" means?
Reply | Threaded
Open this post in threaded view
|

Re: testing multiple bit gates (values interpretation)

WBahn
Administrator
%B means that the format is binary.

Values are interpreted as two's complement, so they range from -32768 to +32767.

If the value is more than 32767, it is actually a negative number (as also indicated by the 1 as the most-significant bit). To get the actual value, subtract 65536 (2^16) from the positive value:

39,030 - 65,536 = -26,506

Reply | Threaded
Open this post in threaded view
|

Re: testing multiple bit gates (values interpretation)

lodowcowy_rowerzysta
Thank you very much!