diff --git a/drc/DRCmain.c b/drc/DRCmain.c index 7f485b59..f2bb1752 100644 --- a/drc/DRCmain.c +++ b/drc/DRCmain.c @@ -184,9 +184,9 @@ drcSubstitute (cptr) DRCCookie * cptr; /* Design rule violated */ { static char *why_out = NULL; - char *whyptr, *sptr, *wptr; + char *whyptr, *sptr, *wptr, *unit; int subscnt = 0, whylen; - float oscale, value; + float oscale, dscale, value; extern float CIFGetOutputScale(); whyptr = DRCCurStyle->DRCWhyList[cptr->drcc_tag]; @@ -203,10 +203,22 @@ drcSubstitute (cptr) why_out = (char *)mallocMagic(whylen * sizeof(char)); strcpy(why_out, whyptr); - if (cptr->drcc_flags & DRC_CIFRULE) - oscale = CIFGetScale(100); /* 100 = microns to centimicrons */ + if (DRCPrintConvert) + { + unit = "um"; + if (cptr->drcc_flags & DRC_CIFRULE) + oscale = CIFGetScale(100); /* 100 = microns to centimicrons */ + else + oscale = CIFGetOutputScale(1000); /* 1000 for conversion to um */ + dscale = 1; + } else - oscale = CIFGetOutputScale(1000); /* 1000 for conversion to um */ + { + unit = "lambda"; + oscale = 1; + dscale = CIFGetOutputScale(1); + } + wptr = why_out; while ((sptr = strchr(whyptr, '%')) != NULL) @@ -218,21 +230,21 @@ drcSubstitute (cptr) switch (*(sptr + 1)) { case 'd': - /* Replace with "dist" value in microns */ - value = (float)cptr->drcc_dist * oscale; - snprintf(wptr, 20, "%01.3gum", value); + /* Replace with "dist" value in microns or lambda */ + value = (float)cptr->drcc_dist * oscale / dscale; + snprintf(wptr, 20, "%01.3g%s", value, unit); wptr += strlen(wptr); break; case 'c': - /* Replace with "cdist" value in microns */ - value = (float)cptr->drcc_cdist * oscale; - snprintf(wptr, 20, "%01.3gum", value); + /* Replace with "cdist" value in microns or lambda */ + value = (float)cptr->drcc_cdist * oscale / dscale; + snprintf(wptr, 20, "%01.3g%s", value, unit); wptr += strlen(wptr); break; case 'a': - /* Replace with "cdist" value in microns squared */ - value = (float)cptr->drcc_cdist * oscale * oscale; - snprintf(wptr, 20, "%01.4gum^2", value); + /* Replace with "cdist" value in microns or lambda squared */ + value = (float)cptr->drcc_cdist * oscale * oscale / (dscale * dscale); + snprintf(wptr, 20, "%01.4g%s^2", value, unit); wptr += strlen(wptr); break; default: diff --git a/drc/DRCtech.c b/drc/DRCtech.c index 9d5364e1..53246da4 100644 --- a/drc/DRCtech.c +++ b/drc/DRCtech.c @@ -60,6 +60,9 @@ global int DRCStepSize; global int DRCRuleOptimization = TRUE; +/* Whether we are converting units printed from lambda to microns */ +global bool DRCPrintConvert; + /* The following variables count how many rules were specified by * the technology file and how many edge rules were optimized away. */ @@ -554,6 +557,9 @@ DRCTechStyleInit() drcRulesOptimized = 0; drcRulesSpecified = 0; + /* default to printing in microns */ + DRCPrintConvert = TRUE; + if (DRCCurStyle == NULL) { DRCCurStyle = (DRCStyle *) mallocMagic(sizeof(DRCStyle)); @@ -855,6 +861,19 @@ DRCTechLine(sectionName, argc, argv) (DRCCurStyle->ds_status != TECH_SUSPENDED)) return TRUE; + /* Process "print" line next (if any) */ + + if (strcmp(argv[0], "print") == 0) + { + if (!strcmp(argv[1], "microns")) + DRCPrintConvert = TRUE; + else if (!strcmp(argv[1], "um")) + DRCPrintConvert = TRUE; + else if (strcmp(argv[1], "lambda")) + TechError("print must be microns or lambda. Using the " + "default value (microns).\n"); + } + /* Process "scalefactor" line next (if any) */ if (strcmp(argv[0], "scalefactor") == 0) diff --git a/drc/drc.h b/drc/drc.h index 346fab7c..7b3a6080 100644 --- a/drc/drc.h +++ b/drc/drc.h @@ -222,6 +222,7 @@ extern int DRCstatVRulesHisto[DRC_MAXRULESHISTO]; extern int DRCTechHalo; /* Current halo being used */ extern int DRCStepSize; /* Current step size being used */ +extern bool DRCPrintConvert; /* print as lambda or microns */ extern DRCPendingCookie * DRCPendingRoot; extern unsigned char DRCBackGround; /* global flag to enable/disable