Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Chipathon2024 Mahowald-ers Regulated Cascoded Current Mirror block #349

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

amisapta15
Copy link

Team Mahowald-ers: PR for adding Regulated Cascoded Current Mirror block. This block will add a Cascode regulator block from this team's other PR for enhanced voltage swing.

Ref: DOI: 10.1109/AE54730.2022.9920096

This is an initial Commit and a Circuit (with description) will be added. Details of the goal of this PR can be found in this Gslides link presented in 05.09.2024 meeting

Current Status: A simple Current Mirror template is added. LVS is failing with Final result: Top level cell failed pin matching. Further comments will be added soon.

@amisapta15
Copy link
Author

Current LVS result

Contents of circuit 1:  Circuit: 'CM'
Circuit CM contains 6 device instances.
  Class: sky130_fd_pr__nfet_01v8 instances:   6
Circuit contains 4 nets.
Contents of circuit 2:  Circuit: 'CM'
Circuit CM contains 2 device instances.
  Class: sky130_fd_pr__nfet_01v8 instances:   2
Circuit contains 3 nets.

Circuit was modified by parallel/series device merging.
New circuit summary:

Contents of circuit 1:  Circuit: 'CM'
Circuit CM contains 3 device instances.
  Class: sky130_fd_pr__nfet_01v8 instances:   3
Circuit contains 4 nets.
Contents of circuit 2:  Circuit: 'CM'
Circuit CM contains 2 device instances.
  Class: sky130_fd_pr__nfet_01v8 instances:   2
Circuit contains 3 nets.

Circuit 1 contains 3 devices, Circuit 2 contains 2 devices. *** MISMATCH ***
Circuit 1 contains 4 nets,    Circuit 2 contains 3 nets. *** MISMATCH ***


Final result: 
Netlists do not match.
Logging to file "/tmp/tmptmfe16ns/CM_lvs.rpt" disabled
LVS Done.


Circuit 1 cell sky130_fd_pr__nfet_01v8 and Circuit 2 cell sky130_fd_pr__nfet_01v8 are black boxes.
Warning: Equate pins:  cell sky130_fd_pr__nfet_01v8 is a placeholder, treated as a black box.
Warning: Equate pins:  cell sky130_fd_pr__nfet_01v8 is a placeholder, treated as a black box.

Subcircuit pins:
Circuit 1: sky130_fd_pr__nfet_01v8         |Circuit 2: sky130_fd_pr__nfet_01v8         
-------------------------------------------|-------------------------------------------
1                                          |1                                          
2                                          |2                                          
3                                          |3                                          
4                                          |4                                          
---------------------------------------------------------------------------------------
Cell pin lists are equivalent.
Device classes sky130_fd_pr__nfet_01v8 and sky130_fd_pr__nfet_01v8 are equivalent.

Class CM (0):  Merged 3 parallel devices.
Subcircuit summary:
Circuit 1: CM                              |Circuit 2: CM                              
-------------------------------------------|-------------------------------------------
sky130_fd_pr__nfet_01v8 (6->3)             |sky130_fd_pr__nfet_01v8 (8->2) **Mismatch* 
Number of devices: 3 **Mismatch**          |Number of devices: 2 **Mismatch**          
Number of nets: 4 **Mismatch**             |Number of nets: 3 **Mismatch**             
---------------------------------------------------------------------------------------
NET mismatches: Class fragments follow (with fanout counts):
Circuit 1: CM                              |Circuit 2: CM                              

---------------------------------------------------------------------------------------
Net: VSS                                   |Net: VSS                                   
  sky130_fd_pr__nfet_01v8/(1|3) = 2        |  sky130_fd_pr__nfet_01v8/(1|3) = 2        
                                           |  sky130_fd_pr__nfet_01v8/4 = 2            
                                           |                                           
Net: a_n1570_n931#                         |(no matching net)                          
  sky130_fd_pr__nfet_01v8/4 = 3            |                                           
  sky130_fd_pr__nfet_01v8/(1|3) = 2        |                                           
  sky130_fd_pr__nfet_01v8/2 = 1            |                                           
---------------------------------------------------------------------------------------
DEVICE mismatches: Class fragments follow (with node fanout counts):
Circuit 1: CM                              |Circuit 2: CM                              

---------------------------------------------------------------------------------------
Instance: sky130_fd_pr__nfet_01v8:3        |(no matching instance)                     
  (1,3) = (6,6)                            |                                           
  2 = 6                                    |                                           
  4 = 6                                    |                                           
                                           |                                           
---------------------------------------------------------------------------------------
Netlists do not match.

Subcircuit pins:
Circuit 1: CM                              |Circuit 2: CM                              
-------------------------------------------|-------------------------------------------
VSS                                        |VSS                                        
VCOPY                                      |VCOPY                                      
VREF                                       |VREF                                       
---------------------------------------------------------------------------------------
Cell pin lists are equivalent.
Device classes CM and CM are equivalent.

Final result: Netlists do not match.


@amisapta15
Copy link
Author

currentMirror

@amisapta15
Copy link
Author

Updated the Layout and decreased LVS Errors. Current LVS produces the following Errors

The error now comes from the labels 'VCOPYandVREF`, which seem to be floating. Not Sure How to connect the metal2 layer, metal 2 pin and metal2 labels

`
Logging to file "/tmp/tmpi4zjwy4q/CM_lvs.rpt" enabled
Circuit sky130_fd_pr__nfet_01v8 contains no devices.

Contents of circuit 1: Circuit: 'CM'
Circuit CM contains 6 device instances.
Class: sky130_fd_pr__nfet_01v8 instances: 6
Circuit contains 3 nets, and 2 disconnected pins.
Contents of circuit 2: Circuit: 'CM'
Circuit CM contains 3 device instances.
Class: sky130_fd_pr__nfet_01v8 instances: 3
Circuit contains 3 nets.

Circuit was modified by parallel/series device merging.
New circuit summary:

Contents of circuit 1: Circuit: 'CM'
Circuit CM contains 3 device instances.
Class: sky130_fd_pr__nfet_01v8 instances: 3
Circuit contains 3 nets, and 2 disconnected pins.
Contents of circuit 2: Circuit: 'CM'
Circuit CM contains 3 device instances.
Class: sky130_fd_pr__nfet_01v8 instances: 3
Circuit contains 3 nets.

Circuit 1 contains 3 devices, Circuit 2 contains 3 devices.
Circuit 1 contains 3 nets, Circuit 2 contains 3 nets.

Final result:
Top level cell failed pin matching.

Logging to file "/tmp/tmpi4zjwy4q/CM_lvs.rpt" disabled
LVS Done.

Circuit 1 cell sky130_fd_pr__nfet_01v8 and Circuit 2 cell sky130_fd_pr__nfet_01v8 are black boxes.
Warning: Equate pins: cell sky130_fd_pr__nfet_01v8 is a placeholder, treated as a black box.
Warning: Equate pins: cell sky130_fd_pr__nfet_01v8 is a placeholder, treated as a black box.

Subcircuit pins:

Circuit 1: sky130_fd_pr__nfet_01v8 Circuit 2: sky130_fd_pr__nfet_01v8
1 1
2 2
3 3
4 4

Cell pin lists are equivalent.
Device classes sky130_fd_pr__nfet_01v8 and sky130_fd_pr__nfet_01v8 are equivalent.

Cell CM (0) disconnected node: VCOPY
Cell CM (0) disconnected node: VREF
Class CM (0): Merged 3 parallel devices.
Cell CM (0) disconnected node: VCOPY
Cell CM (0) disconnected node: VREF
Subcircuit summary:

Circuit 1: CM Circuit 2: CM
sky130_fd_pr__nfet_01v8 (6->3) sky130_fd_pr__nfet_01v8 (6->3)
Number of devices: 3 Number of devices: 3
Number of nets: 3 Number of nets: 3

Netlists match uniquely with port errors.

Subcircuit pins:

Circuit 1: CM Circuit 2: CM
VSS VSS
(no matching pin) VREF
(no matching pin) VCOPY
VCOPY (no matching pin)
VREF (no matching pin)

Cell pin lists for CM and CM altered to match.
Device classes CM and CM are equivalent.

Final result: Top level cell failed pin matching.

`

@amisapta15
Copy link
Author

Current Layout

Layout

@amisapta15
Copy link
Author

amisapta15 commented Nov 27, 2024

Finally Cleared LVS. Improvement suggestions on the layout (along with further technical checks) will be greatly appreciated. Specially need help with moving the components around to become DRC clean.

DRC is still being checked. Next Goal is to get the Spice SIm going to extract the IV curve of this CM

@amisapta15
Copy link
Author

current layout

currentMirror

@amisapta15
Copy link
Author

amisapta15 commented Dec 5, 2024

Schematic-wise, getting suggestions on the schematic code for these would be super helpful. Thanks in advance.

(a) I'm not sure what's going on there. The Via from licon to met1 doesn't encompass the finger and the via to met 2 doesn't line up. The finger should be extended to fully enclose the via to met 1 track (blue), and the via between met1 and met2 (the red line) should be aligned with the previous via. I'm not sure how to achieve that in code.

(b) We want to move the Vref pin and track to the other position. Not sure what port to use for that move.

(c) The positioning of the pins (Vref, Vopy, and Vss) isn't good. They don't produce errors but would be great to bring them outside the well and make their location aligned and parametrized proper way.

hope I am able to explain it in an understandable fashion.

390557065-39d9d398-0846-4977-97b8-9e04864d2a12

def sky130_add_current_mirror_labels(CMS: Component, transistor_type: str = "nfet",pdk: MappedPDK =sky130) -> Component: # Re-introduce transistor_type
"""Add labels to the current mirror layout for LVS, handling both nfet and pfet."""

met2_pin = (69, 16)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use MappedPDK to make the labels pdk agnostic?

from glayout.flow.spice.netlist import Netlist
from typing import Optional, Union

def delete_files_in_directory(directory_path):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not related to the current mirror and should be in a different file if used for testing.

except OSError:
print("Error occurred while deleting files.")

global PDK_ROOT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to only export functions from this file.



# Generating only two transistors (one on each side):
source_netlist += f"XA {drain_net_A} {gate_net} {source_net} {bulk_net} {model_name} l={length} w={width} m={mtop} nf={fingers}\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to write spice to generate the netlist, it can be done programmatically. Refer to the opamp netlist generation code.

)

# @validate_arguments
def CurrentMirror(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this function name be changed to specify that it is a cascode current mirror?


return rename_ports_by_orientation(component_snap_to_grid(CurrentMirror))

def sky130_add_current_mirror_labels(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be made pdk agnostic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants