Steamをインストール
ログイン
|
言語
简体中文(簡体字中国語)
繁體中文(繁体字中国語)
한국어 (韓国語)
ไทย (タイ語)
български (ブルガリア語)
Čeština(チェコ語)
Dansk (デンマーク語)
Deutsch (ドイツ語)
English (英語)
Español - España (スペイン語 - スペイン)
Español - Latinoamérica (スペイン語 - ラテンアメリカ)
Ελληνικά (ギリシャ語)
Français (フランス語)
Italiano (イタリア語)
Bahasa Indonesia(インドネシア語)
Magyar(ハンガリー語)
Nederlands (オランダ語)
Norsk (ノルウェー語)
Polski (ポーランド語)
Português(ポルトガル語-ポルトガル)
Português - Brasil (ポルトガル語 - ブラジル)
Română(ルーマニア語)
Русский (ロシア語)
Suomi (フィンランド語)
Svenska (スウェーデン語)
Türkçe (トルコ語)
Tiếng Việt (ベトナム語)
Українська (ウクライナ語)
翻訳の問題を報告
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"