Demo Code
Demo Code
DESIGNMODULE (Behavioral)
module Testbench_mux2x1();
module Gate_Level_Modeling_mux2x1(x1,x2,s,f);
//variable or port declaration
input x1,x2,s;
reg x1,x2,s;
output f; wire f;
end
DESIGNMODULE (Data Flow)
//generating the stimuli
module initial begin
Data_Flow_Modelling_Style_mux2x1(x1,x2,s,f);
s=1'b0; x1=1'b0; x2=1'b0;
input x1,x2,s; #5 x1=1'b1;
output f; #5 x1=1'b0;
#5 x2=1'b1;
endmodule
#5 x2=1'b0;
always@(x1,x2,s) #5 $finish;
end
begin
endmodule
if(s)
f=x2;
else if(!s)
f=x1;
end
endmodule