1

When you have a binary number, A = 5'b00100, and you get the negative version of it, B.

 reg signed [4:0] A, B;
 B = -A;

What does this do?

2 Answers 2

2

It'll create the twos complement of the number: flip the bits and add one!

Sign up to request clarification or add additional context in comments.

Comments

0

in the above case if both A/B are declared as 'signed', then the simple logic of B = -A should work and i tried in a simple case and it works. Verilog already does everything in 2's complement.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.