Added new command options "port first" and "port next" to make it
easier to scan through a cell's ports. Used that capability in the "readspice" script to handle case sensitivity problems, and to find labels that are not ports and force them to be ports to match the reference netlist.
This commit is contained in:
parent
0df5f6d073
commit
9c1c365a5e
|
|
@ -1267,13 +1267,15 @@ complabel(const void *one, const void *two)
|
|||
#define PORT_EQUIV 4
|
||||
#define PORT_EXISTS 5
|
||||
#define PORT_CONNECT 6
|
||||
#define PORT_LAST 7
|
||||
#define PORT_MAKE 8
|
||||
#define PORT_MAKEALL 9
|
||||
#define PORT_NAME 10
|
||||
#define PORT_REMOVE 11
|
||||
#define PORT_RENUMBER 12
|
||||
#define PORT_HELP 13
|
||||
#define PORT_FIRST 7
|
||||
#define PORT_NEXT 8
|
||||
#define PORT_LAST 9
|
||||
#define PORT_MAKE 10
|
||||
#define PORT_MAKEALL 11
|
||||
#define PORT_NAME 12
|
||||
#define PORT_REMOVE 13
|
||||
#define PORT_RENUMBER 14
|
||||
#define PORT_HELP 15
|
||||
|
||||
void
|
||||
CmdPort(w, cmd)
|
||||
|
|
@ -1282,7 +1284,7 @@ CmdPort(w, cmd)
|
|||
{
|
||||
char **msg;
|
||||
int argstart;
|
||||
int i, idx, pos, type, option, argc;
|
||||
int i, refidx, idx, pos, type, option, argc;
|
||||
unsigned short dirmask;
|
||||
bool found;
|
||||
bool nonEdit = FALSE;
|
||||
|
|
@ -1299,6 +1301,8 @@ CmdPort(w, cmd)
|
|||
"equivalent [number] make port equivalent to another port",
|
||||
"exists report if a label is a port or not",
|
||||
"connections [dir...] get [set] port connection directions",
|
||||
"first report the lowest port number used",
|
||||
"next [number] report the next port number used",
|
||||
"last report the highest port number used",
|
||||
"make [index] [dir...] turn a label into a port",
|
||||
"makeall [index] [dir] turn all labels into ports",
|
||||
|
|
@ -1440,7 +1444,7 @@ CmdPort(w, cmd)
|
|||
{
|
||||
/* Check for options that require only one selected port */
|
||||
|
||||
if (option != PORT_LAST)
|
||||
if (option != PORT_LAST && option != PORT_FIRST)
|
||||
{
|
||||
if (lab == NULL)
|
||||
lab = portFindLabel(editDef, TRUE, TRUE, &nonEdit);
|
||||
|
|
@ -1463,8 +1467,9 @@ CmdPort(w, cmd)
|
|||
}
|
||||
|
||||
}
|
||||
if ((option != PORT_LAST) && (option != PORT_MAKEALL)
|
||||
&& (option != PORT_RENUMBER) && (lab == NULL))
|
||||
if ((option != PORT_LAST) && (option != PORT_FIRST) &&
|
||||
(option != PORT_MAKEALL) && (option != PORT_RENUMBER)
|
||||
&& (lab == NULL))
|
||||
{
|
||||
/* Let "port remove" fail without complaining. */
|
||||
if (option != PORT_REMOVE)
|
||||
|
|
@ -1480,7 +1485,7 @@ CmdPort(w, cmd)
|
|||
|
||||
if ((option != PORT_MAKE) && (option != PORT_MAKEALL)
|
||||
&& (option != PORT_EXISTS) && (option != PORT_RENUMBER)
|
||||
&& (option != PORT_LAST))
|
||||
&& (option != PORT_LAST) && (option != PORT_FIRST))
|
||||
{
|
||||
/* label "lab" must already be a port */
|
||||
if (!(lab->lab_flags & PORT_DIR_MASK))
|
||||
|
|
@ -1520,6 +1525,44 @@ CmdPort(w, cmd)
|
|||
#endif
|
||||
break;
|
||||
|
||||
case PORT_FIRST:
|
||||
i = PORT_NUM_MASK + 1;
|
||||
for (sl = editDef->cd_labels; sl != NULL; sl = sl->lab_next)
|
||||
{
|
||||
if (sl->lab_flags & PORT_DIR_MASK)
|
||||
{
|
||||
idx = sl->lab_flags & PORT_NUM_MASK;
|
||||
if (idx < i) i = idx;
|
||||
}
|
||||
}
|
||||
if (i == PORT_NUM_MASK + 1) i = -1;
|
||||
#ifdef MAGIC_WRAPPER
|
||||
Tcl_SetObjResult(magicinterp, Tcl_NewIntObj(i));
|
||||
#else
|
||||
TxPrintf("%d\n", i);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case PORT_NEXT:
|
||||
refidx = lab->lab_flags & PORT_NUM_MASK;
|
||||
i = PORT_NUM_MASK + 1;
|
||||
for (sl = editDef->cd_labels; sl != NULL; sl = sl->lab_next)
|
||||
{
|
||||
if (sl->lab_flags & PORT_DIR_MASK)
|
||||
{
|
||||
idx = sl->lab_flags & PORT_NUM_MASK;
|
||||
if (idx > refidx)
|
||||
if (idx < i) i = idx;
|
||||
}
|
||||
}
|
||||
if (i == PORT_NUM_MASK + 1) i = -1;
|
||||
#ifdef MAGIC_WRAPPER
|
||||
Tcl_SetObjResult(magicinterp, Tcl_NewIntObj(i));
|
||||
#else
|
||||
TxPrintf("Index = %d\n", i);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case PORT_EXISTS:
|
||||
if (!(lab->lab_flags & PORT_DIR_MASK))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -443,6 +443,16 @@ dbCellReadDef(f, cellDef, name, ignoreTech, dereference)
|
|||
continue;
|
||||
}
|
||||
|
||||
struct timespec t;
|
||||
|
||||
t.tv_sec = 0;
|
||||
t.tv_nsec = 900000000;
|
||||
TxError("x\n");
|
||||
nanosleep(&t, NULL);
|
||||
TxError("y\n");
|
||||
usleep(900000);
|
||||
TxError("z\n");
|
||||
|
||||
TTMaskZero(&typemask);
|
||||
rmask = &typemask;
|
||||
type = DBTechNameType(layername);
|
||||
|
|
|
|||
|
|
@ -105,6 +105,25 @@ proc readspice {netfile} {
|
|||
box values 0 0 0 0
|
||||
set n 1
|
||||
set changed false
|
||||
|
||||
# Make sure pins aren't duplicated by first moving all pin
|
||||
# indexes above the number of pins to check.
|
||||
|
||||
set npins [expr {[llength $ftokens] - 1}]
|
||||
set highport [port last]
|
||||
set outport $highport
|
||||
if {$outport < $npins} {set outport $npins}
|
||||
set p [port first]
|
||||
while {$p != -1 && $p <= $highport} {
|
||||
set p1 [port $p next]
|
||||
set testpin [port $p name]
|
||||
if {$testpin != ""} {
|
||||
port $p index $outport
|
||||
incr outport
|
||||
}
|
||||
set p $p1
|
||||
}
|
||||
|
||||
foreach pin [lrange $ftokens 2 end] {
|
||||
# If "=" is in the name, then we have finished the pins
|
||||
# and are looking at parameters, and so parsing is done.
|
||||
|
|
@ -127,9 +146,6 @@ proc readspice {netfile} {
|
|||
set testpin $pin
|
||||
set pinidx [port $testpin index]
|
||||
|
||||
# Test a few common delimiter translations. This list
|
||||
# is by no means exhaustive.
|
||||
|
||||
if {$pinidx == ""} {
|
||||
set testpin [string map {\[ < \] >]} $pin]
|
||||
set pinidx [port $testpin index]
|
||||
|
|
@ -139,15 +155,37 @@ proc readspice {netfile} {
|
|||
set pinidx [port $testpin index]
|
||||
}
|
||||
|
||||
# Also test some case sensitivity issues (also not exhaustive)
|
||||
# Handle issues with case insensitivity by getting
|
||||
# a list of ports and doing a case comparison.
|
||||
|
||||
if {$pinidx == ""} {
|
||||
set testpin [string tolower $pin]
|
||||
set pinidx [port $testpin index]
|
||||
set highport [port last]
|
||||
for {set p 0} {$p <= $highport} {incr p} {
|
||||
set testpin [port $p name]
|
||||
if {[string tolower $testpin] == [string tolower $pin]} {
|
||||
set pinidx [port $testpin index]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Finally, check if there is a bare label that matches the
|
||||
# port name. If so, convert it into a port
|
||||
|
||||
if {$pinidx == ""} {
|
||||
set testpin [string toupper $pin]
|
||||
set pinidx [port $testpin index]
|
||||
select top cell
|
||||
select area labels
|
||||
set all [lindex [what -list] 1]
|
||||
select clear
|
||||
foreach labrec $all {
|
||||
set testpin [lindex $labrec 0]
|
||||
if {[string tolower $testpin] == [string tolower $pin]} {
|
||||
goto $testpin
|
||||
set pinidx -1
|
||||
port make $n
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {$pinidx != ""} {
|
||||
|
|
|
|||
Loading…
Reference in New Issue