module key_8(led0,key);
output led0;
input [7:0]key;
reg [2:0]sum;
integer i;
reg pass;
always @(key)
begin
sum=0;
for(i=0;i<=7;i=i+1)
if(!key[i]) sum=sum+1;
if(sum[2]==1) pass=0;// 0 biao shi tong guo
else pass=1;
end
assign led0=pass;
endmodule
阅读(1167) | 评论(0) | 转发(0) |