星期五, 4月 14, 2006

Add_Full

程式碼
module top;
reg a,b,c_in;
wire sum,c_out,w1,w2,w3;
Add_half M1(w1,w2,a,b);
Add_half M2(sum,w3,w1,c_in);
or(c_out,w2,w3);
initial
begin
a=0;
b=0;
c_in=0;
#2000 $finish;
end
always
#200 c_in=~c_in;
always
#50 a=~a;
always
#100 b=~b;
endmodul
emodule Add_half(sum,c_out,a,b);
input a,b;
output sum,c_out;
xor (sum,a,b);
nand (c_out_bar,a,b);
not (c_out,c_out_bar);
endmodule
===================================================================
經過多次歷練
現在對程式也有一定了解
寫程式的速度也越來越快
這次的全加器在不了解的地方
也很快就解決了
這次用2個半加器合成一個全加器
滿有意思的

0 Comments:

張貼留言

<< Home