module top;
wire enable,data;
wire q_out;
system_clock #200 clock1(enable);
system_clock #100 clock2(data);
latch abc(q_out,enable,data);
endmoduleprimitive latch(q_out,enable,data);
output q_out;
input enable,data;
reg q_out;
table
.........
module aaa;
wire a,b,c,d;
wire c_out;
system_clock #800 clock(a);
system_clock #400 clock(b);
system_clock #200 clock(c);
system_clock #100 clock(d);
xxx t(c_out,a,b,c,d);
endmodule
module xxx(c_out,a,b,c,d);
input a,b,c,d;
output c_out;
wire w1,w2,w3,w4,w5,w6,a_bar,b_bar,c_bar,d_bar;
not(a_bar,a);
not(b_bar,b);
not(c_bar,c);
not(d_bar,d);
and(w1,a_bar,b_bar,c_bar,d);
and(w2,a,b,d);
and(w3,b,c,d);
and(w4,a,c,d);
and(w5,a_bar,c,d_bar);
and(w6,a,b_bar,c);
or(c_out,w1,w2,w3,w4,w5,w6);
endmodulemodule system_clock(clk);
parameter PERIOD=100;
output clk;
reg clk;
initialclk=0;
always
begin
#(PERIOD/2) clk=~clk;
#(PERIOD/2) clk=~clk;
end
always@(posedge clk)
if($time>1000)#(PERIOD-1)$stop;
endmodule
module top;
wire f,c_bar,d,e,f0,f1;
reg a,b,c;
initial
begin
#10 a=1; b=1;
#10 c=1;
#10 c=0;
endinitial
#100 $finish;
AND_gate xxx(f0,a,c);
NOT xxx1(c_bar,c);
AND_gate xxx2(f1,b,c_bar);
or_data xx(f,f0,f1);
AND_gate xxx3(f3,a,b);
AND_gate xxx(f4,a,c);
AND_gate xxx2(f5,b,c_bar);
or_data2 xx1(f2,f3,f4,f5);
endmodule
............