日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

三种方法用Verilog实现多人表决器

發布時間:2023/12/14 编程问答 46 豆豆
生活随笔 收集整理的這篇文章主要介紹了 三种方法用Verilog实现多人表决器 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
module biaojue( a,b,c,d,e,f); input a,b,c,d,e; output f; reg f; reg[2:0] count1; initial count1=0; always@(a,b,c,d,e) begin count1=a+b+c+d+e; f=count1<3?0:1;//當人數在三人以下是輸出1 end endmodule module biaojue5( input a,b,c,d,e, output f ); assign f=a&b&c||a&b&d||a&b&e||a&c&d||a&c&e|| a&d&e||b&c&d||b&c&e||b&d&e||c&d&e;//直接進行邏輯運算 endmodule module biaojue(a,out); input [5:0]a; output reg [1:0]out; integer i,count1,count2; always@(*)begincount1=0;count2=0;i=0;while(i<4)beginif(a[i])count1=count1+1;//決定通過的人數elsecount2=count2+1;//表決不通過的人數i=i+1;endif(count1==count2)out=2'b00;else if(count1<count2)out=2'b00;else if(count1>count2)out=2'b01;//或者用if一步實現end endmodule

三種表決器的實現方法。

總結

以上是生活随笔為你收集整理的三种方法用Verilog实现多人表决器的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。