You are on page 1of 7

HALF ADDER: Program for Half Adder: Module ha(a,b,c,s); Input a; Inputb; Output c; Output s; XOR x1(s,a,b); And

a1(c,a,b); End module;

output: Device utilization summary: Selected device Number of slices Number of 4 input LUTs Number of IOs Number of bonded IOBs : 3s400pq208-4 : 1 out of 3584 0% 2 out of 7168 0 % 4 4 out of 141 2%

: : :

Program: Full Adder: module ff(sum, carry, a, b, cin); output sum; output carry; input a; input b; input cin; wire p,q,r; xor x1(p,a,b); xor x2(sum,cin,p); and a1(q,a,b); and a2(cin,r,p); or r1(carry,q,r);

Device utilization summary: Selected device Number of slices Number of 4 input LUTs : Number of IOs : Number of bonded IOBs Program: Ripple Carry Adder: module ripple(x,y, ci, s, c0); input [3:0] x,y;

: 3s400pq208-4 : 1 out of 3584 0% 2 out of 7168 0 % 5 : 5 out of 141 3%

input ci; output [3:0] s; output c0; wire c1,c2,c3; single full add single full add single full add single full add endmodule

sfa1(s[0],c1,x[0],y[0],c0); sfa2(s[1],c2,x[1],y[1],c1); sfa3(s[2],c3,x[2],y[2],c2); sfa4(s[3],c4,x[3],y[3],c3);

Output: Device utilization summary: Selected device Number of slices Number of 4 input LUTs Number of IOs Number of bonded IOBs Program: Priority Encoder: module gg(d0, d1, d2, d3, x, y, v); input d0; input d1; input d2; input d3; output x; output y; output v; wire p,q; not n1(p,d2); or r1(x,d2,d3); and a1(q,p,d1); or r2(y,q,d3); or r3(v,d3,d2,d1,d0); endmodule : : : : : 3s400pq208-4 4 out of 3584 0% 8 out of 7168 0 % 14 14 out of 141 9%

OUTPUT: Device utilization summary: Selected device Number of slices Number of slice flip flops Number of 4 input LUTs Number of IOs Number of bonded IOBs IOB Flip Flops

: 3s400pq208-4 : 2 out of 3584 0% 2 out of 7164 0% : 3 out of 7168 0 % : 6 : 6 out of 141 4% : 2

Program Priority decoder : module jj(x, y, d0, d1, d2, d3); input x; input y; input d0; output d1; output d2; output d3; not n1(p,x); not n2(q,y); and a1(d0,p,q); and a2(d1,p,y); and a3(d2,x,q); and a4(d3,x,y); endmodule

Device utilization summary: Selected device Number of slices Number of 4 input LUTs Number of IOs Number of bonded IOBs Program: 2 to 1 MUX: module ss(s, a, b, y); input s; input a; input b; output y; wire p,q,r; not n1(p,s); and a1(q,b,s); and a2(r,q,p); or r1(y,q,r); endmodule

: : : : :

3s400pq208-4 2 out of 3584 0% 4 out of 7168 0 % 7 7 out of 141 4%

OUTPUT: Device utilization summary: Selected device Number of slices Number of 4 input LUTs Number of IOs : 3s400pq208-4 : 1 out of 3584 0% 1 out of 7168 0 % 4

: :

Number of bonded IOBs

4 out of 141 2%

Program: 4 : 1 MUX: module cc(s0, s1, i0, i1, i2, i3, y); input s0; input s1; input i0; input i1; input i2; input i3; output y; wire p,q,r,s,t,u; not n1(p,s1); not n2(q,s0); and a1(r,i0,p,q); and a2(g,i,p,s0); and a3(b,i2,s,q); or x1(y,r,s,b,u); endmodule OUTPUT: Device utilization summary: Selected device Number of slices Number of 4 input LUTs Number of IOs Number of bonded IOBs Program: 4-bit magnitude comparator: module pp(p, q, a, b, c); input [1:0] p; input [1:0] q; output a; output b; output c; reg a,b,c; always @ (p,q) begin if(p==q) a=1; else if(p>q) b=1; else c=1; end endmodule Output: Device utilization summary: Selected device : 3s400pq208-4 : : : 3s400pq208-4 : 1 out of 3584 0% 2 out of 7168 0 % 7 : 7 out of 141 4%

Number Number Number Number

of of of of

slices 4 input LUTs IOs bonded IOBs

: :

: 4 out of 3584 0% 7 out of 7168 0 % 11 : 11 out of 141 7%

Program: D Flip Flop: module DFF(D, clk, Q); input D; input clk; output Q; reg Q; always @(clk) Q=D; endmodule

OUTPUT: Device utilization summary: Selected device Number of slices Number of slice flip flops Number of 4 input LUTs Number of IOs Number of bonded IOBs IOB Flip Flops Number of GCLKs Program: Shift Register: module sht(q, w, load, clk, R); output [3:0] q; input w; input load; input clk; input [3:0] R; reg[3:0]q; always @(clk) if(clk) q<=R; else if(clk) begin q[0]<=w; q[1]<=q[0]; q[2]<=q[1]; q[3]<=q[2]; end endmodule : 3s400pq208-4 : 1 out of 3584 0% 1 out of 7164 0% : 1 out of 7168 0 % : 3 : 3 out of 141 2% : 1 : 1 out of 8 12%

OUTPUT: Device utilization summary: Selected device Number of slices Number of slice flip flops Number of IOs Number of bonded IOBs IOB Flip Flops Number of GCLKs Program: Up Counter: module zz(reset, en, clk, q); input reset; input en; input clk; output [03:0] q; reg[3:0]q; always @(en) if(!reset) q<=0; else if(en) q<=q+1; endmodule : : : : : : : 3s400pq208-4 0 out of 3584 0% 4 out of 7164 0% 7 7 out of 141 4% 4 1 out of 8 12%

Device utilization summary: Selected device Number of slices Number of slice flip flops Number of 4 input LUTs Number of IOs Number of bonded IOBs Number of GCLKs Program: Down Counter: module jkjk(count, clk, en, Q); input count; input clk; input en; output [3:0] Q; reg[3:0] Q; always @(en) if(!count) Q<=1; else if (en) Q<=Q-1; Endmodule

: 3s400pq208-4 : 2 out of 3584 0% 4 out of 7164 0% : 4 out of 7168 0% : 7 : 7 out of 141 4% : 1 out of 8 12%

OUTPUT: Device utilization summary: Selected device Number of slices Number of slice flip flops Number of 4 input LUTs Number of IOs Number of bonded IOBs Number of GCLKs : 3s400pq208-4 : 2 out of 3584 0% 4 out of 7164 0% : 4 out of 7168 0% : 7 : 7 out of 141 4% : 1 out of 8 12%

You might also like