Skip to content

Commit

Permalink
style drc: add print to output as lambda or microns
Browse files Browse the repository at this point in the history
  • Loading branch information
gnawhleinad committed Jan 2, 2024
1 parent 006c070 commit d9ed40f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
30 changes: 20 additions & 10 deletions drc/DRCmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ 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;
extern float CIFGetOutputScale();
Expand All @@ -203,10 +203,20 @@ 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 */
}
else
oscale = CIFGetOutputScale(1000); /* 1000 for conversion to um */
{
unit = "lambda";
oscale = 1;
}

wptr = why_out;

while ((sptr = strchr(whyptr, '%')) != NULL)
Expand All @@ -218,21 +228,21 @@ drcSubstitute (cptr)
switch (*(sptr + 1))
{
case 'd':
/* Replace with "dist" value in microns */
/* Replace with "dist" value in microns or lambda */
value = (float)cptr->drcc_dist * oscale;
snprintf(wptr, 20, "%01.3gum", value);
snprintf(wptr, 20, "%01.3g%s", value, unit);
wptr += strlen(wptr);
break;
case 'c':
/* Replace with "cdist" value in microns */
/* Replace with "cdist" value in microns or lambda */
value = (float)cptr->drcc_cdist * oscale;
snprintf(wptr, 20, "%01.3gum", value);
snprintf(wptr, 20, "%01.3g%s", value, unit);
wptr += strlen(wptr);
break;
case 'a':
/* Replace with "cdist" value in microns squared */
/* Replace with "cdist" value in microns or lambda squared */
value = (float)cptr->drcc_cdist * oscale * oscale;
snprintf(wptr, 20, "%01.4gum^2", value);
snprintf(wptr, 20, "%01.4g%s^2", value, unit);
wptr += strlen(wptr);
break;
default:
Expand Down
19 changes: 19 additions & 0 deletions drc/DRCtech.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -554,6 +557,9 @@ DRCTechStyleInit()
drcRulesOptimized = 0;
drcRulesSpecified = 0;

/* default to printing in microns */
DRCPrintConvert = TRUE;

if (DRCCurStyle == NULL)
{
DRCCurStyle = (DRCStyle *) mallocMagic(sizeof(DRCStyle));
Expand Down Expand Up @@ -848,6 +854,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)
Expand Down
1 change: 1 addition & 0 deletions drc/drc.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,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
Expand Down

0 comments on commit d9ed40f

Please sign in to comment.