RTimothyEdwards / magic

Magic VLSI Layout Tool
Other
494 stars 103 forks source link

About RC PEX file extraction using magic command #174

Open Elon-J opened 2 years ago

Elon-J commented 2 years ago

When I use the command to extract a PEX file with RC, it doesn't work; it just has C in my PEX file. How can I solve this problem? It said that 'Cannot open file (UNNAMED).sim' attach the result and my extract file. The log file is in output.log, the GDS file is PMU_top_level, and the magic command is in run_lvspex.sh. Thank you! @msaligane

extract_PEX.zip

UNNAMED_problem

RTimothyEdwards commented 2 years ago

The above output depends on a script run_lvspex.sh which is not in the zip file.

RTimothyEdwards commented 2 years ago

There are a number of issues in the GDS itself, such as layers that don't exist in the sky130 process.

I am getting an error from the extresist command where it seems to be confused by $ in names. I will look into that. That does seem to prevent the generation of the .res.ext file which would explain why the output only has parasitic capacitors in it. (edited) Sorry, I failed to select the top level cell after loading the flattened layout. In fact, I have no problems getting the R-C extraction, so the error must be in the abovementioned run_lvspex.sh script.

Elon-J commented 2 years ago

Hi Tim, sorry, I use the command below to run the extraction for R-C (the run_lvspex.sh script), Do I need to flatten the GDS first to use the resistor extract command? Thank you very much! $1 is the gds path and $2 is the top-level circuit name. Also attach the run_lvspex.sh scrpit below.

magic -rcfile ./sky130A/sky130A.magicrc -noconsole -dnull << EOF gds read $1 load $2 extract do local extract all ext2sim labels on ext2sim extresist tolerance 10 extresist ext2spice lvs ext2spice cthresh 0 ext2spice extresist on ext2spice -o ./EXTRACT_PEX/$2_pex.spice quit -noprompt EOF

run_lvspex.zip

RTimothyEdwards commented 2 years ago

At the moment, yes, you need to flatten the circuit:

magic -rcfile ./sky130A/sky130A.magicrc -noconsole -dnull << EOF
gds read $1
load $2
select top cell
flatten $2_flat
load $2_flat
select top cell
extract do local
extract all
ext2sim labels on
ext2sim
extresist tolerance 10
extresist
ext2spice lvs
ext2spice cthresh 0
ext2spice extresist on
ext2spice -o ./EXTRACT_PEX/$2_pex.spice
quit -noprompt
EOF

It is possible to rename the flattened circuit back to the original name, but the above script is simpler. Just bear in mind that the name of the top level subcircuit in the output file has the "_flat" extension.

Elon-J commented 2 years ago

thank you very much, Tim! It's really helpful, let me try it again.

Elon-J commented 2 years ago

Hi Tim, when I use the above command to extract the RC PEX file, the subcircuit pins will also be extract into the top level in the flattening step. When I try to use 'flatten -dotoplabels $2_flat' command to prevent this, it does not work well. Attach the screenshot below; the first picture is the original hierarchy gds, the second picture is flatten gds and the third one is the PEX file. After flatting the circuit, the pins in the subcircuits will also be extracted. How can I solve this problem? Thank you very much!

image image image

RTimothyEdwards commented 2 years ago

If the circuit is flattened, then your PEX file should not have a subcircuit called DAC_COMP.

Flattening with no options will cause the subcircuit pins to become labels with the name of the subcircuit instance prepended; e.g., pin VOUT becomes label DCDC_DAC$2_0/VOUT. Since that is an ordinary label, then the top level pin D[1] will take precedence.

Elon-J commented 2 years ago

I see, Let me try just to use these top-level pins to test, thank you very much, Tim!

Elon-J commented 2 years ago

Hi, Tim, when I try to extract the whole RC PEX file for our circuit, I got an error. If the magic collapse when extracting this circuit? Or I don't use the right command? Attach the screenshot, gds file, magic command, and magic running log file. The gds file is in top_level.zip, the magic command is in run_lvspex.zip and the magic running log file is in output.log. Thank you very much! magic_extract_error

top_level.zip run_lvspex.zip output.log

Elon-J commented 2 years ago

@RTimothyEdwards, Hi, Tim, I have a problem when I want to extract an RC PEX file for my top.gds file. The error is just like this:

Screen Shot 2022-08-16 at 16 02 53 Screen Shot 2022-08-16 at 16 03 09

How can I solve it? Is this caused by too many labels when flattening the GDS file? Thank you very much! Attach the whole running package directory for your reference: extract_PEX.tar.gz

RTimothyEdwards commented 2 years ago

Sorry for the delay; I was rather busy last week. I'm looking at it now and I can confirm the crash condition.

Elon-J commented 2 years ago

No worries, Tim! I just use C extraction PEX file simulation recently, but I still have this problem for RC extraction currently @msaligane

daipvd commented 3 months ago

hi Everyone, I'm new with magic tool. I'm trying make RC PEX file also. I used tut3e and tut8r example to try but the PEX file I got just has C like below. How can I include R in this file? image And here is steps I did:

  1. Open tut8r.mag on magic and on command window I run commands in order:
  2. extract
  3. ext2sim
  4. ext2spice

Thank you, dai

RTimothyEdwards commented 3 months ago

Use:

extract all
ext2sim labels on
ext2sim
extresist all
ext2spice lvs
ext2spice cthresh 0.1
ext2spice extresist on
ext2spice

Note that usually one does extresist tolerance 10; extresist instead of extresist all but this layout is very small and nothing in it is considered by extresist to have a resistance large enough to be worth breaking into multiple nets.

daipvd commented 3 months ago

Thank you, @RTimothyEdwards I have followed your guide and I got resistance extracted now.

dai