Verilog code
to implement the function f(A,B,C,D) = Σm(1,4,7,14,15)+
d(0,5,9)
module func_manu(a,b,c,d,y);
input a,b,c,d;
output y;
assign y=((~a&~c)|((b&c)&(a|b)));
endmodule
TESTBENCH
module func_tb();
reg A,B,C,D;
wire Y;
func_manu F1(A,B,C,D,Y);
initial
begin
A=0; B=0; C=0;
D=0;
#50; A=0; B=0;
C=0; D=1;
#50; A=0; B=0;
C=1; D=0;
#50; A=0; B=0;
C=1; D=1;
#50; A=0; B=1;
C=0; D=0;
#50; A=0; B=1;
C=0; D=1;
#50; A=0; B=1;
C=1; D=0;
#50; A=0; B=1;
C=1; D=1;
#50; A=1; B=0;
C=0; D=0;
#50; A=1; B=0;
C=0; D=1;
#50; A=1; B=0;
C=1; D=0;
#50; A=1; B=0;
C=1; D=1;
#50; A=1; B=1;
C=0; D=0;
#50; A=1; B=1;
C=0; D=1;
#50; A=1; B=1;
C=1; D=0;
#50; A=1; B=1;
C=1; D=1;
#250 $finish;
end
endmodule
No comments:
Post a Comment