← Back to team overview

kicad-developers team mailing list archive

Re: New part file format document.

 

On 12/15/2010 01:41 PM, Wayne Stambaugh wrote:
> On 12/15/2010 2:21 PM, Dick Hollenbeck wrote:
>>> I didn't use pin_swap in an example because a 7400 is so simple you typically
>>> wouldn't need to swap any pins.  I see pin swapping being useful on component
>>> with a lot of reconfigurable pins (think micro-controllers or gate arrays).
>>> The primary usage pattern I see with pin swapping is say I am 90% done wiring a
>>> 32 bit micro-controller in my schematic when I realize that the last couple of
>>> pins are going to turn my schematic into a rats nest.  Rather than rip up all
>>> the work you've just done, you could quickly create a new component based on
>>> the existing one and swap the pins that would allow you to finish wiring your
>>> schematic the way you want it to.  I can see pin swapping also finding it's way
>>> into the schematic edit. 
>>
>> I don't see that happening, and this is because components are nothing but
>> instantiated parts.  You cannot swap the pins of a component, because technically it
>> does not have any.  So this has to happen in the parts list.  Behind the scenes you
>> could clone the part to a new parts list entry, and then change the part reference in
>> the component to point to the new part in the parts list.
>>
>> Like I said, it is going to take discipline to hang on to this parts list concept. 
>> I'm fully committed to doing that however, so expect resistance from me on concepts
>> that make it difficult to keep the parts list.  Sorry.
> I guess I'm still not 100% sure how all this is going to fit together.  The
> above should read:  Create a new part derived from the existing one and swap
> the pins in the inherited part.  Change the part in your schematic to your new
> part.
>
> Wayne


The definition of "component" in the new doxygen output might help.  There is not much
to a component.  It has no pins itself.


The component is in the schematic.  It points to a part in the parts list, the part
that it "*is*".  The component has no pins itself, but borrows those of the part via
pointer at the C++ level.


To swap pins in a component:

Create a new part derived from the component's current one, and swap

the pins in the inherited part.  Change the component in the schematic such that its part reference points to the new part in the parts list.


We'll need reference counting in RAM loaded parts so they cannot be deleted if some
higher level entity, part or component, is dependent on them. 

It is not generally easy to delete a part in the new API.  Only possible to delete a
part if its LIB has LIB_SINK, and even now I remember this function is missing in
LIB_SINK.  Currently I don't see the PARTS_LIST class using the LIB_SOURCE+LIB_SINK
delegates, since it can override the LIB functions using polymorphism.


Hope this helps,

Dick




References