module top;
wire A,B,C,D;
system_clk
#50 clk1(D);
system_clk #100 clk2(C);
system_clk #200 clk3(B);
system_clk #400 clk4(A);
comparator c1 (A, B, C, D, F);
endmodule
module comparator(A, B, C, D, F);
input A, B, C, D;
output F;
wire f1,f2,f3,f4,f5,c1,c2,c3,c4;
not (c1 ,A);
not (c2 ,B);
not (c3 ,C);
not (c4 ,D);
and(f1,c1,c2,D);
and(f2,c1,B,c3,c4);
and(f3,c1,B,C,D);
and(f4,A,B,D);
and(f5,A,c2,C,c4);
or (F, f1, f2, f3, f4 ,f5);
endmodule
module system_clk(clk);
parameter period=100;
output clk;
reg clk;
initial
clk=0;
always
#(period/2)clk=~clk;
always@(posedge clk)
if($time>1000)
#(period-1)
$stop;
endmodule