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

Cap table support #566

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Cap table support #566

wants to merge 3 commits into from

Conversation

ErikFanderson
Copy link
Collaborator

This allows for specifying a "cap table file" in the tech.json for older technologies that do not come with a qrc techfile. There should not be any issue with supplying both a cap table file and qrc tech file. The tool should always prioritize the qrc tech file. I also edited the function "get_and_prepend_path" inside the "process_library_filter" function so that if an empty path is retrieved from the tech.json then an empty string will be returned. This behavior appears to have already been expected in the "get_mmmc_qrc" function.

@edwardcwang
Copy link
Member

Hi Erik, thank you for your contributions to Hammer! :)

A few things:

  1. Just to clarify, are we referring to this format or another format for the cap table? https://github.com/The-OpenROAD-Project/PEX/blob/master/kits/nangate45/captables/NCSU_FreePDK_45nm.capTbl

  2. Could you add a unit tests for this filter, following the format of the other unit tests for similar features?

  3. It appears that the type checker is failing.

Thanks again for your contribution!

Copy link
Contributor

@colinschmidt colinschmidt left a comment

Choose a reason for hiding this comment

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

Looks pretty reasonable.
I assume you have tested this locally?

@@ -811,7 +811,7 @@ def process_library_filter(self,
# Next, extract paths and prepend them to get the real paths.
def get_and_prepend_path(lib: Library) -> Tuple[Library, List[str]]:
paths = filt.paths_func(lib)
full_paths = list(map(lambda path: self.prepend_dir_path(path, lib), paths))
full_paths = list(map(lambda path: self.prepend_dir_path(path, lib) if path else '', paths))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this change? Is this just a bugfix?

Copy link
Collaborator Author

@ErikFanderson ErikFanderson Mar 6, 2020

Choose a reason for hiding this comment

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

prepend_dir_path has an assertion that checks to make sure the path is not empty. I am not entirely sure why the assertion exists, but this was my solution to get an empty string to be returned

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, how do empty paths end up showing up to begin with? And how is this cap table specific?

Copy link
Collaborator Author

@ErikFanderson ErikFanderson Mar 11, 2020

Choose a reason for hiding this comment

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

Well because you only need a cap_table_file OR a qrc_techfile then 1 of them can be empty. Previously hammer would error if you did not supply a qrc_techfile even though the function "generate_mmmc_script" already assumed that if there was no supplied qrc_techfile that an empty string would be retrieved when calling "get_mmmc_qrc". I guess this raises the question of whether we actually want an error to be thrown if neither of these files are supplied

Copy link
Contributor

@harrisonliew harrisonliew Mar 11, 2020

Choose a reason for hiding this comment

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

Hm, seeing how other things use prepend_dir_path, I also don't see what the value of the len(path) > 0 assertion is. It is only used in certain cases (DRC/LVS decks, map files) but doesn't make whatever you specified in the tech json any more or less correct.

I think what we really should do is call an os.path.exists on the constructed path so that Python can catch bad paths in tech jsons before it's passed to the tool where sometimes at best only a warning is thrown.

Copy link
Member

Choose a reason for hiding this comment

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

If there are no qrc techfiles, then wouldn't get_mmmc_qrc() return an empty string since the read_libs call would return an empty list?

Copy link
Contributor

Choose a reason for hiding this comment

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

As a side note, we really need to detach the QRC techfile from the libraries (#315).

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can incorporate that larger change into this PR, so that we aren't creating more work we need to undo/fix later?

src/hammer-vlsi/hammer_vlsi/hammer_vlsi_impl.py Outdated Show resolved Hide resolved
src/hammer-vlsi/hammer_vlsi/hammer_vlsi_impl.py Outdated Show resolved Hide resolved
src/hammer-vlsi/hammer_vlsi/hammer_vlsi_impl.py Outdated Show resolved Hide resolved
@ErikFanderson
Copy link
Collaborator Author

Hi Erik, thank you for your contributions to Hammer! :)

A few things:

1. Just to clarify, are we referring to this format or another format for the cap table? https://github.com/The-OpenROAD-Project/PEX/blob/master/kits/nangate45/captables/NCSU_FreePDK_45nm.capTbl

2. Could you add a unit tests for this filter, following the format of the other unit tests for similar features?

3. It appears that the type checker is failing.

Thanks again for your contribution!

  1. Yes, that is the format I am referring to.
  2. Yes, I will definitely do that. Please be patient with me as I sort through the testing infrastructure.
  3. Yup, I will try to sort that out asap.

@edwardcwang
Copy link
Member

Great! Might be good to add a link to https://github.com/The-OpenROAD-Project/PEX/blob/master/kits/nangate45/captables/NCSU_FreePDK_45nm.capTbl in the yaml comments/documentation for reference.

@ErikFanderson
Copy link
Collaborator Author

Update on this: Added a test for the filter in tech_test.py and also added a property to the Library stub class for type checking purposes. Not entirely sure why only some properties from the jsonschema generated Library class need to be defined in the stub class, but mypy no longer errors.

Copy link
Member

@edwardcwang edwardcwang left a comment

Choose a reason for hiding this comment

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

Generally looks good but have a further question about this line.

@@ -811,7 +811,7 @@ def process_library_filter(self,
# Next, extract paths and prepend them to get the real paths.
def get_and_prepend_path(lib: Library) -> Tuple[Library, List[str]]:
paths = filt.paths_func(lib)
full_paths = list(map(lambda path: self.prepend_dir_path(path, lib), paths))
full_paths = list(map(lambda path: self.prepend_dir_path(path, lib) if path else '', paths))
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, how do empty paths end up showing up to begin with? And how is this cap table specific?

@edwardcwang
Copy link
Member

Can we also add https://github.com/The-OpenROAD-Project/PEX/blob/master/kits/nangate45/captables/NCSU_FreePDK_45nm.capTbl to a pydoc or something to keep track of the format?

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.

5 participants