带优先级的三人表决器
生活随笔
收集整理的這篇文章主要介紹了
带优先级的三人表决器
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 設計要求:設計一個三人表決器,有3個裁判,其中有1位主裁判,2位副裁判。主裁判有否決權,即主裁判和其中一位副裁判投贊同票,決議方可通過,否則不通過。
注意:如果有了其中一人投贊同票就可以單票通過那就是決定權,如果必須有其中一人投贊同票才可以通過那就是否決權。
2 設計代碼如下:
module vote3_pr0(input wire a,input wire b,input wire c,output reg y );always@(*)beginif((a == 1'b0)&&((b == 1'b0)||(c == 1'b0)))y = 1'b1;elsey = 1'b0;endendmodule仿真測試代碼如下:
`timescale 1ns/1psmodule vote3_pro_tb();reg a;reg b;reg c;wire y;vote3_pro vote3_pro_inst(.a (a),.b (b),.c (c),.y (y));initial begina = 0; b = 0; c = 1; #20;a = 0; b = 0; c = 0; #20;a = 0; b = 1; c = 1; #20;a = 0; b = 1; c = 0; #20;a = 1; b = 0; c = 1; #20;a = 1; b = 0; c = 0; #20;a = 1; b = 1; c = 1; #20;a = 1; b = 1; c = 0; #20;$stop;endendmodule仿真波形如下:
總結
以上是生活随笔為你收集整理的带优先级的三人表决器的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android-网络编程:快乐词典
- 下一篇: java 校验一个字符串是否是手机号码