2014年6月11日 星期三

考試

module top;

wire a,b,c,d;
wire out;

 system_clock #800 clock1(a);
 system_clock #400 clock2(b);
 system_clock #200 clock3(c);
 system_clock #100 clock4(d);

not n1(nota,a);
not n2(notb,b);
not n2(notc,c);
not n4(notd,d);
and a1(f1,nota,b,notc);
and a2(f2,a,notc,d);
and a3(f3,a,c,notd);
and a4(f4,notb,c,notd);
or  o0(out,f1,f2,f3,f4);

endmodule

module system_clock(clk);
parameter PERIOD=100;
output clk;
reg clk;
initial clk=0;
always
 begin
#(PERIOD/2) clk=~clk;
 end
always@(posedge clk)
 if($time>2000)$stop;
endmodule

沒有留言:

張貼留言