On Mon, 30 Nov 2020 00:38:05 +0300
Alexandre Rusev <
cybe...@gmail.com> wrote:
> Looking into Electric docs I don't see extensible explanation
> ("Creating new technologies") how scaling rules are coded for nodes
> in XML file.
It is complicated. I remember struggling with this (especially "box"
vs "lambdabox"), got it encoded into my Java classes and then never
looked at it again. I seem to recall that it wasn't explained in the
documentation and I had to read the Electric source code (which is why
Electric is awesome: because you can actually do that!)
> Could anyone point out document, where scaling of teh nodes in XML is
> explained?
The comment at the top of this class should be helpful, it is sort of
my personal gripe about the part that took me the longest to understand:
https://gitlab.com/westernsemico/com.westernsemico.vlsi/-/blob/master/src/com/westernsemico/vlsi/sw/electric/techxml/ScaledBox.java
I wrote that comment (and the code) back when it was fresh in my mind.
What follows is based on my current recollection, which is much less
fresh.
Basically when you see stuff like this:
<box klx=".." kly=".." khx=".." khy="..">
<lambdaBox klx=".." kly=".." khx=".." khy=".."/>
</box>
It means that the thing you're defining will be sized by scaling
something else. The "something else" is usually the nodeBase. For each
axis (x or y) and each edge (the lower "l" edge or higher "h" edge) you
take that edge on that axis from the "something else", FIRST you
MULTIPLY it by the value in the <box> tag and THEN you ADD the value in
the <lambdaBox> tag. Note FIRST/THEN and MULTIPLY/ADD.
For example,
<box klx="2" kly="3" khx="2" khy="3">
<lambdaBox klx="0" kly="0" khx="100" khy="99"/>
</box>
This will produce a scaled result by:
+ multiplying the lesser x edge (klx) by 2 and adding 0
+ multiplying the higher x edge (khx) by 2 and adding 0
+ multiplying the lesser y edge (kly) by 3 and adding 100
+ multiplying the higher y edge (khy) by 3 and adding 99
So the end result is that the scaled box will be four times as wide
(2+2) and six times as tall (3+3) as its nodeBase, and its origin will
be at (100,99) instead of at (0,0)
Steve, if I got that wrong I apologize. It was a few years ago that I
worked this out and wrapped it in Java and haven't dealt with it since.
- a