用循环语句设计一个7人投票表决器

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

module wugangsi(in,out,temp,en); input [6:0] in;

input en;

output out;

output[3:0]temp;

integer i;

reg [3:0]temp;

assign out=((temp>=4)?1:0); always@(*)begin

if(en)begin

temp=4'b0000;

for(i=0;i<7;i=i+1)

begin

if(in[i])

temp=temp+1;

else

temp=temp;

end

end end

endmodule

相关文档
最新文档