Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
You have 3 problems to solve,
"Is Zero"
"Is positive"
"Is negative"
Solving "is negative", is just a case of sampling bit 7 (128), if TRUE then negative.
Solving "is positive", is just a case of NOT "is zero" AND NOT "is negative", if TRUE then positive.
"is zero" is where I suspect your current problem resides. I suspect based on your mention of trying to use XOR that your trying to build some kind of comparison between the input value and zero?
(cue the tricky bit, give help, not the solution). If we have some input A, we can deduce that it must be zero, if and only if all of its bits are zero. If we don't care about its distance from zero, we need only see if any bit is TRUE. using OR to combine all the bits would achieve that, although you would need to invert the output to have TRUE == zero.
That's an XOR gate. "Not" the output to make a comparator, or use a NXOR gate
You can apply that logic to each bit to compare bytes.
For <0 and >=0, Bit #8 IS the indicator. If Bit #8 = 1, then val <0. If Bit #8 = 0, then value is EITHER 0 or > 0. So put a NOT gate on Bit #8 and you have the >=0 result.
For >0, I took an AND gate and just put >=0 on one input and !=0 into the other. (3rd input was the "Tell me if value is >0" from the input. )
For <=0, you can either (simple answer) OR the <0 result with the =0 result.
or - what I did - because my gates were laid out this way: I routed the "tell me if value is <=0" signal so it goes into both of the gates that give me the <0 result and the =0 result. SO the <0 gate is turned on for both "tell me if val <0" and "tell me if val <=0". And the =0 gate is turned on for both "tell me if val =0" and "tell me if val <=0"