Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Vary subcircuit parameter (CMOS) width in hspice

Status
Not open for further replies.

santoshchiniwar

Junior Member level 1
Joined
Nov 23, 2009
Messages
16
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
bangalore
Activity points
1,379
hi all
I wanted to vary subcircuit parameter (CMOS) width in hspice...

i have writtern NAND as subcircuit which is called in some other circuit know i have initiated .param width_n and width_p as nmos and pmos width respectively, now i wanted to vary this parameter from other circuit, As shown in the following code. Please correct me if i am wrong in this code ...


.SUBCKT Nand Y A B VDD GND
.param width_N
.param width_P
Mp1 Y A VDD VDD CMOSP L=0.18u W=width_P
Mp2 Y B VDD VDD CMOSP L=0.18u W=width_P
Mn1 Y A X GND CMOSN L=0.18u W=width_N
Mn2 X B GND GND CMOSN L=0.18u W=width_N

.ENDS

** Nand Gates Description

X1 P A B VDD GND Nand
X2 Q A P VDD GND Nand
X3 R B P VDD GND Nand
X4 S Q R VDD GND Nand
X5 C P P VDD GND Nand


VDD VDD GND dc 5v
VA A GND PULSE(0 5 0 0 0 5n 40n)
VB B GND PULSE(0 5 0 0 0 10n 40n)

** Analysis
.TRAN 200p 20n

** Output
.PRINT TRAN V(A) V(B) V(S) V(C)
.alter width 360e-9
width width_N=360e-9 width_P=430e-9
.END
 

subckt parameter varying- help needed

Try it and see.

I think that the .param should be global and therefore not defined in the subcircuit, but I cannot be certain (it is with my simulator - .param within a subcircuit will not be visible outside it). I would have put the .param statements at the end of the definition of the whole circuit.

Also, I would have thought that the .param should define a value so:

.param width_N=0.36u

where you initially define it.

The .alter part should then be
.alter
.param width_N=1u

etc.

I cannot be sure - I don't use Hspice so my method of achieving the same thing would look slightly different.

Keith.
 

subckt parameter varying- help needed

correct code is as below :

.SUBCKT Nand Y A B VDD GND
.param width_N=1u $ default value must have to be defined
.param width_P=1u $ default value must have to be defined
Mp1 Y A VDD VDD CMOSP L=0.18u W=width_P
Mp2 Y B VDD VDD CMOSP L=0.18u W=width_P
Mn1 Y A X GND CMOSN L=0.18u W=width_N
Mn2 X B GND GND CMOSN L=0.18u W=width_N

.ENDS

** Nand Gates Description

X1 P A B VDD GND Nand
X2 Q A P VDD GND Nand
X3 R B P VDD GND Nand
X4 S Q R VDD GND Nand
X5 C P P VDD GND Nand


VDD VDD GND dc 5v
VA A GND PULSE(0 5 0 0 0 5n 40n)
VB B GND PULSE(0 5 0 0 0 10n 40n)

** Analysis
.TRAN 200p 20n

** Output
.PRINT TRAN V(A) V(B) V(S) V(C)
.alter width 360e-9
.param width_N=360e-9 width_P=430e-9 $ .param in starting in necessary
.END



***********************
i have updated code , please see remarks that are there starting with symbol $
do let me know if you need more info

Added after 1 minutes:

by default parameters are defined as global so it will pass to all hierarchy.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top