实验一、五人表决器
(1)vote
①方案一
`timescale 1ns / 1ps
module vote5(
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 vote5(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;
end
endmodule
module test;
reg a;
猪肉包子
reg b;
reg c;
reg d;
reg e;
wire f;
vote5 uut (
.a(a),
.b(b),
.c(c),
.
d(d),
.e(e),
.f(f)
);
initial begin
a = 0;
b = 0;
c = 0;
天老地荒d = 0;
e = 0;
村庄儿女各当家#100 a = 1;
b = 0;
c = 0;
曹景豪d = 0;
e = 0;
党员个人评议
#100 a = 1;
b = 1;
c = 0;
d = 0;
e = 0;
桑葚酒的功效#100 a = 1;
b = 1;
c = 1;
d = 0;
e = 0;
#100 a = 1;
b = 1;
c = 1;
d = 1;
e = 0;
#100 a = 1;
b = 1;
c = 1;
d = 1;
e = 1;
end
endmodule
NET "a" LOC="P11"; NET "b" LOC="L3";
NET "c" LOC="K3"; NET "d" LOC="B4"; NET "e" LOC="G3"; NET "f" LOC="M5";