|
31 | 31 | #include <act/act.h>
|
32 | 32 |
|
33 | 33 | static double mincap = 0.1e-15;
|
| 34 | +static double scale = 1.0; |
34 | 35 | static int use_subckt_models = 0;
|
35 | 36 | const char *gnd_node = "GND";
|
36 | 37 | static char SEP_CHAR = ':';
|
@@ -95,8 +96,9 @@ char *name_munge (const char *name)
|
95 | 96 |
|
96 | 97 | static void usage (char *name)
|
97 | 98 | {
|
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); |
99 | 100 | fprintf (stderr, " -c <mincap> : filter caps at or below this threshold\n");
|
| 101 | + fprintf (stderr, " -s <scale> : scale all units by <scale>\n"); |
100 | 102 | exit (1);
|
101 | 103 | }
|
102 | 104 |
|
@@ -492,6 +494,23 @@ static void import_subcell_conns (struct Hashtable *N,
|
492 | 494 | FREE (strbuf);
|
493 | 495 | }
|
494 | 496 |
|
| 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 | + |
495 | 514 | void ext2spice (const char *name, struct ext_file *E, int toplevel)
|
496 | 515 | {
|
497 | 516 | hash_bucket_t *b;
|
@@ -551,7 +570,7 @@ void ext2spice (const char *name, struct ext_file *E, int toplevel)
|
551 | 570 | else {
|
552 | 571 | printf ("*\n");
|
553 | 572 | printf ("*---------------------------------------------------\n");
|
554 |
| - printf ("* Main extract file %s\n", name); |
| 573 | + printf ("* Main extract file %s [scale=%g]\n", name, scale); |
555 | 574 | printf ("*---------------------------------------------------\n");
|
556 | 575 | printf ("*\n");
|
557 | 576 | }
|
@@ -632,13 +651,20 @@ void ext2spice (const char *name, struct ext_file *E, int toplevel)
|
632 | 651 | printf ("nfet ");
|
633 | 652 | }
|
634 | 653 | }
|
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); |
638 | 662 | tsrc->area[fl->type] = 0;
|
639 | 663 | 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); |
642 | 668 | tdrain->area[fl->type] = 0;
|
643 | 669 | tdrain->perim[fl->type] = 0;
|
644 | 670 | printf ("\n");
|
@@ -738,11 +764,14 @@ int main (int argc, char **argv)
|
738 | 764 |
|
739 | 765 | Act::Init (&argc, &argv);
|
740 | 766 |
|
741 |
| - while ((ch = getopt (argc, argv, "c:")) != -1) { |
| 767 | + while ((ch = getopt (argc, argv, "c:s:")) != -1) { |
742 | 768 | switch (ch) {
|
743 | 769 | case 'c':
|
744 | 770 | mincap = atof (optarg);
|
745 | 771 | break;
|
| 772 | + case 's': |
| 773 | + scale = atof (optarg); |
| 774 | + break; |
746 | 775 | default:
|
747 | 776 | usage(argv[0]);
|
748 | 777 | break;
|
|
0 commit comments