10.12.2012 Views

Design Architect-IC User's Manual - Bad Request

Design Architect-IC User's Manual - Bad Request

Design Architect-IC User's Manual - Bad Request

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating DA-<strong>IC</strong> Userware Advanced Customizing<br />

$add_or_replace_instance()<br />

As a library developer, you should write a function that does exactly what you<br />

want it to do. The $add_or_replace_instance() function can serve as a guide if it<br />

does some or most of what you want. Once you have written your function, call it<br />

from your own menus. The pathname to the file in which the<br />

$add_or_replace_instance() function is defined is:<br />

$MGC_HOME/shared/pkgs/da_ic/userware/$LANG/schematic.ample<br />

Copy the function to your own schematic.ample file, and edit the function to<br />

match your needs. Be sure to give the edited function a unique name; DO NOT<br />

name it “$add_or_replace_instance()”. Also, user-defined functions should not<br />

begin with “$”. If you do not rename the function, your function will overwrite the<br />

one supplied by Mentor Graphics, and the Mentor Graphics menu will not work<br />

correctly.<br />

The following is a short version of the $add_or_replace_instance() function.<br />

function sample_add_or_replace_instance( comp : string,<br />

smbl : optional string { default = "" }<br />

), INDIRECT<br />

{<br />

if ($does_component_exist(comp) != "") {<br />

$set_active_symbol(comp,smbl);<br />

if (session_area@@$instance_replacement_mode == @off)<br />

$place_active_symbol();<br />

else<br />

$$replace(comp,smbl,@clear);<br />

$set_instance_replacement_mode(@off);<br />

else<br />

$message($format("Cannot find component %s. Please<br />

ensure logical name is defined or have the component<br />

installed.",comp),@warning);<br />

}<br />

Keep in mind that the $add_or_replace_instance() function is only a guide; it is<br />

not meant to be used “as is” by library developers. It was written specifically to be<br />

called by the Mentor Graphics gen_lib menus. Notice that the function exists only<br />

in the file in which it is used as a call from the menus defined by the same group.<br />

<strong>Design</strong> <strong>Architect</strong>-<strong>IC</strong> User’s <strong>Manual</strong>, v8.9_10 14-39

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!