-
Notifications
You must be signed in to change notification settings - Fork 111
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
amisapta15
wants to merge
37
commits into
idea-fasoc:main
Choose a base branch
from
amisapta15:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
28fce9b
Added Basic blocks and Folders
amisapta15 4164fc3
added test code for the primitive cell
amisapta15 52c5bc2
updated test code path for pulling current mirror template from primi…
amisapta15 26afca6
Added Labeling for ports
amisapta15 cb74ac2
Updated to reduce LVS errors
amisapta15 cda70f2
added A pic of the layout
amisapta15 dffef6d
updated multipler in the Netlist
amisapta15 ab6bf6a
Added delete files ina directory function
amisapta15 1f574e0
added route_quad from gdsfactory
amisapta15 582d916
added dummy line in Netlist generator
amisapta15 989293a
remove create via function
amisapta15 3240e79
updated interdigitized structure arguments and inputs
amisapta15 dd280bd
updated routing with manual functions
amisapta15 1957e91
routed dummies to Welltie
amisapta15 1871cc1
added wells
amisapta15 0469d82
Adding ports to components
amisapta15 af0b5e1
tweaked netlist generator input in top component
amisapta15 f3314f6
Updated label adding code for LVS checks
amisapta15 6777463
changed function calls for top level component
amisapta15 84481b3
[Doesn't work yet] Metal 2 to Meta 3 via for connecting the labels to…
amisapta15 6350512
[Doesn;t work yet] added labels in metal 3
amisapta15 00a02ea
removed create via from init python funciton
amisapta15 1289e87
removed and generated new gds
amisapta15 19dabb0
shifted VREF and VCOPY labels
amisapta15 25f0aa9
Latest GDS file uploaded
amisapta15 606834a
added Pin definations for labels in sky130 mapped pdk
amisapta15 60200e5
Added picture of the current layout
amisapta15 3472eb7
rerouted source to bulk connection
amisapta15 35f0bc1
Placed and routed Vref and Vcopy Pins
amisapta15 539b6d3
placed labels on the vref and vcopy pins
amisapta15 46d138e
Just housecleanning
amisapta15 4229604
LVS cleared GDS uploaded
amisapta15 57accdc
Cosmetic updates
amisapta15 902968f
Updates for failed attempt to align the ports
amisapta15 49c0b67
both n/p fets work and pass DRC-LVS
amisapta15 1dcb1d8
Preparing pictures for presentation
amisapta15 44738ca
Updated the name of the component function to `cascode_current_mirror…
amisapta15 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
126 changes: 126 additions & 0 deletions
126
...glayout/flow/blocks/composite/regulated_cascoded_current_mirror/CM_primitive_cell_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import sys | ||
sys.path.append('../../elementary/current_mirror/') | ||
sys.path.append('../../composite/') | ||
|
||
from glayout.flow.pdk.mappedpdk import MappedPDK | ||
from glayout.flow.pdk.sky130_mapped import sky130_mapped_pdk as sky130 | ||
from glayout.flow.pdk.gf180_mapped import gf180_mapped_pdk as gf180 | ||
|
||
from gdsfactory.cell import cell, clear_cache | ||
from gdsfactory.component import Component, copy | ||
from gdsfactory.component_reference import ComponentReference | ||
from gdsfactory.components.rectangle import rectangle | ||
from glayout.flow.pdk.mappedpdk import MappedPDK | ||
from typing import Optional, Union | ||
|
||
from glayout.flow.pdk.util.snap_to_grid import component_snap_to_grid | ||
from pydantic import validate_arguments | ||
from glayout.flow.pdk.util.comp_utils import evaluate_bbox, prec_ref_center, movex, movey, to_decimal, to_float, move, align_comp_to_port, get_padding_points_cc | ||
from glayout.flow.pdk.util.port_utils import rename_ports_by_orientation, rename_ports_by_list, add_ports_perimeter, print_ports, set_port_orientation, rename_component_ports | ||
|
||
|
||
from current_mirror import current_mirror, current_mirror_netlist | ||
|
||
|
||
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) | ||
met2_label = (69, 5) | ||
met3_pin = (70, 16) | ||
met3_label = (70, 5) | ||
|
||
|
||
|
||
CMS.unlock() | ||
move_info = [] | ||
|
||
# VREF label (for both gate and drain of transistor A, and dummy drains) | ||
vref_label = rectangle(layer=met3_pin, size=(1, 1), centered=True).copy() | ||
vref_label.add_label(text="VREF", layer=met3_label) | ||
move_info.append((vref_label, CMS.ports["fet_A_gate_E"], None)) # Gate of A | ||
move_info.append((vref_label, CMS.ports["fet_A_drain_E"], None)) # Drain of A | ||
|
||
|
||
# VCOPY label (for drain of transistor B) | ||
vcopy_label = rectangle(layer=met3_pin, size=(1, 1), centered=True).copy() | ||
vcopy_label.add_label(text="VCOPY", layer=met3_label) | ||
move_info.append((vcopy_label, CMS.ports["fet_B_drain_E"], None)) # Drain of B | ||
|
||
|
||
|
||
# VSS/VDD label (for sources/bulk connection) | ||
if transistor_type.lower() == "nfet": | ||
bulk_net_name = "VSS" | ||
bulk_pin_layer = met2_pin #met2 for nfet bulk | ||
bulk_label_layer = met2_label #met2 for nfet bulk | ||
else: # pfet | ||
bulk_net_name = "VDD" | ||
bulk_pin_layer = met3_pin #met3 for pfet bulk | ||
bulk_label_layer = met3_label #met3 for pfet bulk | ||
|
||
bulk_label = rectangle(layer=bulk_pin_layer, size=(1, 1), centered=True).copy() #Layer changes based on type | ||
bulk_label.add_label(text=bulk_net_name, layer=bulk_label_layer) | ||
move_info.append((bulk_label, CMS.ports["fet_A_source_E"], None)) # Source of A | ||
move_info.append((bulk_label, CMS.ports["fet_B_source_E"], None)) # Source of B | ||
|
||
# VB label (connected to the dummy transistors' drains if present) | ||
vb_label = rectangle(layer=met3_pin, size=(1, 1), centered=True).copy() #met3 for pfet | ||
vb_label.add_label(text="VB" , layer=met3_label) | ||
move_info.append((vb_label, CMS.ports["purposegndportscon_N"], None)) | ||
move_info.append((vb_label, CMS.ports["purposegndportscon_S"], None)) | ||
|
||
# Add labels to the component | ||
for label, port, alignment in move_info: | ||
if port: | ||
alignment = ('c', 'b') if alignment is None else alignment | ||
aligned_label = align_comp_to_port(label, port, alignment=alignment) | ||
CMS.add(aligned_label) | ||
|
||
return CMS.flatten() | ||
|
||
|
||
comp = current_mirror(sky130, numcols=2, device='nfet') | ||
comp.name = "CM" | ||
comp.write_gds("CM.gds") | ||
|
||
# for absc in comp.ports.keys(): | ||
# if len(absc.split("_")) <=4: | ||
# print(absc) | ||
# print(comp.ports[absc]) | ||
print(comp.info["netlist"].generate_netlist()) | ||
comp.show() | ||
|
||
# comp = sky130_add_current_mirror_labels(comp, transistor_type='nfet', pdk=sky130) | ||
|
||
# print("\n...Running LVS...") | ||
|
||
# sky130.lvs_netgen(comp, "CM") | ||
|
||
|
||
|
||
|
||
# extractbash_template=str() | ||
# #import pdb; pdb.set_trace() | ||
# with open(str(_TAPEOUT_AND_RL_DIR_PATH_)+"/extract.bash.template","r") as extraction_script: | ||
# extractbash_template = extraction_script.read() | ||
# extractbash_template = extractbash_template.replace("@@PDK_ROOT",PDK_ROOT).replace("@@@PAROPT","noparasitics" if noparasitics else "na") | ||
# with open(str(tmpdirname)+"/extract.bash","w") as extraction_script: | ||
# extraction_script.write(extractbash_template) | ||
# #copyfile("extract.bash",str(tmpdirname)+"/extract.bash") | ||
# copyfile(str(_TAPEOUT_AND_RL_DIR_PATH_)+"/opamp_perf_eval.sp",str(tmpdirname)+"/opamp_perf_eval.sp") | ||
# copytree(str(_TAPEOUT_AND_RL_DIR_PATH_)+"/sky130A",str(tmpdirname)+"/sky130A") | ||
# # extract layout | ||
# Popen(["bash","extract.bash", tmp_gds_path, opamp_v.name],cwd=tmpdirname).wait() | ||
# print("Running simulation at temperature: " + str(temperature_info[0]) + "C") | ||
# process_spice_testbench(str(tmpdirname)+"/opamp_perf_eval.sp",temperature_info=temperature_info) | ||
# process_netlist_subckt(str(tmpdirname)+"/opamp"+str(index)+"_pex.spice", temperature_info[1], cload=cload, noparasitics=noparasitics) | ||
# rename(str(tmpdirname)+"/opamp"+str(index)+"_pex.spice", str(tmpdirname)+"/opamp_pex.spice") | ||
# # run sim and store result | ||
# #import pdb;pdb.set_trace() | ||
# Popen(["ngspice","-b","opamp_perf_eval.sp"],cwd=tmpdirname).wait() | ||
# ac_file = str(tmpdirname)+"/result_ac.txt" | ||
# power_file = str(tmpdirname)+"/result_power.txt" | ||
# noise_file = str(tmpdirname)+"/result_noise.txt" | ||
# result_dict = get_sim_results(ac_file, power_file, noise_file) | ||
# result_dict["area"] = area |
Binary file added
BIN
+61.4 KB
...rators/glayout/glayout/flow/blocks/composite/regulated_cascoded_current_mirror/GDS/CM.gds
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...ators/glayout/glayout/flow/blocks/composite/regulated_cascoded_current_mirror/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from glayout.flow.blocks.composite.regulated_cascoded_current_mirror.regulated_cascoded_current_mirror import CurrentMirror, generate_current_mirror_netlist,sky130_add_current_mirror_labels |
7 changes: 7 additions & 0 deletions
7
...s/glayout/glayout/flow/blocks/composite/regulated_cascoded_current_mirror/gen_netlist.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
|
||
.subckt CurrentMirror VREF VCOPY VSS | ||
XA VREF VREF VSS VSS sky130_fd_pr__nfet_01v8 l=0.5 w=3 m=2 nf=1 | ||
XB VCOPY VREF VSS VSS sky130_fd_pr__nfet_01v8 l=0.5 w=3 m=2 nf=1 | ||
XDUMMY VSS VSS VSS VSS sky130_fd_pr__nfet_01v8 l=0.5 w=3 m=2 | ||
.ends CurrentMirror |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I would like to. That's why mappedpdk has been taken as a function input without any utilization.
The layer definitions pertaining to the pins and labels do not currently exist in 'xx_mapped.py'. A modification (for sky130) is submitted at
openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py
Unfortunately, the
GLOBAL_PDK_ROOT
points to the Glayout installation in the/usr/bin/miniconda3/share/pdk/
location (instead of the local git repo files), which do not have these definitions. Please let me know if I should push this as a separate PR. Without these definitions, this function can't be made independent.Please see the
sky130_add_opamp_labels
function in theopenfasoc/generators/glayout/tapeout/tapeout_and_RL/sky130_nist_tapeout.py
which also does the same and advise.