<@U016EM8L91B> When I use gf180mcuC in magic, the ...
# magic
p
@Tim Edwards When I use gf180mcuC in magic, the scalefactor is 50 nm, but there are DRC rules like e.g. DF1.a which are 220nm, which cannot be divided by 50nm. Wouldn't it make sense to change the scalefactor to something like 5nm?
t
That's exactly what the line
scalegrid 1 10
does in the
gf180mcuC.magicrc
file. The scalefactor is largely arbitrary; the general principle is to use it to set a lambda value for SCMOS-type rules (50nm is the most convenient unit I could come up with that lets most rules be cast as integer lambda values without compromising too much area satisfying the more conservative rule set). It may not make any sense to do that, but much of magic's code is based on scalable dimensions.
p
So is the scalefactor meant to be lambdas? Could we define the scalegrid in the tech file directly, and have the magicrc define a scalegrid 1 1, so that both are consistent?To me thanks inconsistency is a problem, that the same .mag file gets interpreted differently whether the magicrc is loaded or not, even though the correct tech file is used. Or could we add the scalegrid into the .mag files, so that I can create mag files that are always interpreted in the right way, and that magic would do the scaling automatically? I would like to define "scalegrid 5 nm" at the beginning of a tech file and be sure that all integer coordinates are interpreted as multiples of this scalegrid.
I can install tech files globally on a computer and have them referenced correctly from a .mag file, but I cannot do the same with magicrc files
t
The tech file defines a minimum manufacturing grid, and yes, it is probably a good idea to have magic scale the internal grid to the minimum manufacturing grid when it reads in the tech file, rather than depend on having a setup script to do it. That is probably very simple to code.
p
So for GF180MCU, the minimum manufacturing grid is 5nm, right?
t
Yes.
p
Why were the 50nm chosen for the scalefactor in the gf180mucC.tech file?
t
For the reason I stated above: 50nm is the most convenient unit I could come up with that lets most rules be cast as integer lambda values without compromising too much area satisfying the more conservative rule set.
p
But the DRC rules are specified in nanometers in the tech file
Ok, I get the idea behind it. But if the magicrc always goes down to a 5nm grid, it's not much use that the tech file was more compromising
So my suggestion would be to always go down to the manufacturing grid in the tech file, and not fiddle arouns with the grid in the magicrc
I am slightly afraid that we can't change the gf18mcuC tech file anymore without breaking lots of stuff
t
There is no need to change anything. My proposal is to move the grid scaling from the startup file to the source code after reading the tech file. It does not change anything except that you would get the same grid scaling if you used
-T <techfile>
instead of
-rcfile <scriptfile>
. The only real problem with the grid scaling as currently defined is that if someone starts magic using
-T <techfile>
, then they don't get a scaled grid, they are working entirely within a lambda grid, and if they try to load files with geometry at finer scales, then problems happen.
p
I don't fully get the idea, could you provide an experimental magic version (branch) with that change for testing?
t
Maybe all you really want to do is just to set
snap internal
?
I implemented a modification that requires adding this line to the cifoutput section of the tech file:
options set-minimum-grid
. That will force the database scaling to be set to the minimum manufacturing grid when the tech file is read in. It does seem like a useful feature.
p
I created a magic test-file now:
Copy code
magic
# Generated by librecell
tech gf180mcuC
magscale 1 10
timestamp 1676817115
<< met1 >>
rect 0 0 448 40
rect 0 50 449 90
rect 0 100 450 140
rect 0 150 451 190
<< end >>
and tested it with .tech files that had scalefactor 5 and scalefactor 50 , and which had the
options set-minimum-grid
unfortunately, then I tried to measure the the width of the metal strips, and would expect them to be 2.24um ++5nm wide.
If I remove the magscale 1 10 line and use a tech file with scalefactor 5, I get the results I expect, the widths are correct.
The set-minium-grid didn't had an effect.
With the magscale 1 10 and a scalefactor of 50 in the techfile I get an interesting bug effect when I measure the strips, the measurement is scaled up and not connected to the thing it should actually measure:
So I think magscale in the .mag files is causing too much troubles and since magic does not allow floating point coordinates in the tech file, the only real solution is to set the scalefactor to 5 nanometers in the .tech file.
Can we get the scalefactor fixed to 5 nanometers in the gf180mcu* PDK tech files?
@Tim Edwards I did a comprehensive test now, the rcfile does not help, the only solution I see is fixing the tech-file to 5 nanometers. (Or did I do anything wrong? Feel free to replicate my tests in the Makefile)
t
I think you have a basic misunderstanding of what magic's database represent, and how scalefactors work. I looked at all the combinations of files with scalefactors, and they all work exactly as I would expect, producing the dimensions that I would expect. There is only one bug that I saw, and that was with the "measure" command, which under one condition drew a measurement that was 10 times the size of the cursor box (although the reported size was correct for what it drew).
Values in a .mag file are never in physical dimensions. Magic is fundamentally based on scalable dimensions, meaning the dimensions are all relative. The only thing that determines physical dimensions is the choice of GDS (CIF) output and input styles. Since it gets increasingly difficult to properly define scalable dimensions as the feature size goes down, processes are generally not scalable, and so there is only one meaningful cifoutput or cifinput scale. Nevertheless, the database is still scalable. The "scalefactor" in the cifoutput and cifinput sections is defining the scale factor from values in the .mag file to physical dimensions. So when you change the scalefactor by a factor of 10 and then read the same .mag file, you have implicitly scaled the contents of the file by a factor of 10. That's exactly what you would do in scalable CMOS to take a design and output it for a 1um process, and a 0.8um process, and a 0.5um process, etc.; you would just change the cifoutput style, and the output will be scaled correctly for the chosen process.
The
scalegrid
command, however, changes the underlying integer grid without changing the scalefactor. But the
.mag
file output is defined to be in lambda (undimensioned) units, and so the
magscale
line is there to change the meaning of the units in the
.mag
file to match the difference between lambda units and whatever internal units have been defined by using the
scalegrid
command. If you make no other changes to tech file or .mag file but add a line
magscale 1 10
, then you have just declared that all units in the
.mag
file are 1/10 lambda, and so you have implicitly shrunk the entire design by a factor of 10.
p
Hmm, so magic can scale it properly when loading GDS2 but not when loading .mag files? My usecase is that I want to generate .mag files with my own toolchain, containing standard cells for gf180mcuC. I need the 5nm manufacturing grid precision, rounding up to 50nm precision causes lots of problem. I am afraid that the measure bug isn't the only bug since magscale doesn't seem to be widely used.
So at the moment I see 3 potential solutions: Using .gds instead of .mag, changing gf180mcuC to a 5nm scalefactor, or trying to use magscale and fixing any bugs that we find there.
t
There are no bugs except for the minor one with the "measure" command failing to size itself to the cursor box. Why generate .mag outputs directly? Why not just run magic in batch mode and pass commands like the device generator Tcl scripts do? But, regardless, you can put any units you want in the .mag file (including nanometers, or angstroms) as long as you put the correct "magscale" line to account for the conversion between the units you use and lambda.
p
.mag is easy to generate from any programming language, easy to parse, easy to debug with a text editor, and it's easy to convince other vendors to add .mag support to their tools.
t
I just fixed the "measure" command in magic version 8.3.368 (just pushed to opencircuitdesign.com) so that it no longer has the bug you saw. So what you did with the 50.tech (which matches gf180mcuC.tech) and "scale.mag" is correct.
BTW, I never measure things with the "measure" command; I just type "box", which gives dimensions in microns, lambda, and internal units, and includes area as well as width and height.