由三人表决器的功能可知,有三个输入量,当输入量中1的数量大于等于两个时,变量输出结果为1
源程序代码
`timescale 1ns / 1ps
module test1(
input a,
input b,
input c,
output f
);
assign f=a&b|a&c|b&c ; //f=ab+ac+bc
endmodule
仿真代码
`timescale 1ns / 1ps
module test11;
reg a,b,c;
wire f;
test1 uut(a,b,c,f);
initial begin
a=0;b=0;c=0;
end
always #10 {a,b,c}={a,b,c}+1;
endmodule