Skip to content

Refactor of current_mirror.py - #367

Open
AnanthaKrishnan63 wants to merge 2 commits into
idea-fasoc:mainfrom
AnanthaKrishnan63:main
Open

Refactor of current_mirror.py#367
AnanthaKrishnan63 wants to merge 2 commits into
idea-fasoc:mainfrom
AnanthaKrishnan63:main

Conversation

@AnanthaKrishnan63

Copy link
Copy Markdown

I have broken down the current_mirror function into multiple smaller functions as this will improve readability and re-usability of the smaller function. Also added docstrings to the functions to make them more clear to users.

I have broken down the current_mirror function into multiple smaller functions as this will improve readability and re-usability of the smaller function. Also added docstrings to the functions to make them more clear to users.

@harshkhandeparkar harshkhandeparkar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Left a few comments but this looks good otherwise



#@cell
def create_interdigitized_fets(pdk: MappedPDK, device: str, numcols: int, with_dummy: bool, **kwargs) -> Component:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this pattern used elsewhere, in other circuits perhaps? If yes, then this function can be reused there as well.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I do not know repo well enough right now, but yes if this pattern is being used elsewhere then it can be replaced

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That's fine. Let it be for now.

raise ValueError(f"Invalid device type: {device}. Must be 'nfet' or 'pfet'.")


def route_interdigitized_fets(pdk: MappedPDK, interdigitized_fets: Component) -> Component:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be better to prefix the function name with an _ or __ since it is only used as a subfunction in this file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, I agree with that. I'll make the changes.

)

return top_level No newline at end of file
"""An instantiable current mirror Component.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It seems some of the documentation was removed. Is there a reason why it was shortened?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I thought this would be better but in hindsight I think the initial documentation is a better choice.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

More elaborate documentation never hurts.

return component


def current_mirror(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Have you tested if this function still works the same? For a temporary check, you can instantiate a few current mirrors and compare the results to the older function and ensure they are the same.

However, it would be really good if you add a test in the CI. You can take a look at this file as an example.

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