Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
AMS.pdf
Скачиваний:
70
Добавлен:
05.06.2015
Размер:
2.68 Mб
Скачать

Virtuoso AMS Environment User Guide

Producing Customized Netlists

vlog = netId->vlog vlog->instanceProc = ’myPrintInstance

Running these statements, you find that the instance object contains the following fields.

Notice that some of these fields return information that is collected indirectly, and is therefore more costly of processing time and memory. For efficient netlisting, try to use such indirectly collected information sparingly.

Field

Value

Meaning of the Value

 

 

 

id

DB

instanceId

name

string

Name of the instance.

range

l_integers

‘( x_left x_right ), nil for

 

 

scalars

master

A_masterCellViewId

Collected indirectly. The cellViewId of

 

 

the instance master.

masterName

t_masterName

Collected indirectly. The master name

 

 

determined after applying the algorithm

 

 

discussed in “componentName” on

 

 

page 589.

attributes

l_attributes

Collected indirectly. The attributes of

 

 

the instance. Always returns nil.

parameters

l_parameters

Collected indirectly. The parameters of

 

 

the instance.

ports

l_ports

Collected indirectly. The ports of the

 

 

instance. Always returns nil.

 

 

 

Except for masterName, these fields are read-only. You can change the value of the masterName field by overriding theamsPrintInstanceMasterName function. If you do override this function, Cadence recommends that your overriding function set masterName to reflect the change.

SKILL Functions Supported for Netlisting

The SKILL functions specifically developed for use in custom netlisting procedures can be divided into those that replicate the default netlisting behavior and those that perform lowerlevel helping functions. These two varieties are described in “Default Netlisting Procedures” on page 334 and “Netlisting Helper Functions” on page 344.

April 2004

333

Product Version 5.3

Virtuoso AMS Environment User Guide

Producing Customized Netlists

Default Netlisting Procedures

The default netlisting procedures together reproduce the default behavior of the AMS netlister. For example, if you want the netlister to print the default headers in the default format, then leave the headersProc field of the formatter object set to the default netlisting procedure, amsPrintHeaders.

The default netlisting procedures take into account information, such as the values of ams.env variables, that might be required to create a netlist. For that reason, customized netlist procedures often run default netlisting procedures after setting up the appropriate data.

The default netlisting procedures are described in the following pages. They are:

amsPrintAttributes on page 334

amsPrintInstance on page 336

amsPrintInstanceMasterName on page 338

amsPrintInstanceParameters on page 339

amsPrintInstancePorts on page 340

amsPrintParameters on page 342

amsPrintAttributes

amsPrintAttributes( A_formatterId A_objectId )

=> t/nil

Description

Default netlisting procedure for printing the attributes of the object specified by

A_objectId. Attributes are printed in accordance with the value of the ams.env ifdefLanguageExtensions variable.

Be aware that attributes play an important role in controlling elaboration and simulation. If you are netlisting for the AMS simulator, for example, omitting attributes can have the following consequences:

Omitting this attribute...

Can result in...

 

 

library_binding

Binding an instance to a library other than that intended by

 

the schematic

April 2004

334

Product Version 5.3

Virtuoso AMS Environment User Guide

Producing Customized Netlists

Omitting this attribute...

Can result in...

 

 

view_binding

Binding an instance to a view other than that intended by the

 

schematic

cds_net_set, inh_conn_prop_name, inh_conn_def_value

Generating incorrect or incomplete inherited connections specifications

passed_mfactor

Using incorrect multiplication factors during simulation

elaboration_binding Causing errors during elaboration because components cannot be found

supplySensitivity, Using incorrect power and ground values during simulation groundSensitivity

Different simulators use different attributes, so the consequences of omitting or incorrectly setting an attribute depend on the simulator.

To help avoid problems such as those listed in the table, use the default amsPrintAttributes function as a helper function in your customized netlisting procedure when you override the instancePortProc. That way, the AMS netlister continues to generate the attributes for the netlist.

Arguments

 

A_formatterId

ID of the formatter object.

A_objectId

ID of the object. Currently, an instanceId is the only value

 

supported for A_objectId.

Value Returned

 

t

Attributes of the object were printed.

nil

Attributes of the object were not printed.

Example

In this example, assume that you have defined a function calledisDigitalGate, which determines whether a gate is a digital gate. You use that function to determine whether to

April 2004

335

Product Version 5.3

Virtuoso AMS Environment User Guide

Producing Customized Netlists

print the attributes to the netlist. If the attributes do need to be printed, you use the default function amsPrintAttributes to do the work.

;; Do not print attributes for instances of digital gates.

(defun DontPrintInstanceAttributesForDigitalGates (formatterId objectId)

;; Determine if it is an instance of a digital gate. digitalGate = isDigitalGate(objectId->masterName)

(if (digitalGate == nil) then amsPrintAttributes(formatterId objectId)

);; if

)

;;=======================================================================

;;Set up area

;;=======================================================================

netlisterId = amsGetNetlister() formatterId = netlisterId->vlog

formatterId->attributesProc = ’DontPrintInstanceAttributesForDigitalGates

amsPrintInstance

amsPrintInstance( A_formatterId A_cellViewId A_instanceId )

=> t/nil

Description

Default netlisting procedure for printing an instance, including: the instance master name, the instance parameters override list, the attributes for the instance, the name of the instance, and the instance port list.

If you override this function, you must:

Develop an algorithm for obtaining the master name

Handle the library_binding, view_binding, elaboration_binding, inh_conn_prop_name, inh_conn_def_value, passed_mfactor, supplySensitivity, groundSensitivity, and cds_net_set attributes

Determine how to print instance parameters

Take into account the ams.env variables amsScalarInstances, iterInstExpFormat, and useDefparam

To help meet these requirements, you can make use of the amsPrintInstanceMasterName, amsPrintInstanceParameters, amsPrintInstancePorts, and amsPrintAttributes functions, as well as the various helper functions. In fact, the simplest and easiest-to-maintain approach to achieving your goals might be to override just these functions, leaving the amsPrintInstance function running as it does by default.

April 2004

336

Product Version 5.3

 

Virtuoso AMS Environment User Guide

 

Producing Customized Netlists

 

 

Arguments

 

A_formatterId

ID of the formatter object.

A_cellviewId

ID of the cellview object.

A_instanceId

ID of the instance object.

Value Returned

 

t

Instance was printed.

nil

Instance was not printed.

Example

In this example, the default amsPrintInstance function is called to print the instance as usual, then additional monitoring code is inserted in the netlist automatically.

;;=======================================================================

;;A custom netlist procedure to generate $display for listed signals.

;;=======================================================================

(defun myInstanceSignalMonitor (formatterId cellviewId instanceId)

;; Call the default instance procedure amsPrintInstance(formatterId cellviewId instanceId)

(progn

;; Check for property CLOCK_MONITOR on the instance

;;

(when instanceId->id->CLOCK_MONITOR

(setq signal_list (parseString instanceId->id->CLOCK_MONITOR))

monitor_signal = car(signal_list) print_debug_signals = 0

(if (monitor_signal != nil) then

amsPrint(formatterId "\n// Debug signals at every clock transition") amsPrint(formatterId "always @(posedge(clock) or negedge(clock))\n") amsPrint(formatterId "begin")

amsPrint(formatterId " $display($stime, 'Signal values are:');") print_debug_signals = 1

); if

;; Display the listed signals (while (monitor_signal != nil)

display_signal = strcat(" $display('" monitor_signal ": %b', " mon itor_signal "); ")

amsPrint(formatterId display_signal) signal_list = cdr(signal_list) monitor_signal = car(signal_list)

)

April 2004

337

Product Version 5.3

Virtuoso AMS Environment User Guide

Producing Customized Netlists

(if (print_debug_signals == 1) then amsPrint(formatterId "\nend \n")

); if

) ; when

) ; progn

) ; defun

;;=======================================================================

;;Set up area

;;=======================================================================

netlisterId = amsGetNetlister() formatterId = netlisterId->vlog

;;Override the printing of instance netlist procedure

formatterId->instanceProc = ’myInstanceSignalMonitor

amsPrintInstanceMasterName

amsPrintInstanceMasterName( A_formatterId A_cellViewId A_instanceId )

=> t/nil

Description

Default netlisting procedure for printing the name of an instance master. By overriding this function, you can modify the name of the instance master.

Arguments

 

A_formatterId

ID of the formatter object.

A_cellviewId

ID of the attribute object.

A_instanceId

ID of the instance object.

Value Returned

 

t

Name of the instance master was printed.

nil

Name of the instance master was not printed.

Example

You enter the following code in your netlist procedures override file.

April 2004

338

Product Version 5.3

Virtuoso AMS Environment User Guide

Producing Customized Netlists

(setq MYNetlister (amsGetNetlister))

;; Override the function that prints the master name. MYNetlister->vlog->instanceMasterNameProc = ’MYInstMasterNameProc

(defun MYInstMasterNameProc ( formatterId cellViewId instanceId )

;;Check the name of the instance "fingers" property. Use the value

;;to generate the name of the master.

(setq numFingers instanceId->id->fingers)

(if (numFingers != nil) then

;; print the custom instance master name. (amsPrint formatterId (sprintf nil "\n%s_%d"

instanceId->masterName numFingers) )

else

;; print using the default instance master name netlist procedure. amsPrintInstanceMasterName(formatterId cellViewId instanceId)

); if

t

) ; defun

The MYInstMasterNameProc procedure generates and prints master names like nmos_1 or nmos_3 if the instance of nmos has 1 or 3 fingers and a master name likecapacitance if the instance of capacitance has no property called fingers.

amsPrintInstanceParameters

amsPrintInstanceParameters( A_formatterId A_cellviewId A_instanceId )

=> t/nil

Description

Default netlisting procedure for printing instance parameters. This function uses the ams.env useDefparam variable to determine how to netlist the instance parameters.

If possible, do not override this function. Instead, consider changing the parameters list directly and then calling the amsPrintInstanceParameters function to print the changed list.

If you do override the amsPrintInstanceParameters function, be aware that you must take into account the ams.env useDefparam variable, and, when the instance is an iterated instance, the amsScalarInstances variable.

Arguments

 

A_formatterId

ID of the formatter object.

A_cellviewId

ID of the cellview object.

April 2004

339

Product Version 5.3

 

Virtuoso AMS Environment User Guide

 

Producing Customized Netlists

 

 

A_instanceId

ID of the instance object.

Value Returned

 

t

Instance parameters were printed.

nil

Instance parameters were not printed.

Example

This example illustrates how you can change the individual parameter values and then use the amsPrintInstanceParameters function to print the changed list.

(defun MYPrintInstanceParameters ( formatterId cellViewId instanceId ) (foreach parameter instanceId->parameters

;; Change the individual parameter values parameter->value = <newVal>

...

) ; foreach

;;Delete parameters in the parameter list instanceId->parameters = newList

;;But call the default procedure

(amsPrintInstanceParameters formatterId cellViewId instanceId) ) ; defun

amsPrintInstancePorts

amsPrintInstancePorts( A_formatterId A_instanceId [x_iteration]

)

=> t/nil

Description

Default netlisting procedure for printing the port list of an instance or of a particular iteration of an instance. The ports in the port list are arranged according to the value specified by the

CDF termOrder property, if the termOrder property exists for the instance. Otherwise, the order of the ports is undetermined. The amsPrintInstancePorts function prints the port list by order or by named port maps, according to the effective options and settings.

The amsPrintInstancePorts functions does not print punctuation at the end of the port list, nor does it insert newline characters to break lines. However, the underlying implementation of amsPrint can insert newline characters at appropriate places to control line lengths.

April 2004

340

Product Version 5.3

 

Virtuoso AMS Environment User Guide

 

Producing Customized Netlists

 

 

Arguments

 

A_formatterId

ID of the formatter object.

A_instanceId

ID of the instance object.

x_iteration

Iteration number specifying a particular iterated instance. A

 

value of -1 has a special meaning, indicating that the port list of

 

an iterated instance is not to be split among the iterations of an

 

instance. The default value for this argument is -1.

Value Returned

 

t

Port list was printed.

nil

Port list was not printed.

Example

You have the following schematic to be netlisted.

The instance terminal connections for instance i0 of master block1 are:

Instance terminal a<0:1> is connected to net a,b<0>

April 2004

341

Product Version 5.3

Virtuoso AMS Environment User Guide

Producing Customized Netlists

Instance terminal b<0:1> is connected to net d<0:1>

Calling the amsPrintInstancePorts function on this schematic generates a port list as follows:

( .b( d[0:1] ), .a( { a,b[0] } ) )

amsPrintParameters

amsPrintParameters( A_formatterId A_cellViewId )

=> t/nil

Description

Default netlisting procedure for generating the parameter declarations for a cellview and printing the declarations one by one. The parameters are obtained from the base cell CDF and from parameters on the instances of the cellview being netlisted that have pPar references. The actual list of parameters is determined by the ams section of the simInfo

(which can be used to specify parameters to include and parameters to exclude), by library and cell CDF, and by the values of ams.env variables.

Arguments

 

A_formatterId

ID of the formatter object.

A_cellViewId

ID of the cellview object.

Value Returned

 

t

Parameter declarations were printed.

nil

Parameter declarations were not printed.

Example

This example code first calls the defaultamsPrintParameters function to write the regular parameters to the netlist. The remainder of the code checks for custom parameters, and if they exist, uses the amsPrint function to write them to the netlist too.

;; print the default CBN parameters amsPrintParameters(formatterId cvId)

(let (newParam printInfo)

April 2004

342

Product Version 5.3

Virtuoso AMS Environment User Guide

Producing Customized Netlists

;; Check for property CUSTOM_PARAMS on the CBN

;;

(when cvId->id->CUSTOM_PARAMS

(setq paramList (parseString cvId->id->CUSTOM_PARAMS))

newParam = car(paramList) printInfo = 0

;; Send informative messages to the log file (if (newParam != nil) then

(amsInfo formatterId "Adding custom CBN parameters to the netlist...\n"

)

printInfo = 1 ); if

;; Display the listed parameters (while (newParam != nil)

amsPrint(formatterId "\nparameter ")

mappedParamName = amsMapName(formatterId cvId newParam ’parameter) amsPrint(formatterId mappedParamName)

amsPrint(formatterId "= 0;") paramList = cdr(paramList) newParam = car(paramList)

); while

(if (printInfo == 1) then (amsInfo formatterId "Done.\n")

); if

); when

); let

April 2004

343

Product Version 5.3

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]