组合电路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中的加法器(半加器,全加器