Professional Documents
Culture Documents
Table of components for building the schematic Library name gpdk180 gpdk180 Cell Name pmos nmos Properties W=2u, L=180n W=2u, L=180n
Table of components for building the Test schematic Library name analogLib analogLib Cell Name vpulse vdc, gnd Properties V1=0, V2=1.8, Period=20n, Pulsewidth=10n Vdc=1.8
Table of values to setup for different analysis Analysis name Transient Settings tran DC Analysis Sweep Variable Component Parameter Sweep Rage Start-Stop Sweep 1 Range Type Step Control Properties Stop time = 200n , moderate Save DC Operating Point Component Name=Select input signal component (Name of Vpulse) Parameter Name =dc Start = 0, Stop = 1.8 Variable Name = wp From=1u, To=10u Total Steps=10
DC
Parametric
Table of components for building the Layout Connection Metal1 Poly Metal 1 Psubstrate Metal1 Nwell Contact Type Metal1 - Poly Metal1 Psub Metal1 Nwell
Table of components for building the schematic Library name gpdk180 gpdk180 Cell Name pmos nmos Properties W=50u, L=1u W=10u, L=1u
Table of components for building the Test schematic Library name analogLib analogLib Cell Name vsin vdc, gnd Properties AC Magnitude = 1; DC Voltage=0; Offset Voltage=0; Amplitude=5m or 5u; Frequency=1K VDD : vdc = 2.5; VSS : vdc = -2.5
Table of values to setup for different analysis Analysis name Transient Settings tran DC Analysis Sweep Variable Component Parameter Sweep Range Start-Stop Sweep Range Start-Stop Sweep Type Properties Stop time = 5m , moderate Save DC Operating Point Component Name=Select input signal component (Name of VSIN) Parameter Name =dc Start = -5, Stop = 5 Start = 100; Stop = 100M Automatic
DC
AC
Table of components for building the schematic Library name gpdk180 gpdk180 Cell Name nmos nmos Properties W=50u, L=1u W=10u, L=1u
Table of components for building the Test schematic Library name analogLib analogLib Cell Name vsin vdc, gnd Properties AC Magnitude = 1; DC Voltage=0; Offset Voltage=0; Amplitude=5m or 5u; Frequency=1K VDD : vdc = 2.5; VSS : vdc = -2.5
Table of values to setup for different analysis Analysis name Transient Settings tran DC Analysis Sweep Variable Component Parameter Sweep Rage Start-Stop Sweep Rage Start-Stop Sweep Type Properties Stop time = 5m , moderate Save DC Operating Point Component Name=Select input signal component (Name of VSIN) Parameter Name =dc Start = -5, Stop = 5 Start=100; Stop=100M Automatic
DC
AC
Table of components for building the schematic Library name gpdk180 gpdk180 gpdk180 Cell Name pmos nmos nmos Properties W=15u, L=1u (PM0, PM1) W=3u, L=1u (NM0, NM1) W=4.5u, L=1u (NM2, NM3)
Table of components for building the Test schematic Library name analogLib analogLib analogLib Cell Name vsin vdc, gnd Idc Properties AC Magnitude = 1; DC Voltage=0; Offset Voltage=0; Amplitude=5m; Frequency=1K VDD : vdc = 2.5; VSS : vdc = -2.5 DC current = 30u
Table of values to setup for different analysis Analysis name Transient Settings tran DC Analysis Sweep Variable Component Parameter Sweep Rage Start-Stop Sweep Range Start-Stop Sweep Type Properties Stop time = 5m , moderate Save DC Operating Point Component Name=Select input signal component (Name of VSIN) Parameter Name =dc Start = -5, Stop = 5 Start=100; Stop=100M Automatic
DC
AC
Table of components for building the schematic Library name gpdk180 gpdk180 gpdk180 gpdk180 gpdk180 Cell Name pmos pmos nmos nmos nmos Properties W=15u, L=1u (PM0, PM1) W=50u, L=1u (PM2) W=3u, L=1u (NM0, NM1) W=4.5u, L=1u (NM2, NM3) W=15u, L=1u (NM4)
Table of components for building the Test schematic Library name analogLib analogLib analogLib Cell Name vsin vdc, gnd Idc Properties AC Magnitude = 1; DC Voltage=0; Offset Voltage=0; Amplitude=5u; Frequency=1K VDD : vdc = 2.5; VSS : vdc = -2.5 DC current = 30u
Table of values to setup for different analysis Analysis name Transient Settings tran DC Analysis Sweep Variable Component Parameter Sweep Range Start-Stop Sweep Range Start-Stop Sweep Type Logarithemic Properties Stop time = 5m , moderate Save DC Operating Point Component Name=Select input signal component (Name of VSIN) Parameter Name =dc Start = -5; Stop = 5 Start=100; Stop=100M Points per decade = 20
DC
AC
Table of components for building the schematic Library name gpdk180 gpdk180 analogLib Cell Name polyres Polyres Idc, gnd Properties R = 2k R = 1k Idc = 30u
Table of components for building the Test schematic Library name analogLib Cell Name vpulse Properties D0: V1=0, V2=1.8, Period=20u, Pulsewidth=10u D1: V1=0, V2=1.8, Period=40u, Pulsewidth=20u D2: V1=0, V2=1.8, Period=80u, Pulsewidth=40u D3: V1=0, V2=1.8, Period=160u, Pulsewidth=80u VDD : vdc = 2.5; VSS : vdc = -2.5 DC current = 30u
analogLib analogLib
Table of values to setup for different analysis Analysis name Transient Settings tran Properties Stop time = 5m , moderate
// Instantiate pmos and nmos switches to form Inv pmos (out,pwr,nout); nmos (out,gnd,nout); endmodule
// Testbench for And Module module and_test; wire out ; reg in1,in2 ; // Instantiate And Gate Module andgate a1 ( out, in1, in2 ) ;
// Display task display ; begin $display ( "time=%0d" " Input1=" " Input2=" " Output=" end endtask // Apply Stimulus initial begin in1 in1 in1 in1 end endmodule
, , , ,
= = = =
; ; ; ;
= = = =
; ; ; ;
; ; ; ;
; ; ; ;
//Define our own Nand Gate, module nandgate ( out , in1 , in2 ); // Declarations of I/O ,Power and Ground Lines output out; input in1,in2; supply1 pwr; supply0 gnd; // Declaration of Wire wire contact; // Instantiate pmos and nmos switches pmos pmos nmos nmos (out,pwr,in1); (out,pwr,in2); (out,contact,in1); (contact,gnd,in2);
endmodule
// Testbench for Nand Gate Module module nand_test; wire out ; reg in1,in2 ;
// Display task display ; begin $display ( "time=%0d" , " Input1=" , " Input2=" , " Output=" ) ; end endtask // Apply Stimulus initial begin in1 in1 in1 in1 end endmodule
, , , ,
= = = =
; ; ; ;
= = = =
; ; ; ;
; ; ; ;
; ; ; ;
//Define our own Nor Gate, module norgate ( out , in1 , in2 ); // Declarations of I/O ,Power and Ground Lines output out; input in1,in2; supply1 pwr; supply0 gnd; // Declaration of Wire wire contact; // Instantiate pmos and nmos switches pmos pmos nmos nmos (contact,pwr,in1); (out,contact,in2); (out,gnd,in1); (out,gnd,in2);
endmodule
// Testbench for Nor Gate Module module nor_test; wire out ; reg in1,in2 ;
// Display task display ; begin $display ( "time=%0d" , " Input1=" , " Input2=" , " Output=" ) ; end endtask // Apply Stimulus initial begin in1 in1 in1 in1 end endmodule
, , , ,
= = = =
; ; ; ;
= = = =
; ; ; ;
; ; ; ;
; ; ; ;
//Define our own Or Gate, module orgate ( out , in1 , in2 ); // Declarations of I/O ,Power and Ground Lines output out; input in1,in2; supply1 pwr; supply0 gnd; // Declaration of Wires wire contact; wire nout; // Instantiate pmos and nmos switches for Nor gate pmos pmos nmos nmos (contact,pwr,in1); (nout,contact,in2); (nout,gnd,in1); (nout,gnd,in2);
// Instantiate pmos and nmos switches for Not gate pmos (out,pwr,nout); nmos (out,gnd,nout); endmodule
// Testbench for Or Gate Module module or_test; wire out ; reg in1,in2 ;
// Display task display ; begin $display ( "time=%0d" , " Input1=" , " Input2=" , " Output=" ) ; end endtask // Apply Stimulus initial begin in1 in1 in1 in1 end endmodule
, , , ,
= = = =
; ; ; ;
= = = =
; ; ; ;
; ; ; ;
; ; ; ;
//Define our own XNOR Gate, module xnorgate ( out , in1 , in2 ); // Declarations of I/O ports output out; input in1,in2; wire in2bar; assign in2bar = ~in2; // Instantiate pmos and nmos switches : pmos nmos pmos nmos (out,in2bar,in1); (out,in2,in1); (out,in1,in2bar); (out,in1,in2);
endmodule
// Testbench for Xnor Module module xnor_test; wire out ; reg in1,in2 ;
// Display task display ; begin $display ( "time=%0d" , " Input1=" , " Input2=" , " Output=" ) ; end endtask // Apply Stimulus initial begin in1 in1 in1 in1 end endmodule
, , , ,
= = = =
; ; ; ;
= = = =
; ; ; ;
; ; ; ;
; ; ; ;
//Define our own XOR Gate, module xorgate ( out , in1 , in2 ); // Declarations of I/O ports output out; input in1,in2; wire in2bar; assign in2bar = ~in2; // Instantiate pmos and nmos switches : pmos nmos pmos nmos (out,in2,in1); (out,in2bar,in1); (out,in1,in2); (out,in1,in2bar);
endmodule
// Testbench for Xor Module module xor_test; wire out ; reg in1,in2 ;
// Display task display ; begin $display ( "time=%0d" , " Input1=" , " Input2=" , " Output=" ) ; end endtask // Apply Stimulus initial begin in1 in1 in1 in1 end endmodule
, , , ,
= = = =
; ; ; ;
= = = =
; ; ; ;
; ; ; ;
; ; ; ;
//Define our own Inverter, module inverter ( out , in ); // Declarations of I/O ,Power and Ground Lines output out; input in; supply1 pwr; supply0 gnd; // Instantiate pmos and nmos switches pmos (out,pwr,in); nmos (out,gnd,in); endmodule
// Display task display ; begin $display ( "time=%0d" , $time , " ns" , " Input=" , in , " Output=", out ) ; end endtask // Apply Stimulus initial begin in = in = in = in = end endmodule
; ; ; ;
; ; ; ;
; ; ; ;
//Define our own Inverter, (BUFFER) module inverter ( Y, A ); // Declarations of I/O ,Power and Ground Lines output Y; input A; supply1 pwr; supply0 gnd; // Instantiate pmos and nmos switches pmos (Y,pwr,A); nmos (Y,gnd,A); endmodule // Define our own Buffer module buffer ( out, in ); // Declarations of I/O Lines output out; input in; // Wire Declaration wire a; // Instantiate Inverter module inverter i1 (a,in); inverter i2 (out,a); endmodule
// Testbench for Buffer Module module buf_test; wire out ; reg in ; // Instantiate Buffer Module buffer b1 ( out, in ) ; // Display task display ; begin $display ( "time=%0d" , $time , " ns" , " Input=" , in , " Output=", out ) ; end endtask // Apply Stimulus initial begin in = in = in = in = end endmodule
; ; ; ;
; ; ; ;
; ; ; ;
//Define our own Transmission Gate, module trangate ( out , in , cntrl1, cntrl2 ); // Declarations of I/O and Control Lines output out; input in; input cntrl1,cntrl2; // Instantiate pmos and nmos switches pmos (out,in,cntrl1); nmos (out,in,cntrl2); endmodule
// Testbench for trangate Module module trangate_test; wire out ; reg in ; reg cntrl1,cntrl2; // Instantiate trangate Module trangate t1 ( out, in, cntrl1, cntrl2 ) ; // Display task display ; begin $display ( "time=%0d" , $time , " ns" , " Input=" , in , " Output=", out , " Control1=",cntrl1 , " Control2=",cntrl2 ) ; end endtask // Apply Stimulus initial begin in = in = in = in = end endmodule
; ; ; ;
= = = =
; ; ; ;
= = = =
; ; ; ;
; ; ; ;
; ; ; ;
//Define our own D-Flip Flop Module module d_ff(q,clk,n_rst,din); output q; input clk,din,n_rst; reg q; always @(posedge clk or negedge n_rst) begin if(!n_rst) q <= 1'b0; else q <= din; end endmodule // Testbench for D-Flip Flop Module module dff_test; reg clk,n_rst,din; wire q; d_ff inst(q,clk,n_rst,din); task display; begin $display("time=%0d",$time,"ns", " n_rst=",n_rst," din=",din," q=",q); end endtask initial clk = 1'b0; always #5 clk = ~clk; initial begin n_rst=1'b0;din=1'b1;#10;display; n_rst=1'b1;din=1'b1;#10;display; din=1'b0;#10;display; din=1'b1;#10;display; n_rst=1'b0;din=1'b1;#10; display; n_rst=1'b1;din=1'b1;#10;display; end initial #70 $finish; endmodule
//Define our own JK-Flip Flop Module module jk_ff(q,qbar,clk,rst,j,k); input clk,rst,j,k; output q,qbar; reg q; always @(posedge clk or negedge rst) begin if (!rst) begin q <= 1'b0; end else begin if (j == 1'b1 && k == 1'b0) begin q <=1'b1; end else if (j == 1'b0 && k == 1'b1) begin q <=1'b0 ; end else if (j == 1'b1 && k == 1'b1) begin q <=~q; end end end assign qbar=~q; endmodule
// Testbench for JK-Flip Flop Module module jk_ff_test; reg clk,rst,j,k; wire q,qbar; jk_ff inst(q,qbar,clk,rst,j,k); task display; begin $display("time=%0d",$time,"ns", " rst=",rst," j=",j," k=",k," q=",q," qbar=",qbar); end endtask initial clk = 1'b0; always #5 clk = ~clk; initial begin rst=0;j=1;k=0;#10;display; rst=1;j=1;k=0;#10;display; j=0;k=0;#10;display; j=0;k=1;#10;display; j=1;k=1;#10;display; j=1;k=1;#10;display; #10; end initial #70 $finish; endmodule
//Define our own MS D-Flip Flop Module module ms_dff(q2,q2bar,q1,clk,d); output q2,q2bar,q1; input clk,d; reg q1,q2; always @(clk) begin if (clk) begin q1<=d; end else if(!clk) begin q2 <= q1; end end assign q2bar=~q2; endmodule
// Testbench for MS D-Flip Flop Module module msdff_test; reg clk,d; wire q2,q2bar,q1; ms_dff inst(q2,q2bar,q1,clk,d); task display; begin $display(" d=",d," time=%0d",$time,"ns", " clk=",clk," q1=",q1," q2=",q2," q2bar=",q2bar); end endtask initial clk = 1'b1; always #5 clk = ~clk; initial d=1'b0; always #18 d=~d; initial begin #5;display; #5;display; #5;display; #5;display; #5;display; #5;display; #5;display; #5;display; #5;display; #5;display; #5;display; #10 ; end initial #70 $finish; endmodule
//Define our own SR-Flip Flop Module module sr_ff(q,qbar,s,r,clk,rst); output q,qbar; input clk,rst,s,r; reg q; always @(posedge clk or negedge rst) begin if (!rst) q <= 1'b0; else if q else if q else if q else if q (s <= (s <= (s <= (s <= == 1'b0 q; == 1'b0 1'b0; == 1'b1 1'b1; == 1'b1 1'bx; && r == 1'b0) && r == 1'b1) && r == 1'b0) && r == 1'b1)
// Testbench for SR-Flip Flop Module module sr_ff_test; reg clk,rst,s,r; wire q,qbar;
sr_ff sr1(q,qbar,s,r,clk,rst); task display; begin $display("time=%0d",$time,"ns", " rst=",rst," s=",s," r=",r," q=",q," qbar=",qbar); end endtask initial clk = 1'b0; always #5 clk = ~clk; initial begin rst=0;s=1;r=0;#10;display; rst=1;s=1;r=0;#10;display; s=0;r=0;#10;display; s=0;r=1;#10;display; s=1;r=1;#10;display; end initial #70 $finish; endmodule
//Define our own Ripple counter Module //RIPPLE COUNTER module ripcount(clk,rst,cnt); input clk,rst; output [3:0]cnt; tff T0(cnt[0],clk,rst); tff T1(cnt[1],cnt[0],rst); tff T2(cnt[2],cnt[1],rst); tff T3(cnt[3],cnt[2],rst); endmodule module tff(q,clk,rst); output q; input clk,rst; reg tq; always@(negedge clk or posedge rst) begin if(rst) tq<=1'b0; else tq<=~tq; end assign q=tq; endmodule // Testbench for Ripple Counter Module module ripcount_test; reg clk,rst; wire [3:0]cnt; ripcount r1(clk,rst,cnt); initial clk=1'b0; always #5 clk =~clk; initial begin rst=1'b1; #10 rst=1'b0; #200 $finish; end initial $monitor($time,"output q=%h",cnt); endmodule
//Define our own Synchronous Counter Module module counter_behav ( count,reset,clk); input wire reset, clk; output reg [3:0] count; always @(posedge clk) if (reset) count <= 4'b0000; else count <= count + 4'b0001; endmodule // Testbench for Synchronous Counter Module module sycounter_t ; wire [3:0] count; reg reset,clk; initial clk = 1'b0; always #5 clk = ~clk; counter_behav m1 ( count,reset,clk); initial begin reset = 1'b0 ; #15 reset =1'b1; #30 reset =1'b0; #200 $finish; end initial $monitor ($time, endmodule "Output count = %d ",count );
//Define our own Serial Adder Module module serial_adder2 (a, b, start, clock, ready, result); input a, b, start, clock; output ready; output [7:0] result; reg serial_sum, carry_in, carry_out, counting; reg [3:0] count; reg [7:0] parallel; parameter limit = 8;
always @(negedge clock) begin if(start) begin count = 3'b0; parallel = 8'b0; carry_in = 1'b0; counting = 1'b1; end else begin // adding {carry_out,serial_sum} = a + b + carry_in ; carry_in = carry_out; //shifting if(counting) parallel = {serial_sum, parallel [7:1]}; // counting if (count==limit-1) counting = 0; else
counting = 1; if (count < limit-1) count = count + 1; end end assign ready = ~ counting; assign result = parallel ; endmodule // Testbench for Serial Adder Module module test_serial_adder2; reg a, b, start, clock; wire ready; wire [7:0] result; serial_adder2 u1(a, b, start, clock, ready, result); initial begin clock = 1'b1; a = 1'b0; b = 1'b1; #05 start = 1'b1; #11 start = 1'b0; #54 $finish; end always #2 clock = ~ clock; always #3.1 a = ~ a; always #5.1 b = ~ b; endmodule
//Define our own Successive Approximation Register Module module sar(clk,start,ready,indata,bindata); input [31:0]indata; input clk,start; output ready; output [7:0]bindata; reg [7:0]outdata; reg convert; integer res; parameter limit=8; integer i,j; always@(negedge clk) begin if(start) begin outdata=8'b0; i=1; convert=1'b1; end else begin if(convert) begin outdata[limit-i]=1'b1; res=0; for(j=0;j<=7;j=j+1) begin if(outdata[j]==1) res=res+2**j; end if(res>indata) outdata[limit-i]=1'b0; end i=i+1; if(i>limit+1) convert=0; else convert=1; end end assign ready=~convert; assign bindata=outdata; endmodule
// Testbench for Successive Approximation Register Module module sar_t; reg clk; reg [31:0]indata; reg start; wire [7:0]binout; sar s(clk,start,ready,indata,binout); initial begin clk=1'b1; indata=170; #05 start=1'b1; #11 start=1'b0; #50 $finish; end always #2 clk=~clk; endmodule