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

add type-checking to configuration files #655

Merged
merged 24 commits into from
May 26, 2022
Merged

add type-checking to configuration files #655

merged 24 commits into from
May 26, 2022

Conversation

bdngo
Copy link
Contributor

@bdngo bdngo commented May 21, 2022

Added rudimentary type-checking to configuration files. The type-checker supports the following settings:

  • primitive types (e.g. int, str)
  • collections (e.g. list)
  • lists of dictionaries (e.g. list[dict[str, str]])
  • optional types (e.g. Optional[str])

Anyone can bolster a configuration file with types by adding a YAML file containing the same keys as in the original config file, but it now contains the type of the key instead. This means that the type-checker is backwards-compatible and is optional for existing configurations.

@bdngo bdngo closed this May 21, 2022
@bdngo bdngo reopened this May 21, 2022
@harrisonliew
Copy link
Contributor

harrisonliew commented May 21, 2022

@edwardcwang what is the way to update buildbot to check against different versions of Python? I don't believe I have the privileges to change this. I think supporting f-strings is very nice to have now, so supporting Python 3.5-3.10 should be the default.

@bdngo when this is completed, can you also rebase and update the System Requirements section of the documentation to reflect this?

@edwardcwang
Copy link
Member

@harrisonliew See messages

Copy link
Contributor

@harrisonliew harrisonliew left a comment

Choose a reason for hiding this comment

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

Thank you so much for your first PR!!! This is awesome!

Besides a few things, there needs to be directions added to the documentation about checking against defaults_types.yml in addition to defaults.yml, as well as guidance when making new plugins that they should also have accompanying types.

src/hammer-vlsi/defaults_types.yml Outdated Show resolved Hide resolved
src/hammer-vlsi/defaults_types.yml Show resolved Hide resolved
src/hammer_config_test/test.py Show resolved Hide resolved
bdngo and others added 9 commits May 23, 2022 13:33
- Update typing-related code for newer Python/mypy
- Old pyyaml uses dead code

File "/buildbot/run_unittests/build/src/tools/pyyaml/lib3/yaml/constructor.py", line 126, in construct_mapping
    if not isinstance(key, collections.Hashable):
AttributeError: module 'collections' has no attribute 'Hashable'
Copy link
Contributor

@harrisonliew harrisonliew left a comment

Choose a reason for hiding this comment

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

Thanks!!!

@harrisonliew harrisonliew merged commit 0a2254d into master May 26, 2022
@harrisonliew harrisonliew deleted the config-types branch May 26, 2022 17:57
ardaakman added a commit that referenced this pull request Jul 19, 2022
* Support relative directory meta application inside hierarchical constraints (#626)

* Fix ASAP7 SRAMs (#645)

* If prependlocal is applied to list prepend to list entries (#619)

Co-authored-by: Harrison Liew <harrisonliew@gmail.com>

* Assume a string in custom constraints is length 1 list (#618)

Co-authored-by: Harrison Liew <harrisonliew@gmail.com>

* Formal Verification (LEC at first) (#651)

* Cadence plugins now public (#652)

* Update to support Python 3.10

- Update typing-related code for newer Python/mypy
- Old pyyaml uses dead code

File "/buildbot/run_unittests/build/src/tools/pyyaml/lib3/yaml/constructor.py", line 126, in construct_mapping
    if not isinstance(key, collections.Hashable):
AttributeError: module 'collections' has no attribute 'Hashable'

* Remove vendored pyyaml

* add type-checking to configuration files (#655)

* Add specify block in SRAM compiler for vcs sdf back-annotation (#658)

* Integrate type checking into tool (#660)

* DRC w/ Magic, LVS w/ netgen (#657)

* magic DRC works

* hier DRC count doesn't work in batch mode, LVS runs but layout -> spice extraction fails with Illegal overlap (types to not connect) error

* type checking

* move .ext files into separate rundir

* extract improvements but still bad netlist

* clarify some comments

* No BYTEMASK for SRAM1RW256x64/128, Change SITE in LEFs (#653)

* Don't print output config to stdout (#661)

@odxa20 reported in ucb-bar/chipyard#1173 that an X-to-Y step caused an BlockingIOError.

Replacing printing the entire output config to stdout with just a message pointing to where the output config was written solves this + makes Hammer much less verbose.

* Yosys + Openroad Plugins (#648)

* added a few imports

* adding synthesis.yosys.binary key

* splitting sky130 tiehilocell into tiehicell and tielocell

* first pass on Yosys plugin, based on OpenLANE TCL scripts

* cleaned up plugin, manually write sdc file

* finished basic RTL to GDS flow for openroad plugin

* adding klayout technology file

* adding openroad-specific files for sky130

* adding openroad-specific files for sky130

* sky130 plugin modifications for openroad

* yosys plugin

* hammer changes to support openroad/yosys

* implemented open_chip script and starting at a par step, cleaned up many things

* openroad pnr fails at write gds step, something wrong with klayout settings

* fixes from PR comments, chipyard design runs through synthesis

* sky130 plugin updates to support openroad + new PDK updates

* adding mypy tests, changed buffer to driver

* small changes

* openroad pnr flow complete (write GDS works)

* cleaned up openroad plugin

* removed hard-coded paths and other cleanup

* removed hard-coded cell names

* clarified unit conversion

* removing more hard-coded values

* place pins side functionality, hook for set wire rc

* fixes for unit tests

* fixed most of tests, def2stream.py is failing

* seems to be passing all tests

* excluding def2stream.py from mypy tests

* fixing special cells test

* Update defaults_types.yml to fix type error for vlsi.core.node (#663)

* Update defaults_types.yml

Changed default type of vlsi.core.node to int from str since in all the technology files defaults.yml the value is an int. Without this change the following error arises Expected primary type str for vlsi.core.node, got type int

* Update defaults.yml

Changed default vlsi.core.node to conform with recently implemented type checks

* Fix small error in tech defaults (#664)

`vlsi.core.technology` is a str and `vlsi.core.node` is an int

* Trying bash test run

* Trying bash test run again

Co-authored-by: Colin Schmidt <colin.schmidt@sifive.com>
Co-authored-by: Harrison Liew <harrisonliew@gmail.com>
Co-authored-by: Edward Wang <edward.c.wang@compdigitec.com>
Co-authored-by: Bryan Ngo <48371418+bdngo@users.noreply.github.com>
Co-authored-by: Waxpple <a0910618112@gmail.com>
Co-authored-by: Nayiri <38256927+nayiri-k@users.noreply.github.com>
Co-authored-by: Odysseas Chatzopoulos <odxa20@users.noreply.github.com>
Co-authored-by: edwardcwang <edwardcwang@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants