Mailing list archives : pcb-rnd

Date:Mon, 25 Sep 2023 15:47:17 +0200 (CEST)
Subject:Re: [pcb-rnd] new: sch-rnd funcmap for handling alternate function
in-reply-to:6186 from Majenko Technologies <>
replies: 6188 from Majenko Technologies <>
On Mon, 25 Sep 2023, Majenko Technologies wrote:
>Most of the microcontrollers I use have a similar multiplexer in them. All
>the PIC32 chips I use (which I use extensively - multiple different models
>many times over the course of a year), RP2040, ESP32, etc. 
Then funcmap is not for you - it's for a simpler subset of the problem.
>The "locking out" would be a nice thing to have but not necessary, so we can
>ignore that. I have no problems having big lists of functions for each
It's not just a "locking out". It's that you want to specify somehow that 
you have an SPI2's MISO that needs to be on exactly one pin, and only if 
SPI2's MOSI and SCK are also mapped somewhere, but you can't map MISO 
anywhere, but only from one of 5 different pins.
This can be done elegantly if you specify all these rules with logical 
expressions. And that leads to CP (whether the programmer admits that or 
>individual pin defined as long as the system will allow me to have the same
>function listed under different pins. As long as the scripting support is
>there to query these things then a sanity check script (or DRC script or
>something) could be crafted to check that you don't have the same function
>assigned to multiple pins in your design, so that's something that doesn't
>really need to be handled in the plugin itself. I have no problem with that
>kind of approach (move things into scripts - you know I love playing with
Sure, but that only means you are going to code your own CP. Which is 
fine. That's why I said I was going to keep funcmap simple, and for those 
who want to solve more complicated tasks and think it's worth investing 
more time, there are other means.
Funcmap is based on attributes. You can write a script that looks at 
symbol attributes and terminal attributes and compute new attributes on 
the concrete model level. 
That's a bit differen from funcmap's operation, because funcmap is 
operating on the abstract model, during compilation. But later on I want 
to expose the API for scripting such plugins too, plugins that create new 
views, hooking into the compilation process. 
The only thing you won't have with that is the local lib mechanism, so 
your sheets will start depending on external map files (or you will need 
to copy those into symbol attributes within the sheet, but then work out 
how to update them, how to keep copies of those attributes in multiple 
symbols using the same map.) But if your compilation relies on user 
scripts, your sheet is not portable anyway, so depending on external map 
files is probably not a big deal then.
>So basically my question boils down to: "It's unclear in the documentation
>whether it is possible to have the same function listed as available for
>multiple pins" - and what the knockon effects of listing a function in such
>a way would be to the rest of the plugin as it stands now.
In funcmap you can have the "same functionality" assigned to multiple pins 
but it's not gong to do what you need for your case. The docmentation has 
an example of this for SCK, which is both in SPI and in USI. It's the same 
function name but 2 different functions one levle up (SPI or USI) but then 
one more level up it's again the same thing, the same hardware. Anyway, 
SCK is a 'multi' functionality (see the DRC section of the doc). So the 
code can still help you enable SPI or USI, it can still verify that if you 
wanted SPI you have all SPI enabled, or if you wanted USI you have all USI 
However, there's a limitation: if you enable SCK only, and no other USI or 
SPI, it won't figure. And that's already because we don't have a full CP 
just very simple heuristics.
So all in all: funcmap won't work for your heavily multiplexed case. For 
that, you'll need a different solution. Later on I could code a plugin 
doing something more generic, but then it has to be really generic, not 
just a special case for your use case. Plus it will have to fit all 
requirements I wrote in my previous reply, I don't want to add code that 
works only on GUI, only on CLI or that is so complicated to configure that 
nobody will ever use. So far I couldn't come up with a plan how to do 
that. You could try to work it out, and propose a complete, coherent 
Best regards,

Reply subtree:
6187 Re: [pcb-rnd] new: sch-rnd funcmap for handling alternate function from
  6188 Re: [pcb-rnd] new: sch-rnd funcmap for handling alternate function from Majenko Technologies <>