add `xschem instance_number` command to easily get/set the position of instance in the list
This commit is contained in:
parent
299b29bf87
commit
cfdaebf5e1
|
|
@ -522,6 +522,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li><kbd> abort_operation</kbd></li><pre>
|
||||
|
|
@ -836,6 +837,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
--> x3 PLUS LED OUT LEVEL MINUS REF
|
||||
instance x3 pin PLUS is attached to net LED, pin OUT to net LEVEL and so on...
|
||||
If 'pin' is given restrict map to only that pin </pre>
|
||||
<li><kbd> instance_number inst [n]</kbd></li><pre>
|
||||
Return the position of instance 'inst' in the instance array
|
||||
If 'n' is given set indicated instance position to 'n' </pre>
|
||||
<li><kbd> instance_pin_coord inst attr value</kbd></li><pre>
|
||||
Return the name and coordinates of pin with
|
||||
attribute 'attr' set to 'value' of instance 'inst'
|
||||
|
|
@ -1408,6 +1412,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1983,6 +1983,33 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
}
|
||||
|
||||
/* instance_number inst [n]
|
||||
* Return the position of instance 'inst' in the instance array
|
||||
* If 'n' is given set indicated instance position to 'n' */
|
||||
else if(!strcmp(argv[1], "instance_number"))
|
||||
{
|
||||
int i;
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
if(argc < 3) {
|
||||
Tcl_SetResult(interp, "xschem instance_number 1 additional argument", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if((i = get_instance(argv[2])) < 0 ) {
|
||||
Tcl_SetResult(interp, "xschem instance_number: instance not found", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if(argc > 3) {
|
||||
unselect_all(0);
|
||||
select_element(i, SELECTED, 1, 1);
|
||||
rebuild_selected_array();
|
||||
i = atoi(argv[3]);
|
||||
change_elem_order(i);
|
||||
draw();
|
||||
}
|
||||
Tcl_SetResult(interp, my_itoa(i), TCL_VOLATILE);
|
||||
}
|
||||
|
||||
/* instance_pin_coord inst attr value
|
||||
* Return the name and coordinates of pin with
|
||||
* attribute 'attr' set to 'value' of instance 'inst'
|
||||
|
|
|
|||
Loading…
Reference in New Issue