组合电路Verilog的几种描述方式
生活随笔
收集整理的这篇文章主要介绍了
组合电路Verilog的几种描述方式
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
组合电路的描述方式主要有四种:真值表,逻辑代数,结构描述,抽象描述。
设计一个三输入多数表决器。
1.真值表方式:
A | B | C | Y |
0 | 0 | 0 | 0 |
0 | 0 | 1 | 0 |
0 | 1 | 0 | 0 |
0 | 1 | 1 | 1 |
1 | 0 | 0 | 0 |
1 | 0 | 1 | 1 |
1 | 1 | 0 | 1 |
1 | 1 | 1 | 1 |
真值表描本质上是最小项的表达式。
2.逻辑代数方式:
从真值表可以得出逻辑函数表达式为:out=AB+AC+BC。
module design2(input A,B,C,output out ); assign out=(A&B)|(A&C)|(B&C); endmodule3.结构描述方式:
结构描述方式是对电路最直接的表达。
module design3(input A,B,C,output out ); and U1(w1,A,B); and U2(w2,B,C); and U3(w3,A,C); or U4(out,w1,w2,w3); endmodule4.抽象描述方式:
直接从功能出发,三输入多数表决器,将三个输入相加之和大于1,即表示多数表决了。
module design4(input A,B,C,output out ); wire [1:0] sum; reg out; assign sum=A+B+C; always @(*)beginout=(sum>1)?1'b1:1'b0; end endmodule总结
以上是生活随笔为你收集整理的组合电路Verilog的几种描述方式的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: Verilog如何避免Latch
- 下一篇: Verilog中的加法器(半加器,全加器