Skip to content

Commit

Permalink
start on better extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
rmanohar committed Sep 4, 2021
1 parent e0b88e0 commit 69a5d6c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 8 deletions.
27 changes: 27 additions & 0 deletions tech/techgen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,33 @@ void emit_extract (pp_t *pp)
char **act_flav = config_get_table_string ("act.dev_flavors");
char **dev_names = config_get_table_string ("net.ext_devs");
char **map_name = config_get_table_string ("net.ext_map");

/* emit resistance classes */
for (int i=0; i < Technology::T->num_devs; i++) {
pp_printf (pp, "resist (");
pp_printf (pp, "%s,%s/a",
Technology::T->diff[0][i]->getName(),
Technology::T->diff[0][i]->getUpC()->getName());
if (Technology::T->welldiff[0][i]) {
pp_printf (pp, ",%s,%s/a",
Technology::T->welldiff[0][i]->getName(),
Technology::T->welldiff[0][i]->getUpC()->getName());
}
pp_printf (pp, ") 1000"); /* XXX need number here! */
pp_nl;
pp_printf (pp, "resist (");
pp_printf (pp, "%s,%s/a",
Technology::T->diff[1][i]->getName(),
Technology::T->diff[1][i]->getUpC()->getName());
if (Technology::T->welldiff[1][i]) {
pp_printf (pp, ",%s,%s/a",
Technology::T->welldiff[1][i]->getName(),
Technology::T->welldiff[1][i]->getUpC()->getName());
}
pp_printf (pp, ") 1000"); /* XXX need number here! */
pp_nl;
}
/* poly, m1 m2, etc. */

for (int i=0; i < Technology::T->num_devs; i++) {
char tmp[128];
Expand Down
45 changes: 37 additions & 8 deletions transform/ext2sp/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <act/act.h>

static double mincap = 0.1e-15;
static double scale = 1.0;
static int use_subckt_models = 0;
const char *gnd_node = "GND";
static char SEP_CHAR = ':';
Expand Down Expand Up @@ -95,8 +96,9 @@ char *name_munge (const char *name)

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

Expand Down Expand Up @@ -492,6 +494,23 @@ static void import_subcell_conns (struct Hashtable *N,
FREE (strbuf);
}

static void print_number (FILE *fp, double x)
{
if (x > 1e3) {
fprintf (fp, "%gK", x*1e-3);
}
if (x > 1e-3) {
fprintf (fp, "%g", x);
}
else if (x > 1e-9) {
fprintf (fp, "%gU", x*1e6);
}
else {
fprintf (fp, "%gP", x*1e12);
}
}


void ext2spice (const char *name, struct ext_file *E, int toplevel)
{
hash_bucket_t *b;
Expand Down Expand Up @@ -551,7 +570,7 @@ void ext2spice (const char *name, struct ext_file *E, int toplevel)
else {
printf ("*\n");
printf ("*---------------------------------------------------\n");
printf ("* Main extract file %s\n", name);
printf ("* Main extract file %s [scale=%g]\n", name, scale);
printf ("*---------------------------------------------------\n");
printf ("*\n");
}
Expand Down Expand Up @@ -632,13 +651,20 @@ void ext2spice (const char *name, struct ext_file *E, int toplevel)
printf ("nfet ");
}
}
printf ("W=%gU L=%gU", fl->width*1e6, fl->length*1e6);
printf ("\n+ AS=%gP PS=%gU", tsrc->area[fl->type]*1e12,
tsrc->perim[fl->type]*1e6);
printf ("W=");
print_number (stdout, fl->width*scale);
printf (" L=");
print_number (stdout, fl->length*scale);
printf ("\n+ AS=");
print_number (stdout, tsrc->area[fl->type]*scale*scale);
printf (" PS=");
print_number (stdout, tsrc->perim[fl->type]*scale);
tsrc->area[fl->type] = 0;
tsrc->perim[fl->type] = 0;
printf (" AD=%gP PD=%gU", tdrain->area[fl->type]*1e12,
tdrain->perim[fl->type]*1e6);
printf (" AD=");
print_number (stdout, tdrain->area[fl->type]*scale*scale);
printf (" PD=");
print_number (stdout, tdrain->perim[fl->type]*scale);
tdrain->area[fl->type] = 0;
tdrain->perim[fl->type] = 0;
printf ("\n");
Expand Down Expand Up @@ -738,11 +764,14 @@ int main (int argc, char **argv)

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

while ((ch = getopt (argc, argv, "c:")) != -1) {
while ((ch = getopt (argc, argv, "c:s:")) != -1) {
switch (ch) {
case 'c':
mincap = atof (optarg);
break;
case 's':
scale = atof (optarg);
break;
default:
usage(argv[0]);
break;
Expand Down

0 comments on commit 69a5d6c

Please sign in to comment.