-
Notifications
You must be signed in to change notification settings - Fork 49
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
Universal Yosys module #581
base: main
Are you sure you want to change the base?
Conversation
99ba21a
to
c73e210
Compare
587d188
to
0c9fd3f
Compare
f5ada6f
to
6c11391
Compare
78ff0d1
to
eebe733
Compare
9c2c779
to
978589c
Compare
Changing this to a draft, to be rebased after #604 is merged. |
To be complemented with f4pga/f4pga-arch-defs#2851. |
a58e880
to
0cb8079
Compare
0cb8079
to
0813ba9
Compare
45da1d9
to
0cb8079
Compare
c533d72
to
94b8b09
Compare
Marking as ready for review, as for now the most effective approach is probably to keep a separate copy of Tcl scripts to use with legacy tooling (arch-defs), until we figure out how to fully transition to using |
f4pga/flows/platforms.yml
Outdated
yosys_plugins: | ||
- ql-iob | ||
- ql-qlf | ||
split_inouts: |
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.
See comment above.
f4pga/flows/common.py
Outdated
@@ -30,6 +30,7 @@ | |||
|
|||
bin_dir_path = str(Path(sys_argv[0]).resolve().parent.parent) | |||
share_dir_path = str(F4PGA_SHARE_DIR) | |||
aux_dir_path = str(Path(__file__).resolve().parent.parent / "aux") |
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.
aux
is a reserved keyword on some systems. Please, use a different name/location for the aux_dir_path. I would suggest to put the TCL scripts added in this PR into f4pga/flows/tcl
.
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.
Aux stands for "auxilary". The directory is mean to hold all sorts of auxilary scripts/data. I think it's more convinient to havve one, well-structured directory for such things callend "aux", rather than having one for tcl, one for python, etc and creating a separate variable for each such directory.
Could you give me an example of how this "aux" would interfere with some systems?
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.
Could you give me an example of how this "aux" would interfere with some systems?
Cloning this branch on an NTFS drive on Fedora produces the following error:
$ git clone https://github.com/antmicro/f4pga
Cloning into 'f4pga'...
remote: Enumerating objects: 5008, done.
remote: Counting objects: 100% (5008/5008), done.
remote: Compressing objects: 100% (1855/1855), done.
remote: Total 5008 (delta 3007), reused 4971 (delta 2995), pack-reused 0
Receiving objects: 100% (5008/5008), 241.55 MiB | 16.21 MiB/s, done.
Resolving deltas: 100% (3007/3007), done.
$ cd f4pga/
$ git checkout -b test-branch origin/yosys_module
fatal: cannot create directory at 'f4pga/aux': Invalid argument
See also https://www.google.com/search?q=aux+reserved+filename.
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.
I think it's more convinient to havve one, well-structured directory for such things callend "aux", rather than having one for tcl, one for python, etc and creating a separate variable for each such directory.
So far, we only have TCL assets (which will very probably be removed soon) and a single YAML file. Python code is installed as part of the package and it does not need any separated variable.
Let's not overengineer the implementations. Better wait until the need arises. Please, focus on the core functionality that this PR is trying to bring.
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.
How are you going to remove Tcl scripts? The old ones might be removed at some point, but I don't think that the new ones are going to be purged as well.
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.
I renamed aux
to auxiliary
. That should fix the problem with nonsensical filesystems.
I'm not entirely sure what data is going to be used in the future. Whether it's auxiliary
directory or tcl
doesn't really change the complexity of my current solution.
Signed-off-by: Krzysztof Boronski <[email protected]>
Signed-off-by: Krzysztof Boronski <[email protected]>
Extracted common Tcl utility commands into another Tcl sctipt Signed-off-by: Krzysztof Boronski <[email protected]>
Signed-off-by: Krzysztof Boronski <[email protected]>
* use ttop value instead of eblif path for bitstream file name * io_rename fixes, eos-s3 flow: sdc-in -> sdc Signed-off-by: Krzysztof Boronski <[email protected]>
Signed-off-by: Krzysztof Boronski <[email protected]>
Signed-off-by: Unai Martinez-Corral <[email protected]>
Signed-off-by: Krzysztof Boronski <[email protected]>
… comments about optional outputs Signed-off-by: Krzysztof Boronski <[email protected]>
Signed-off-by: Krzysztof Boronski <[email protected]>
@@ -0,0 +1,61 @@ | |||
# Copyright (C) 2022 F4PGA Authors |
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.
This seems to be sourced in synth.tcl
only. Is there any reason not to copy the content there? See https://github.com/chipsalliance/f4pga/blob/main/f4pga/wrappers/tcl/xc7.f4pga.tcl#L14-L58.
@@ -18,7 +18,16 @@ | |||
|
|||
set -e | |||
|
|||
SYNTH_TCL_PATH="$(python3 -m f4pga.wrappers.tcl synth)" | |||
MYPATH=`realpath $0` |
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.
Since the current proposal is to duplicate the TCL pipelines, please keep f4pga.wrappers.sh
untouched in this PR. Move these changes to a follow-up PR.
@@ -58,8 +58,8 @@ def execute(self, ctx: ModuleContext): | |||
if ctx.outputs.util_rpt: | |||
(build_dir / DEFAULT_UTIL_RPT).rename(ctx.outputs.util_rpt) | |||
|
|||
def __init__(self, _): | |||
self.name = "pack" | |||
def __init__(self, params, r_env, instance_name): |
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.
What is the motivation for this change? Can it be handled as an standalone PR?
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.
The motivation is to grab be able to access stage's name. When yosys module gets called twice in a flow, it should output different log targets. Names of these targets are based on the name of a stage.
I think this change could be handled in a separate PR.
This change can also be used to remove stage_name
field from generic_script_wrapper
.
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, split it to a separate PR, so we can analyse that feature on its own. If most of the stages receive params, r_env and instance_name, it might be worth wrapping those in an object/class and use it as the payload from stage to stage.
What about r_env
?
|
||
# Write output JSON, fixup cell names using an external Python script | ||
write_json $f4pga_json_org | ||
exec $f4pga_python3 ${f4pga_shareDir}/scripts/yosys_fixup_cell_names.py $f4pga_json_org $f4pga_json_presplit |
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.
After rebasing, use -m f4pga.utils.quicklogic.yosys_fixup_cell_names
and -m f4pga.utils.yosys_split_inouts
as in https://github.com/chipsalliance/f4pga/blob/main/f4pga/wrappers/tcl/eos-s3.f4pga.tcl#L176-L194.
45d5d7e
to
3be9135
Compare
Signed-off-by: Krzysztof Boronski <[email protected]>
The synth module is quite troublesome, because its outputs are dependent on the contents of a Tcl script used by Yosys. This PR is an attempt to solve this issue by replacing this module with an universal Yosys module.
Content description
The approach is to create a binding mechanism for variables used in Tcl script that allows f4pga to inspect the I/O of the script. This is achieved by replacing direct references to environmental variables with calls to
f4pga
command in Tcl script. f4pga provides its implementation of Tclf4pga
command that gathers metadata from the arguments and creates dummy bindings for those variables. The Tcl script is then executed by a Tcl interpreter within f4pga using that implementation when instantiating the module. This allows the module to inspect I/O of the script and present stage dependencies and values. Then when the script gets passed to yosys, it gets prefixed with an alternative implementation off4pga
command, one that reads environmental variables. Those variables are provided by the yosys module during execution stage, or by legacy wrappers*.* Legacy wrappers require changes in names of environmental variables in order to work with this.
Features
Caveats
f4pga_exec.tcl
script first. If anybody is using those scripts in a standalone manner, this could be a confusing change.Work being done