DRC Macros


From Erik Peterson at Yanntek.com:

When I'm writing techfiles, I find it impossible to get everything right as I get close to the end of transcribing a foundry's DRC booklet. So, I use the preprocessor as much as I can to macro everything: Rules AND layer combinations. I like to macro rules too; that way they all line up when you are trying to figure out what rules are written/ignored/redundant etc., etc. Anyhow... my drc.xx sections tend to look like this:


      .
      .
      .

     ECHK(4.2.1,Active,6,Active to Poly1 spacing must be at least 6)
     SCHK(4.2.1,Poly1,Active,6,TOK)
     /*   4.2.4      NOT USED */
     /*   4.2.5      NOT USED */
     /*   4.2.6      UNABLE TO CHECK: antenna rule! */

      .
      .
      .
Anyhow. Here is my drc-macro section (doesn't include all the cool cifout-boolean extensions; I wrote this in the dark ages). Until I get a rule-compiler (!), this is one of the ways I keep myself from screwing everything up.



/*---------------------------------------------------------------------------
 * macro: width check
 * usage: R=rulenum, L=layer, N=width
 */
#define WCHK(R,L,N)width L N \
          "[R] L width must be at least N"

/*---------------------------------------------------------------------------
 * macro: spacing check: look at corners
 * usage: R=rulenum, L1=layer1, L2=layer2, N=spacing, T=touching
 */
#define TOK touching_ok
#define TNO touching_illegal
#define SCHK(R,L1,L2,N,T)spacing L1 L2 N T \
          "[R] L1 to L2 spacing must be at least N"

/*---------------------------------------------------------------------------
 * macro: spacing check: ignore corners
 * usage: R=rulenum, L1=layer1, L2=layer2, P=plane, N=spacing
 */
#define MCHK(R,L1,L2,P,N)edge4way (L1)/P ~(L1)/P N ~(L2)/P 0 0 \
          "[R] L1 to L2 spacing must be at least N"
 
/*---------------------------------------------------------------------------
 * macro: halo check
 * usage: R=rulenum, L=inside layer, IP=inside layer's plane, H=outside layer
 *        OP=outside layer's plane, N=surround thickness
 */
#define HCHK(R,L,IP,H,OP,N)edge4way (L)/IP ~(L)/IP N (H)/OP ~(L)/IP N \
          "[R] H must surround L by at least N" OP
 
/*---------------------------------------------------------------------------
 * macro: outside check
 * usage: R=rulenum, L=inside layer, IP=inside layer's plane, H=outside layer
 *        OP=outside layer's plane, N=surround thickness
 */
#define TCHK(R,L,IP,H,OP,N)edge4way (L)/IP ~(L)/IP N ~(H)/OP ~(L)/IP N \
          "[R] H outside L must be at least N away" OP

/*
 *---------------------------------------------------------------------------
 * macro: inside check
 * usage: R=rulenum, I=inside layer, IP=inside layer's plane, B=border layer
 *        BP=border layer's plane, N=distance to border edge
 */
#define ICHK(R,I,IP,B,BP,N)edge4way ~(B)/BP (B)/BP N ~(I)/IP 0 0 \
          "[R] I inside B must be at least N away from B edge" IP

/*
 *---------------------------------------------------------------------------
 * macro: overhang check
 * usage: R=rulenum, E1=edge1, E2=edge2, P=edge plane, N=overhang
 */
#define OCHK(R,E1,E2,P,N)edge4way (E1)/P (E2)/P N (E2)/P 0 0 \
          "[R] E2 overhang of E1 must be at least N"

/* macro: let extension include E1 and E2 as ok types                       */
#define LCHK(R,E1,E2,P,N)edge4way (E1)/P (E2)/P N (E2,E1)/P 0 0 \
          "[R] E2 overhang of E1 must be at least N"

/* macro: beyond check (same as overhang chk, only diff wording..)          */
#define BCHK(R,E1,E2,P,N)edge4way (E1)/P (E2)/P N (E2)/P 0 0 \
          "[R] E2 must be at least N"

/*
 *---------------------------------------------------------------------------
 * macro: abutting and no straddle check (from outside)
 * usage: R=rulenum, I=inside layer, IP=inside layer's plane, S=straddle layer
 *        SP=straddle layer's plane, N=distance from edge
 */
#define RCHK(R,I,IP,S,SP,N)edge4way ~(I)/IP (I)/IP N ~(S)/SP 0 0 \
          "[R] S must be at least N away from I edge" SP

/*
 *---------------------------------------------------------------------------
 * macro: abutting and no straddle check (from inside)
 * usage: R=rulenum, I=inside layer, IP=inside layer's plane, S=straddle layer
 *        SP=straddle layer's plane, N=distance from edge
 */
#define ACHK(R,I,IP,S,SP,N)edge4way (I)/IP ~(I)/IP N ~(S)/SP 0 0 \
          "[R] S must be at least N away from I edge" SP

/*
 *---------------------------------------------------------------------------
 * macro: forbidden edge check
 * usage: R=rulenum, E1=edge1, E2=edge2, P=plane, TXT=error message
 */
#define FCHK(R,E1,E2,P,TXT)edge4way (E1)/P (E2)/P 1 0 E2 1 \
          "[R] TXT"

/*
 *---------------------------------------------------------------------------
 * macro: edge check (elusive bastard)
 * usage: R=rulenum, E=edge1, N=distance from edge TXT=error message
 */
#define ECHK(R,E,N,TXT)edge (E) space N space space N \
          "[R] TXT"

/*
 *---------------------------------------------------------------------------
 * macro: notch check
 * usage: R=rulenum, L=layer
 */
#define NCHK(R,L,P)edge4way (L)/P ~(L)/P 1 ~(L)/P (~L,L)/P 1 \
  "[R] L must not contain any notches"

/*
 *---------------------------------------------------------------------------
 * macro: join ok check
 */
#define JCHK(R,L1,L2,P)edge4way (L1)/P ~(L1)/P 1 (L2,space)/P 0 0 \
  "[R] L1 may only touch L2 or space" P


/* done */

email:

Last updated: August 5, 2016 at 7:04pm