Need some guinea pigs for a rule-based DRC <<PROTOTYPE>>

We have a test-suite for the DRC engine that we’re building out; the purpose of the guinea pigs is more to find out what people try to do with it (so that we can see if the expressivity is sufficient). To that end I’m fixing bugs that keep people from trying it out, but there’s no expectation at present that it’s anywhere near stable.

The crashers should be fixed; I haven’t had a chance to look at the random zone filling yet…

@overthere, I can’t seem to find your board file. Can you send it again?

(I have a “SRC_Power_Adapter”, but it’s been cut down so much to isolate a bug that I can’t tell if it was the one you sent me or not. I also have a “vhf_uhf_com” and “motherboard” from about the right time-frame, but those don’t look right either.)

Cheers,
Jeff.

So you didn’t try it, huh? :stuck_out_tongue:

(There’s property completion in the editor.)

Aha! That is ingenious. (Or was it you? I’m not sure.)

image

Still I would like to know where they come from and preferably have some documentation - although many of them look self-explanatory.

Well, the whole thing is advanced functionality for power users as far as I can see, so I don’t expect it to be easy for beginners. But in the end it needs good documentation to be useful. It’s like a simple programming language and programming library!

1 Like

This thing is still in heavy flux, people are debating what properties to include, what the syntax should be, etc. There will certainly be documentation after it is more settled :slight_smile:

1 Like

Dear Jeff (@JeffYoung) I installed the new nighly and I’m now testing. These are my thoughts (unordered).

  • I downloaded a new project, so I do not have any legality from previous (errors) saves.
  • I used the following and it leads to a crash.
(version 1)
(rule "default"
    (constraint clearance (min 0.1mm))
    (condition "A.onLayer('TOP1')")
)
  • I just send you the test board again. Should now be easier to fix for you.

Version

Application: KiCad

Version: (5.99.0-2385-g7067e42da), release build

Libraries:
wxWidgets 3.0.4
libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2

Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
Date: Jul 23 2020 00:49:19
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.71.0
OCE: 6.9.1
Curl: 7.66.0
ngspice: 31
Compiler: GCC 9.2.0 with C++ ABI 1013

Build settings:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_SPICE=ON

Yes of course, but I want everything right now. :smirk:

Do you invent the property and function names for each case for this rule system, or do they come from somewhere else? Are they in any way documented in the KiCad code?

They’re actually part of the infrastructure for the new Inspector (no, the panel itself is not in yet).

You should be able to find them by searching for

propMgr.AddProperty(
1 Like

The “wandering” zones was a multi-threading issue. They can be diabolical, but this one wasn’t too bad to track down.

Bits up soon…

Discovered a bug. Used the following rules

(version 1)
(rule "default"
    (constraint clearance (min 0.1mm))
    (condition "A.onLayer('TOP1')")
)
(rule "gnd"
    (constraint clearance (min 5.0mm))
    (condition "A.onLayer('GND3')")
)
(rule "pwr"
    (constraint clearance (min 1.0mm))
    (condition "A.onLayer('POWER2')")
)
(rule "padclearance"
    (constraint clearance (min 0.1mm))
    (condition "A.type == 'pad'")
)

And it uses last clearance, so the condition does not seem to have an effect. You can reproduce this with the testboard. (Blue and orange should not have the same distance)

grafik

Version
Application: Pcbnew

Version: (5.99.0-2392-g6529e339a), release build

Libraries:
	wxWidgets 3.0.4
	libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2

Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
	Date: Jul 23 2020 23:55:29
	wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
	Boost: 1.71.0
	OCE: 6.9.1
	Curl: 7.66.0
	ngspice: 31
	Compiler: GCC 9.2.0 with C++ ABI 1013

Build settings:
	KICAD_SCRIPTING=ON
	KICAD_SCRIPTING_MODULES=ON
	KICAD_SCRIPTING_PYTHON3=OFF
	KICAD_SCRIPTING_WXPYTHON=ON
	KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
	KICAD_SCRIPTING_ACTION_MENU=ON
	BUILD_GITHUB_PLUGIN=ON
	KICAD_USE_OCE=ON
	KICAD_SPICE=ON

This is a know issue. The problem is that the Via is on all layers, so A.onLayer() is returning true for both GND3 and POWER2.

Two solutions have been proposed:

(rule "gnd"
    (constraint clearance (min 5.0mm))
    (condition "L == 'GND3' && A.foo == 'bar'")
)

or

(rule gnd (layer 'GND3')
    (constraint clearance (min 5.0mm))
    (condition "A.foo == 'bar'")
)

In the later example the layer clause can go on either the rule or the constraint. For example:

(rule "power" (layer 1)
    (constraint clearance (min x))
    (constraint track_width (min y))
)
(rule "room"
    (constraint clearance (layer 1) (min x))
    (constraint clearance (layer 2) (min y))
)

Jeff, I get the following error:
grafik
Apperently the syntax changed. Let’s try again.

Tried this, and crash:

(version 1)
(rule "default"
    (constraint clearance (min 0.1mm))
)
(rule "gnd"
    (constraint clearance (min 5.0mm))
    (condition "L == 'GND3'")
)

I do not understand what you want to say with foo and bar. Please explain.

Kicad Version:

Application: Pcbnew

Version: (5.99.0-2416-g010316457), release build

Libraries:
wxWidgets 3.0.4
libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2

Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
Date: Jul 27 2020 09:00:20
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.71.0
OCE: 6.9.1
Curl: 7.66.0
ngspice: 31
Compiler: GCC 9.2.0 with C++ ABI 1013

Build settings:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_SPICE=ON

Google search does wonders, but I admit that it doesn’t easily come to mind with those words.

“Foo” and “bar” are geek-speak for “random value 1” and “random value 2”.

So that condition might be, for instance:

    (condition "L == 'GND3' && A.ViaType == 'buried'")

But the layer examples I provided are just ones we’re thinking about. We haven’t decided which to use yet, so none of them are implemented at present.

I did tighten up the code so it will catch these errors.

I’m also concerned about the error dialog you did get not reporting the layer name correctly (the box between the quotes means “unknown character”). What locale are you using?

Dear Jeff (@JeffYoung) , I am using locale de, so Germany. I guess the error came from the non finished implementation. I guess its not to crucial for now.

Now i understand what you want to propose. Thanks for the clarification. To be honest, i think that will lead to a lot of non specification meeting pcbs. And its counter intuitive to the user.

The user should just specify the required clearance. For the implementation, the filling should also check on which layer it is. So the filling algorithm should ask for the clearance on the specific layer only. Ex. Gnd2 should ask for the via clearance only for Gnd2. And not ‘i meet a via and what clearance am i?’ instead it should ask. ‘i am on this (struct of type, layer, netclass) and i meet that (same struct of before )’ maybe that implementation could work…

The dialog does not to seem to be fixed for now. So correction of myself, it’s an issue=)
grafik

@JeffYoung
Tested again (version kicad-r16539.0fecb5f27-x86_64.exe) ,and the error message looks different now. Have a look at the large offset. May it be, that something is not initialized. (And to be honest, it should not show an error, here, i checked, everything is fine. Maybe this gives you a helpful hint.
grafik

I just got this message. So others please join. =)

Let others join the conversation

This topic is clearly important to you – you’ve posted more than 20% of the replies here.

It could be even better if you gave other people space to share their points of view, too. Can you invite them over?

Well, that’s annoying, although I was pretty pessimistic about that fixing it. But it’s definitely a multi-byte issue of some sort.

Tom’s going to look at changing the parser’s internal datastructures from char to either wchar_t or wxString (which is wchar_t inside). Stay tuned.

In other news we’ve decided to go with the “layer” tags in the s-expr rather than the “L” variable in the condition. So it will look like:

(rule "default"
    (constraint clearance ...)
    (layer outer)
    (condition "A.NetClass == ... )
)

but this isn’t implemented yet.

wxString would introduce yet another dependency upon the UI library in the engine…

(version 1)
(rule "default"
    (constraint clearance (min 0.1mm))
)
(rule "gnd"
    (constraint clearance (min 5.0mm))
    (condition "L == 'GND3'")
)

This still leads to a crash

And this also leads to crash:

(version 1)
(rule "default"
    (constraint clearance (min 0.1mm))
)
(rule "two"
    (constraint clearance (min 5.0mm))
    (condition "A.onLayer('TOP1')")
)

But this seems to work:

(version 1)
(rule “default”
(constraint clearance (min 0.1mm))
)
(rule “two”
(constraint clearance (min 3.0mm))
(layer outer)
(condition “A.NetClass == ‘500V’ && A.NetClass == ‘500V’” )
)
(rule “three”
(constraint clearance (min 0.5mm))
(layer outer)
(condition “A.NetClass == ‘500V’ && A.NetClass == ‘500V’” )
)

Question: Is it correct, to specitfy clearance-to-clearance as:

(condition “A.NetClass == ‘500V’ && A.NetClass == ‘500V’” )

`

Edit: I like the Debugging-Button. This feature seems to have evolved signficantly.