Skip to content

Commit 69a5d6c

Browse files
committed
start on better extraction
1 parent e0b88e0 commit 69a5d6c

File tree

2 files changed

+64
-8
lines changed

2 files changed

+64
-8
lines changed

tech/techgen.cc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,33 @@ void emit_extract (pp_t *pp)
809809
char **act_flav = config_get_table_string ("act.dev_flavors");
810810
char **dev_names = config_get_table_string ("net.ext_devs");
811811
char **map_name = config_get_table_string ("net.ext_map");
812+
813+
/* emit resistance classes */
814+
for (int i=0; i < Technology::T->num_devs; i++) {
815+
pp_printf (pp, "resist (");
816+
pp_printf (pp, "%s,%s/a",
817+
Technology::T->diff[0][i]->getName(),
818+
Technology::T->diff[0][i]->getUpC()->getName());
819+
if (Technology::T->welldiff[0][i]) {
820+
pp_printf (pp, ",%s,%s/a",
821+
Technology::T->welldiff[0][i]->getName(),
822+
Technology::T->welldiff[0][i]->getUpC()->getName());
823+
}
824+
pp_printf (pp, ") 1000"); /* XXX need number here! */
825+
pp_nl;
826+
pp_printf (pp, "resist (");
827+
pp_printf (pp, "%s,%s/a",
828+
Technology::T->diff[1][i]->getName(),
829+
Technology::T->diff[1][i]->getUpC()->getName());
830+
if (Technology::T->welldiff[1][i]) {
831+
pp_printf (pp, ",%s,%s/a",
832+
Technology::T->welldiff[1][i]->getName(),
833+
Technology::T->welldiff[1][i]->getUpC()->getName());
834+
}
835+
pp_printf (pp, ") 1000"); /* XXX need number here! */
836+
pp_nl;
837+
}
838+
/* poly, m1 m2, etc. */
812839

813840
for (int i=0; i < Technology::T->num_devs; i++) {
814841
char tmp[128];

transform/ext2sp/main.cc

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <act/act.h>
3232

3333
static double mincap = 0.1e-15;
34+
static double scale = 1.0;
3435
static int use_subckt_models = 0;
3536
const char *gnd_node = "GND";
3637
static char SEP_CHAR = ':';
@@ -95,8 +96,9 @@ char *name_munge (const char *name)
9596

9697
static void usage (char *name)
9798
{
98-
fprintf (stderr, "Usage: %s [act-options] [-c <mincap>] <file.ext>\n", name);
99+
fprintf (stderr, "Usage: %s [act-options] [-c <mincap>] [-s <scale>] <file.ext>\n", name);
99100
fprintf (stderr, " -c <mincap> : filter caps at or below this threshold\n");
101+
fprintf (stderr, " -s <scale> : scale all units by <scale>\n");
100102
exit (1);
101103
}
102104

@@ -492,6 +494,23 @@ static void import_subcell_conns (struct Hashtable *N,
492494
FREE (strbuf);
493495
}
494496

497+
static void print_number (FILE *fp, double x)
498+
{
499+
if (x > 1e3) {
500+
fprintf (fp, "%gK", x*1e-3);
501+
}
502+
if (x > 1e-3) {
503+
fprintf (fp, "%g", x);
504+
}
505+
else if (x > 1e-9) {
506+
fprintf (fp, "%gU", x*1e6);
507+
}
508+
else {
509+
fprintf (fp, "%gP", x*1e12);
510+
}
511+
}
512+
513+
495514
void ext2spice (const char *name, struct ext_file *E, int toplevel)
496515
{
497516
hash_bucket_t *b;
@@ -551,7 +570,7 @@ void ext2spice (const char *name, struct ext_file *E, int toplevel)
551570
else {
552571
printf ("*\n");
553572
printf ("*---------------------------------------------------\n");
554-
printf ("* Main extract file %s\n", name);
573+
printf ("* Main extract file %s [scale=%g]\n", name, scale);
555574
printf ("*---------------------------------------------------\n");
556575
printf ("*\n");
557576
}
@@ -632,13 +651,20 @@ void ext2spice (const char *name, struct ext_file *E, int toplevel)
632651
printf ("nfet ");
633652
}
634653
}
635-
printf ("W=%gU L=%gU", fl->width*1e6, fl->length*1e6);
636-
printf ("\n+ AS=%gP PS=%gU", tsrc->area[fl->type]*1e12,
637-
tsrc->perim[fl->type]*1e6);
654+
printf ("W=");
655+
print_number (stdout, fl->width*scale);
656+
printf (" L=");
657+
print_number (stdout, fl->length*scale);
658+
printf ("\n+ AS=");
659+
print_number (stdout, tsrc->area[fl->type]*scale*scale);
660+
printf (" PS=");
661+
print_number (stdout, tsrc->perim[fl->type]*scale);
638662
tsrc->area[fl->type] = 0;
639663
tsrc->perim[fl->type] = 0;
640-
printf (" AD=%gP PD=%gU", tdrain->area[fl->type]*1e12,
641-
tdrain->perim[fl->type]*1e6);
664+
printf (" AD=");
665+
print_number (stdout, tdrain->area[fl->type]*scale*scale);
666+
printf (" PD=");
667+
print_number (stdout, tdrain->perim[fl->type]*scale);
642668
tdrain->area[fl->type] = 0;
643669
tdrain->perim[fl->type] = 0;
644670
printf ("\n");
@@ -738,11 +764,14 @@ int main (int argc, char **argv)
738764

739765
Act::Init (&argc, &argv);
740766

741-
while ((ch = getopt (argc, argv, "c:")) != -1) {
767+
while ((ch = getopt (argc, argv, "c:s:")) != -1) {
742768
switch (ch) {
743769
case 'c':
744770
mincap = atof (optarg);
745771
break;
772+
case 's':
773+
scale = atof (optarg);
774+
break;
746775
default:
747776
usage(argv[0]);
748777
break;

0 commit comments

Comments
 (0)