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;
这是做什么的?
它将创建数字的二进制补码:翻转位并加一!
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.