jchdl

 
一的补码指对二进制数的每一位分别求补(二进制运算下0,1互为补数),实际运算即为对每一位取反。最高位为符号位。n位二进制数a的一的补数为2^n - 1 - a.
 
The ones' complement of a binary number is defined as the value obtained by inverting all the bits in the binary representation of the number (swapping 0s for 1s and vice versa). The ones' complement of the number then behaves like the negative of the original number in some arithmetic operations.
 
参考链接
 
 
1.创建Sub.java, 并生成构造方法和logic()方法
 
2. 根据逻辑原理图,添加输入输出线
 
3. 在构造方法中搜集输入输出线并调用construct()方法
 
4. 在logic()方法中创建子节点并连线
这里使用Not节点提供的简便方法批量创建Not原子节点。
 
5. 创建inst静态方法方便后续使用
 
6. 创建main方法执行验证
 
 
运行结果为:
 
0000_0001 取反即为:1111_1110.
 
 
7. 生成Verilog
生成定制化模块名:
 
调用toVerilog()方法生成Verilog实现。
 
执行结果如下:
 
 
原文地址:https://www.cnblogs.com/wjcdx/p/9705225.html