-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add Yosys LEC flow support #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
Open
zhaoxueyan1
wants to merge
1
commit into
main
Choose a base branch
from
integrate-lec
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
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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -51,7 +51,8 @@ def has_init(self): | |||||||||||||||||
| def init_flow_step(self, | ||||||||||||||||||
| step : StepEnum | str, | ||||||||||||||||||
| tool : str, | ||||||||||||||||||
| state : str | StateEnum): | ||||||||||||||||||
| state : str | StateEnum, | ||||||||||||||||||
| info: dict | None = None): | ||||||||||||||||||
| step_value = step.value if isinstance(step, StepEnum) else step | ||||||||||||||||||
| state_value = state.value if isinstance(state, StateEnum) else state | ||||||||||||||||||
| return { | ||||||||||||||||||
|
|
@@ -60,15 +61,16 @@ def init_flow_step(self, | |||||||||||||||||
| "state" : state_value, # step state | ||||||||||||||||||
| "runtime" : "", # step run time | ||||||||||||||||||
| "peak memory (mb)" : 0, # step peak memory | ||||||||||||||||||
| "info" : {} # step additional infomation | ||||||||||||||||||
| "info" : info or {} # step additional infomation | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| def add_step(self, | ||||||||||||||||||
| step : StepEnum | str, | ||||||||||||||||||
| tool : str, | ||||||||||||||||||
| state : str | StateEnum): | ||||||||||||||||||
| state : str | StateEnum, | ||||||||||||||||||
| info: dict | None = None): | ||||||||||||||||||
| steps = self.workspace.flow.data.get("steps", []) | ||||||||||||||||||
| steps.append(self.init_flow_step(step, tool, state)) | ||||||||||||||||||
| steps.append(self.init_flow_step(step, tool, state, info=info)) | ||||||||||||||||||
|
|
||||||||||||||||||
| self.workspace.flow.data = {"steps" : steps} | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -172,6 +174,11 @@ def check_step_result(self, | |||||||||||||||||
| """ | ||||||||||||||||||
| import os | ||||||||||||||||||
| success = False | ||||||||||||||||||
| if ( | ||||||||||||||||||
| workspace_step.tool == "yosys_lec" | ||||||||||||||||||
| or workspace_step.name in (StepEnum.LEC.value, StepEnum.POST_ROUTE_LEC.value) | ||||||||||||||||||
| ): | ||||||||||||||||||
| return os.path.exists(workspace_step.output.get("json", "")) | ||||||||||||||||||
|
Comment on lines
+177
to
+181
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer to use
Suggested change
|
||||||||||||||||||
| match workspace_step.name: | ||||||||||||||||||
| case StepEnum.SYNTHESIS.value: | ||||||||||||||||||
| if os.path.exists(workspace_step.output.get("verilog", "")): | ||||||||||||||||||
|
|
@@ -197,6 +204,8 @@ def create_step_workspaces(self): | |||||||||||||||||
| create all step workspaces | ||||||||||||||||||
| """ | ||||||||||||||||||
| pre_step = None | ||||||||||||||||||
| synthesis_gate_verilog = "" | ||||||||||||||||||
| synthesis_golden_verilog = "" | ||||||||||||||||||
| for step in self.workspace.flow.data.get("steps", []): | ||||||||||||||||||
| if pre_step is None: | ||||||||||||||||||
| # use the origin def and verilog in workspace for the first step. | ||||||||||||||||||
|
|
@@ -209,6 +218,16 @@ def create_step_workspaces(self): | |||||||||||||||||
| input_verilog = pre_step.output.get("verilog", "") | ||||||||||||||||||
| input_db = pre_step.output.get("db", "") | ||||||||||||||||||
|
|
||||||||||||||||||
| if step["tool"] == "yosys_lec": | ||||||||||||||||||
| step_info = step.get("info", {}) or {} | ||||||||||||||||||
| explicit_golden = step_info.get("golden_verilog", "") | ||||||||||||||||||
| if explicit_golden: | ||||||||||||||||||
| input_db = explicit_golden | ||||||||||||||||||
| elif step["name"] == StepEnum.POST_ROUTE_LEC.value: | ||||||||||||||||||
| input_db = synthesis_gate_verilog | ||||||||||||||||||
| elif pre_step is not None and pre_step.name == StepEnum.SYNTHESIS.value: | ||||||||||||||||||
| input_db = synthesis_golden_verilog | ||||||||||||||||||
|
|
||||||||||||||||||
| from chipcompiler.tools import create_step, run_step | ||||||||||||||||||
| # create workspace step | ||||||||||||||||||
| eda_step = create_step(workspace=self.workspace, | ||||||||||||||||||
|
|
@@ -225,6 +244,9 @@ def create_step_workspaces(self): | |||||||||||||||||
| eda_step.output["spef"] = pre_step.output.get("spef", []) | ||||||||||||||||||
| self.workspace_steps.append(eda_step) | ||||||||||||||||||
| pre_step = eda_step | ||||||||||||||||||
| if eda_step.name == StepEnum.SYNTHESIS.value: | ||||||||||||||||||
| synthesis_gate_verilog = eda_step.output.get("verilog", "") | ||||||||||||||||||
| synthesis_golden_verilog = eda_step.output.get("golden_verilog", "") | ||||||||||||||||||
| else: | ||||||||||||||||||
| # error create step, TBD | ||||||||||||||||||
| pass | ||||||||||||||||||
|
|
||||||||||||||||||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,11 +1,15 @@ | ||
| from .builder import ( | ||
| build_rtl2gds_flow, | ||
| build_harden_flow, | ||
| build_rcx_flow | ||
| build_rcx_flow, | ||
| build_synthesis_lec_flow, | ||
| build_post_route_lec_flow | ||
| ) | ||
|
|
||
| __all__ = [ | ||
| 'build_rtl2gds_flow', | ||
| 'build_harden_flow', | ||
| 'build_rcx_flow' | ||
| 'build_rcx_flow', | ||
| 'build_synthesis_lec_flow', | ||
| 'build_post_route_lec_flow' | ||
| ] |
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -113,6 +113,7 @@ def generate_global_var_tcl(workspace: Workspace, | |
|
|
||
| # Output files | ||
| set final_netlist_file {_tcl_quote(netlist_file)} | ||
| set golden_netlist_file {_tcl_quote(_abspath(step.output.get("golden_verilog", "")))} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please fix this. |
||
| set timing_cell_stat_rpt {_tcl_quote(timing_cell_stat_rpt)} | ||
| set timing_cell_count_rpt {_tcl_quote(timing_cell_count_rpt)} | ||
| set generic_stat_json {_tcl_quote(generic_stat_json)} | ||
|
|
@@ -180,12 +181,14 @@ def build_step(workspace: Workspace, | |
|
|
||
| if output_verilog is None: | ||
| output_verilog = f"{step.directory}/output/{workspace.design.name}_{step.name}.v" | ||
| golden_verilog = f"{step.directory}/output/{workspace.design.name}_{step_name}_golden.v" | ||
| if output_def is None: | ||
| output_def = f"{step.directory}/output/{workspace.design.name}_{step.name}.def.gz" | ||
| step.output = { | ||
| "dir": f"{step.directory}/output", | ||
| "def": output_def, | ||
| "verilog": output_verilog, | ||
| "golden_verilog": golden_verilog, | ||
| "fixed_verilog": f"{step.directory}/output/{workspace.design.name}_{step.name}_fixed.v", | ||
| "json": f"{step.directory}/output/{workspace.design.name}_{step.name}.json", | ||
| "report": f"{step.directory}/output/{workspace.design.name}_{step.name}.rpt", | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,18 @@ | ||
| from .builder import ( | ||
| build_step, | ||
| build_step_space, | ||
| build_step_config, | ||
| ) | ||
|
|
||
| from .runner import run_step | ||
| from .subflow import YosysLecSubFlow | ||
| from .utility import is_eda_exist | ||
|
|
||
| __all__ = [ | ||
| "is_eda_exist", | ||
| "build_step", | ||
| "build_step_space", | ||
| "build_step_config", | ||
| "run_step", | ||
| "YosysLecSubFlow", | ||
| ] |
Oops, something went wrong.
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.
Please fix this.