2014年5月29日 星期四

2014/05/29上機考


module top;

wire a, b, c, d, f;
system_clock #400 clock1(a);
system_clock #200 clock2(b);
system_clock #100 clock2(c);
system_clock #50  clock2(d);

not a1(A,a);
not b1(B,b);
not c1(C,c);
not d1(D,d);
and f1(F1,A,B,d);
and f2(F2,A,c,d);
and f3(F3,b,C,D);
and f4(F4,a,C,D);
and f5(F5,B,c,d);
and f6(F6,a,b,D);
or  f (F,F1,F2,F3,F4,F5,F6);
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>1000)$stop;

endmodule

2014年5月8日 星期四

1014/5/9真值表

module top; system_clock #400 clock1(A); system_clock #200 clock1(B); system_clock #100 clock1(C); system_clock #50 clock1(D); number n1(F,A,B,C,D); endmodule module number(F,A,B,C,D); input A,B,C,D; output F; wire A1,B1,C1,D1,w1,w2,w3,w4; not(A1,A); not(B1,B); not(C1,C); not(D1,D); and(w1,A1,C1,D); and(w2,A1,C,D1); and(w3,B1,C1,D); and(w4,B1,C,D1); or(F,w1,w2,w3,w4); 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>1000) $stop; endmodule