Kai-Martin Knaak: > Karl Hammar wrote: > >> 5, add a tutorial on how to adapt the DRC rules to the local needs > Well documented examples would take me a long way.
Ok, I'll use http://turkos/git/openhw/wascator_c240/styrkort.sch as an example. ***** How to tell drc2 which tests to skip: $ gnetlist -g drc2 -o log styrkort.sch > /dev/null 2>&1 $ gnetlist -g drc2 -o log2 -c '(define dont-check-unconnected-pins 1)' styrkort.sch > /dev/null 2>&1 $ diff log log2 26,42d25 < Checking unconnected pins... < ERROR: Unconnected pin U2:11 < ERROR: Unconnected pin U2:12 < ERROR: Unconnected pin U2:13 < ERROR: Unconnected pin U2:14 < ERROR: Unconnected pin U1:28 < ERROR: Unconnected pin U1:19 < ERROR: Unconnected pin U1:20 < ERROR: Unconnected pin U1:22 < ERROR: Unconnected pin Q8:22 < ERROR: Unconnected pin Q8:12 < ERROR: Unconnected pin Q7:22 < ERROR: Unconnected pin Q7:12 < ERROR: Unconnected pin Q6:22 < ERROR: Unconnected pin Q6:12 < ERROR: Unconnected pin Q5:22 < 50c33 < Found 16 errors. --- > Found 1 errors. $ echo '(define dont-check-unconnected-pins 1)' > init.scm $ gnetlist -g drc2 -o log3 -l init.scm styrkort.sch > /dev/null 2>&1 $ diff log2 log3 $ On the global (i.e. for the whole gschem file) level, one can tell drc2 which test to skip, either via an init file (-l option to gnetlist) or directly as an string on the command line (-c option). ***** > > Can you give exaples of local needs? > Some people like consider any not connected pin an error, Use default. ** > others would only expect a warning. Provide your own drc-matrix (see last example) with "#\w" in the "unconnected" column and line. $ cat init3.scm ; DRC matrix ; ; #\e: error #\w: warning #\c: correct (if (not (defined? 'drc-matrix)) (define drc-matrix (list ; Order is important ! ; unknown in out io oc oe pas tp tri clk pwr unconnected ;unknown '( #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\w ) ;in '( #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\w ) ;out '( #\c #\c #\e #\w #\e #\e #\c #\e #\e #\c #\e #\w ) ;io '( #\c #\c #\w #\c #\w #\w #\c #\w #\c #\c #\w #\w ) ;oc '( #\c #\c #\e #\w #\e #\c #\c #\e #\c #\c #\e #\w ) ;oe '( #\c #\c #\e #\w #\c #\e #\c #\e #\c #\c #\e #\w ) ;pas '( #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\w ) ;tp '( #\c #\c #\e #\w #\e #\e #\c #\e #\e #\c #\e #\w ) ;tri '( #\c #\c #\e #\c #\c #\c #\c #\e #\c #\c #\e #\w ) ;clk '( #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\e #\w ) ;pwr '( #\c #\c #\e #\w #\e #\e #\c #\e #\e #\e #\c #\w ) ;unconnected '( #\w #\w #\w #\w #\w #\w #\w #\w #\w #\w #\w #\w ) ))) $ gnetlist -g drc2 -o log5 -l init3.scm styrkort.sch > /dev/null 2>&1 $ diff log log5 27,41c27,41 < ERROR: Unconnected pin U2:11 < ERROR: Unconnected pin U2:12 < ERROR: Unconnected pin U2:13 < ERROR: Unconnected pin U2:14 < ERROR: Unconnected pin U1:28 < ERROR: Unconnected pin U1:19 < ERROR: Unconnected pin U1:20 < ERROR: Unconnected pin U1:22 < ERROR: Unconnected pin Q8:22 < ERROR: Unconnected pin Q8:12 < ERROR: Unconnected pin Q7:22 < ERROR: Unconnected pin Q7:12 < ERROR: Unconnected pin Q6:22 < ERROR: Unconnected pin Q6:12 < ERROR: Unconnected pin Q5:22 --- > WARNING: Unconnected pin U2:11 > WARNING: Unconnected pin U2:12 > WARNING: Unconnected pin U2:13 > WARNING: Unconnected pin U2:14 > WARNING: Unconnected pin U1:28 > WARNING: Unconnected pin U1:19 > WARNING: Unconnected pin U1:20 > WARNING: Unconnected pin U1:22 > WARNING: Unconnected pin Q8:22 > WARNING: Unconnected pin Q8:12 > WARNING: Unconnected pin Q7:22 > WARNING: Unconnected pin Q7:12 > WARNING: Unconnected pin Q6:22 > WARNING: Unconnected pin Q6:12 > WARNING: Unconnected pin Q5:22 49,50c49,50 < Found 4 warnings. < Found 16 errors. --- > Found 19 warnings. > Found 1 errors. $ ** > Some might find not connected pins completely acceptable and > consequently find errors and warnings annoying. Use: gnetlist -g drc2 -o <log file> -c '(define dont-check-unconnected-pins 1)' <sch file> ** > Digital enthusiasts may add special pin types for different signal > levels. Like ECL, TTL, 3.3V, 5V etc. That is a big TODO. ** > Analog designers might find it perfectly acceptable to connect pwr > to in pins. drc2 already accepts that, but consider the "pwr" <-> "io" instead as an exercise. To change warning level for a connection you have to modify/supply your version of the drc-matrix. The defaul drc-matrix is defined in gnet-drc2.scm. To find that file and get a templete to edit, do $ locate gnet-drc2.scm /usr/share/gEDA/scheme/gnet-drc2.scm $ grep '^; DRC matrix' -A31 /usr/share/gEDA/scheme/gnet-drc2.scm > init.scm $ cat init.scm ; DRC matrix ; ; #\e: error #\w: warning #\c: correct (if (not (defined? 'drc-matrix)) (define drc-matrix (list ; Order is important ! ; unknown in out io oc oe pas tp tri clk pwr unconnected ;unknown '( #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\e ) ;in '( #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\e ) ;out '( #\c #\c #\e #\w #\e #\e #\c #\e #\e #\c #\e #\e ) ;io '( #\c #\c #\w #\c #\w #\w #\c #\w #\c #\c #\w #\e ) ;oc '( #\c #\c #\e #\w #\e #\c #\c #\e #\c #\c #\e #\e ) ;oe '( #\c #\c #\e #\w #\c #\e #\c #\e #\c #\c #\e #\e ) ;pas '( #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\e ) ;tp '( #\c #\c #\e #\w #\e #\e #\c #\e #\e #\c #\e #\e ) ;tri '( #\c #\c #\e #\c #\c #\c #\c #\e #\c #\c #\e #\e ) ;clk '( #\c #\c #\c #\c #\c #\c #\c #\c #\c #\c #\e #\e ) ;pwr '( #\c #\c #\e #\w #\e #\e #\c #\e #\e #\e #\c #\e ) ;unconnected '( #\e #\e #\e #\e #\e #\e #\e #\e #\e #\e #\e #\e ) ))) $ If you look at the line below ";io" where it intersects with column "pwr", you see a "#\w". And sure enoght, I get a warning in the example above: $ grep '^WARN.*Q8:A1' -A2 log2 WARNING: Pin(s) with pintype 'input/output': Q8:A1 Q7:A1 Q6:A1 Q5:A1 are connected by net 'Vcc' to pin(s) with pintype 'power': U1:4 U1:18 U2:16 U1:6 $ Let's get rid of that warning, change the "#\w" to a "#\c". To do that, use your favourite editor, and since both pwr <-> io is the same as io <-> pwr, you have to do the change in two places (see note a). I created a new init file, here is the results: $ diff init.scm init2.scm 15c15 < '( #\c #\c #\w #\c #\w #\w #\c #\w #\c #\c #\w #\e ) --- > '( #\c #\c #\w #\c #\w #\w #\c #\w #\c #\c > #\c #\e ) 29c29 < '( #\c #\c #\e #\w #\e #\e #\c #\e #\e #\e #\c #\e ) --- > '( #\c #\c #\e #\c #\e #\e #\c #\e #\e #\e > #\c #\e ) $ gnetlist -g drc2 -o log4 -l init2.scm styrkort.sch > /dev/null 2>&1 $ diff log log4 22,24d21 < WARNING: Pin(s) with pintype 'input/output': Q8:A1 Q7:A1 Q6:A1 Q5:A1 < are connected by net 'Vcc' < to pin(s) with pintype 'power': U1:4 U1:18 U2:16 U1:6 49c46 < Found 4 warnings. --- > Found 3 warnings. $ Done! Note a, there is a published patch [1] to make the drc-matrix lower triangular so you only have to make the change in one place in the matrix. [1] http://www.seul.org/pipermail/geda-user/2010-September/049342.html ** Regards, /Karl Hammar --------- Aspö Data Lilla Aspö 148 S-742 94 Östhammar Sweden +46 173 140 57 _______________________________________________ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user