Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
あなたが、、を持っていてbinary number、A = 5'b00100あなたがそれのネガティブを得るversionとき、B。
binary number
A = 5'b00100
version
B
reg signed [4:0] A, B; B = -A;
これは何をしますか?
数値の2の補数を作成します。ビットを反転して1を追加します。
上記の場合、両方のA / Bが「署名済み」として宣言されている場合、B = -Aの単純なロジックが機能するはずであり、単純なケースで試してみましたが、機能します。Verilogはすでに2の補数ですべてを実行しています。