-
Notifications
You must be signed in to change notification settings - Fork 58
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 OpenLane Support #53
Open
mu2519
wants to merge
16
commits into
PyHDI:develop
Choose a base branch
from
mu2519:feature-asic
base: develop
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
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adding Support for OpenLane
Introduction
Veriloggen has the potential to synthesize hardware for both FPGAs and ASICs. However, its design is not optimal for ASICs because it was originally designed for FPGAs. Recently, an open-source EDA tool called OpenLane has emerged, and I implemented some functionalities to help use Veriloggen with OpenLane.
Problem
Instantiating SRAMs with OpenLane is quite complicated, as tutorial shows. Additionally, this way of instantiating SRAMs does not match the high-level synthesis functionality of Veriloggen.
Solution
My approach is to have Veriloggen generate both Verilog and configuration files. OpenLane requires
config.json
for various configurations andmacro_placement.cfg
for the placement of SRAM macros. I wrote code to generate these files. Furthermore, I added classASICSRAM
to use SRAMs from the high-level synthesis functionality of Veriloggen.Implementation
veriloggen/asic
is the directory for this extension.veriloggen/asic/__init__.py
imports a class and functions.veriloggen/asic/check.py
is a tiny script to validateconfig.json
(this script is necessary because OpenLane does not check configuration files at all!)veriloggen/asic/macro.py
definesgenerate_configs
, which producesconfig.json
andmacro_placement.cfg
, which are then fed to OpenLane.veriloggen/asic/simulation.py
definesasic_sim
, which is a thin wrapper ofrun_iverilog
and facilitates RTL simulation with SRAM simulation models provided by PDKs.veriloggen/asic/sram.py
definesASICSRAM
, which is a subclass ofRAM
and instantiates SRAMs in high-level synthesis.veriloggen/asic/util.py
definesmake_arr
, which is a utility function used in test programs for this extension.Question and Answer
Does the use of type hints break backward compatibility?
No. By using
from __future__ import annotations
, type annotations are not evaluated at runtime. By usingif TYPE_CHECKING:
, modules used only for type annotations are not imported at runtime. Hence, type hints don't affect the behavior of programs.Known Problems and Limitations
Module Names
If we instantiate the same module more than once, underscores are appended to the module name. This is problematic when instantiating SRAM macros. I tried to solve this issue, but I couldn't understand why on earch underscores are appended. For the present, I work around by adding the argument named
workaround
.Testing Requires Network Access
Network access is required for testing because it involves cloning some repositories (sky130_sram_macros and globalfoundries-pdk-ip-gf180mcu_fd_ip_sram).
Significant Changes
rectpack
: An Additional DependencyThe
rectpack
package (PyPI) is used to place SRAM macros. This package is added to dependencies:pytest-pythonpath
Is No Longer NecessaryAccording to PyPI,
pytest-pathpath
is obsolete as ofpytest 7.0.0
. I reflect this change:pythonpath = .
Appendices
I created some notebooks that can be executed in Colab (veriloggen-sram-openlane.ipynb and veriloggen-matmul-openlane.ipynb). If you are interested, please run these notebooks. Please note that it takes tens of minutes to run the notebooks, so please be patient.