You are on page 1of 2
Source) TORR uae FA(A,B,. input A,B, cy uEpUE S,Cout; Kor »1(W1,A,B); ye *2(S,W1,C) | 82092, W2,C) ae a2 (W3,A,B); or 01/(Cout, Wi, W: de ean | | A test cane | | module three in two out: reg A,B,C; T wire) S,Cout; | | wire /W2,W2,W3;)||) /\{| (| FA FAA, 8, 6, 5,Cont) 2 | initial | | | \ begin | #100 A=1'bb; mia ha #100 A=1'bo; "pl; #100 "bo; #100 CHL'bi; #100 C=1'bO; #100 A'bl; #100 G=1'bo; #100 C1'b2; end anitial | #100 $£inish| initial | Smonivor (Sti AZIBECOAHAW File | Edit View Took 2)/ || pote HA (a,b, sum) Caley Ey 2 input a,b; | } 3 output sum, carry; 4 ‘xOor (sum, a,b); 5 and al (carry, a,b); it } 7 8 8 endmodule 1h) module FA_using HA(a, > e;am, carry) 7h] input a,b, 20 output sum, carry; at et 11 wire wl,w2,w3; NV 12 «HA HAL (a,b,w1,w3); 13 «HA HA2(wl,c, sum,w2); | 1s (carry, w2,w3)? 1s module | 16 Vi 17 // Writing Test Bench { | as | as | 20 1h 21 | { 22 23 | | 24 4 25 | 26 b=1'bO; o=1"bO; i 27 «#100 "b0; c=1'bil; \ ze #100 # =l'bl; e=1'bOz | | | 23 #100 7 b=1'bl; c=1'bl; | 30 #100 BL #100 32 #100 # BR1'bO; c=1'bO; | | be1'bO; c=l'bl; | | bel'bl; c#1'bo; | 33 #100 # b=l'bl; e=1'bl; WH) | \ 34 end | 2 (AVIRA 36 tial \ } 27 #100 stinish; | Anirial monitor ($time, " endmodule TW y ii a i * ‘ we Pun, Gate)

You might also like