Creating Basic Analog Components: Inverter - Lab 2 | ECE 126, Lab Reports of Electrical and Electronics Engineering

Material Type: Lab; Professor: Farmer; Class: Laboratory; Subject: Electrical & Computer Engring; University: George Washington University; Term: Unknown 1989;

Typology: Lab Reports

Pre 2010

Uploaded on 08/18/2009

koofers-user-ner
koofers-user-ner 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE 126 – VerilogA Tutorial: Creating Basic Analog Components: Inverter
Created at GWU by Thomas Farmer
Objectives:
Create an inverter using verilogA
Assumptions:
Student has successfully completed ECE 128 Lab 2 – Creating a resistor
Part I: Modeling a inverter in VerilogA:
1. Start the Cadence Virtuoso Framework
2. Select the ece128 Library from the Library Manager, create a new Cell:
File → New → Cellview
Name: inv
Type: VerilogA
3. Type the following code to model an inverter that uses a 5V power supply and has a
threshold voltage of 2.5V:
`include “constants.vams”
`include “disciplines.vams”
module inv (vout, vin);
electrical vout, vin;
parameter real vlogic_high = 5; // 5V Vdd
parameter real vlogic_low = 0; // 0V Vss
parameter real vtrans = 2.5; // threshold voltage
parameter real tdel=0.1n from [0:inf);// the bracket is not a typo
parameter real trise=0.1n from (0:inf);
parameter real tfall=0.1n from (0:inf);
real vout_val;
integer logic1;
analog begin
logic1 = V(vin) > vtrans;
@ (cross(V(vin) – vtrans, 1)) logic1 = 1;
@ (cross(V(vin) – vtrans, -1)) logic1 =0;
vout_val=(!logic1) ? vlogic_high: vlogic_low;
V(vout) <+ transition (vout_val, tdel, trise, tfall);
end
endmodule
4. Save and exit the editor, allow cadence to compile the verilogA code, correct any errors
5. Create a test bench cell called: inv_tb
Use a pulsed source (vpulse) and a 5ns transient simulation to test your inverter
View the output in spectre's waveform viewer and verify the inverter is working
properly
6. Read below to “understand” the verilogA code you've typed up above.
pf3

Partial preview of the text

Download Creating Basic Analog Components: Inverter - Lab 2 | ECE 126 and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity!

ECE 126 – VerilogA Tutorial: Creating Basic Analog Components: Inverter Created at GWU by Thomas Farmer Objectives:

  • Create an inverter using verilogA Assumptions :
  • Student has successfully completed ECE 128 Lab 2 – Creating a resistor Part I: Modeling a inverter in VerilogA:
  1. Start the Cadence Virtuoso Framework
  2. Select the ece128 Library from the Library Manager, create a new Cell: File → New → Cellview Name: inv Type: VerilogA
  3. Type the following code to model an inverter that uses a 5V power supply and has a threshold voltage of 2.5V: include “constants.vams”include “disciplines.vams” module inv (vout, vin); electrical vout, vin; parameter real vlogic_high = 5; // 5V Vdd parameter real vlogic_low = 0; // 0V Vss parameter real vtrans = 2.5; // threshold voltage parameter real tdel=0.1n from [0:inf);// the bracket is not a typo parameter real trise=0.1n from (0:inf); parameter real tfall=0.1n from (0:inf); real vout_val; integer logic1; analog begin logic1 = V(vin) > vtrans; @ (cross(V(vin) – vtrans, 1)) logic1 = 1; @ (cross(V(vin) – vtrans, -1)) logic1 =0; vout_val=(!logic1)? vlogic_high: vlogic_low; V(vout) <+ transition (vout_val, tdel, trise, tfall); end endmodule
  4. Save and exit the editor, allow cadence to compile the verilogA code, correct any errors
  5. Create a test bench cell called: inv_tb ◦ Use a pulsed source (vpulse) and a 5ns transient simulation to test your inverter ◦ View the output in spectre's waveform viewer and verify the inverter is working properly
  6. Read below to “understand” the verilogA code you've typed up above.

This is a line by line breakdown of the meaning of the verilog-a code: We would like to have 2 arguments for our inverter: an input and an output. Let us call them "vin" and "vout". The arguments of the module can be indicated by placing them inside parenthesis next to "inverter2". module inv (vout, vin); We also need to define these pins as electrical ports. electrical vout, vin; We want the inverter to change as the input crosses a certain threshold. We will define this parameter as "vtrans". We also want to define delay, rise, and fall time characteristics of the inverter. These parameters will be called "tdel", "trise", and "tfall". To incorporate these factors of an inverter, we will use the transition filter for the output. The transition filter will be explained later in this tutorial. For now though, let us define these parameters using the "parameter real" statement. Also, each of these statements need to have a time period where their value holds true. In other words, following the definition, the statement "from (0:inf)" (from 0 to infinity) needs to be included in order to define the specific value from 0 to infinity seconds. parameter real vlogic_high = 5; parameter real vlogic_low=0; parameter real vtrans = 2.5; parameter real tdel=0.1n from [0:inf); parameter real trise=0.1n from (0:inf); parameter real tfall=0.1n from (0:inf); The last parameter we need to define is the output value that we want the output of the inverter to transition to using the parameters above. real vout_val; Now that we have defined everything, we need to set up the main equations (the meat of the code). This part of the code needs to lie within the analog block. Since we will need more than one line to write the main equations, a begin and end statement are needed. analog begin // Main equations here end analog begin logic1 = V(vin) > vtrans; @ (cross(V(vin) - vtrans, 1)) logic1 = 1; @ (cross(V(vin) - vtrans, -1)) logic1=0; vout_val= (!logic1)? vlogic_high: vlogic_low; end A function that we should use to define the transition of the inverter is the "cross" function. This function takes a minimum of two arguments. The first argument required is the threshold point of the input that indicates when the output should change, and the second is the edge where this threshold point is located. A '1' is indicated for a rising edge and a '-1' for a falling egde. A '0' indicates any crossing, rising or falling. In this case, we want to set up two cross statements; one for the rising of the input and one for the falling. When we detect a rising edge of the input, we want the output to fall to 0 volts. When we detect a falling edge of the input to 0 volts, we want the