f4pga/flows: mv common_modules modules (#638)

This commit is contained in:
Unai Martinez-Corral 2022-09-28 23:12:16 +02:00 committed by GitHub
commit e0037de59f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 50 additions and 73 deletions

View File

@ -33,7 +33,6 @@ from f4pga.flows.common import (
F4PGAException,
ResolutionEnv,
fatal,
scan_modules,
set_verbosity_level,
sfprint,
sub as common_sub,
@ -195,8 +194,6 @@ def make_flow_config(project_flow_cfg: ProjectFlowConfig, part_name: str) -> Flo
r_env = setup_resolution_env()
r_env.add_values({"part_name": part_name.lower()})
scan_modules(str(ROOT))
with (ROOT / "platforms.yml").open("r") as rfptr:
platforms = yaml_load(rfptr, yaml_loader)
if platform not in platforms:

View File

@ -64,34 +64,14 @@ def with_qualifier(name: str, q: str) -> str:
return decompose_depname(name)[0] + "!"
_sfbuild_module_collection_name_to_path = {}
def scan_modules(mypath: str):
global _sfbuild_module_collection_name_to_path
sfbuild_home = mypath
_sfbuild_module_collection_name_to_path = {
re_match("(.*)_modules$", moddir).groups()[0]: str(Path(sfbuild_home) / moddir)
for moddir in [dir for dir in os_listdir(sfbuild_home) if re_match(".*_modules$", dir)]
}
def resolve_modstr(modstr: str):
"""
Resolves module location from modulestr.
Resolves module location given its name.
"""
sl = modstr.split(":")
if len(sl) > 2:
raise Exception("Incorrect module sysntax. Expected one ':' or one '::'")
if len(sl) < 2:
return modstr
collection_name = sl[0]
module_filename = sl[1] + ".py"
col_path = _sfbuild_module_collection_name_to_path.get(collection_name)
if not col_path:
fatal(-1, f"Module collection {collection_name} does not exist")
return str(Path(col_path) / module_filename)
modpath = Path(__file__).resolve().parent / f"modules/{modstr}.py"
if not modpath.exists():
raise Exception(f"Unknown module <{modstr}>!")
return str(modpath)
def deep(fun, allow_none=False):

View File

@ -20,7 +20,7 @@
import pathlib
from f4pga.flows.common import ResolutionEnv
from f4pga.flows.module import ModuleContext
from f4pga.flows.common_modules.nextpnr import NextPnrBaseModule
from f4pga.flows.modules.nextpnr import NextPnrBaseModule
import re
from pathlib import Path

View File

@ -55,11 +55,11 @@ xc7a50t: &xc7
stages:
mk_build_dir:
module: 'common:mkdirs'
module: 'mkdirs'
params:
build_dir: 'build/${device}'
synth:
module: 'common:yosys'
module: 'yosys'
params:
takes:
- xdc?
@ -85,9 +85,9 @@ xc7a50t: &xc7
UTILS_PATH: '${shareDir}/scripts'
INPUT_XDC_FILES: '${:xdc}'
pack:
module: 'common:pack'
module: 'pack'
ioplace:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: ioplace
interpreter: '${python3}'
@ -103,7 +103,7 @@ xc7a50t: &xc7
pcf: '${:pcf?}'
$PYTHONPATH: '${binDir}/python/'
place_constraints:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: place_constraints
interpreter: '${python3}'
@ -122,13 +122,13 @@ xc7a50t: &xc7
vpr_grid_map: '${shareDir}/arch/${device}/vpr_grid_map.csv'
$PYTHONPATH: '${binDir}/python/'
place:
module: 'common:place'
module: 'place'
route:
module: 'common:route'
module: 'route'
fasm:
module: 'common:fasm'
module: 'fasm'
bitstream:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: bitstream
script: xcfasm
@ -189,11 +189,11 @@ ice40:
stages:
mk_build_dir:
module: 'common:mkdirs'
module: 'mkdirs'
params:
build_dir: build/${device}
synth:
module: 'common:yosys'
module: 'yosys'
params:
takes:
produces:
@ -202,12 +202,12 @@ ice40:
yosys_tcl_env:
OUT_JSON: '${:json}'
pnr:
module: 'common:nextpnr_ice40'
module: 'nextpnr_ice40'
values:
placer: heap
router: router1
bitstream:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: bitstream
script: icepack
@ -257,11 +257,11 @@ ql-eos-s3:
stages:
mk_build_dir:
module: 'common:mkdirs'
module: 'mkdirs'
params:
build_dir: 'build/${device}'
synth:
module: 'common:yosys'
module: 'yosys'
params:
takes:
- pcf?
@ -284,7 +284,7 @@ ql-eos-s3:
PYTHON3: '${python3}'
UTILS_PATH: '${shareDir}/scripts'
prepare_sdc:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: prepare_sdc
interpreter: '${python3}'
@ -302,7 +302,7 @@ ql-eos-s3:
pin-map: ''
$PYTHONPATH: '${shareDir}/scripts/'
pack:
module: 'common:pack'
module: 'pack'
values:
device: ql-eos-s3
device_alt: ql-eos-s3_wlcsp
@ -338,7 +338,7 @@ ql-eos-s3:
suppress_warnings: >-
${noisyWarnings},sum_pin_class:check_unbuffered_edges:load_rr_indexed_data_T_values:check_rr_node:trans_per_R:check_route:set_rr_graph_tool_comment
ioplace:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: ioplace
interpreter: '${python3}'
@ -354,7 +354,7 @@ ql-eos-s3:
map: '${shareDir}/arch/ql-eos-s3_wlcsp/pinmap_${package}.csv'
$PYTHONPATH: '${shareDir}/scripts/'
place_constraints:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: place_constraints
interpreter: '${python3}'
@ -369,9 +369,9 @@ ql-eos-s3:
i: '${:io_place}'
$PYTHONPATH: '${shareDir}/scripts/'
place:
module: 'common:place'
module: 'place'
iomux_jlink:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: iomux_jlink
interpreter: '${python3}'
@ -387,7 +387,7 @@ ql-eos-s3:
output-format: jlink
$PYTHONPATH: '${shareDir}/scripts/'
iomux_openocd:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: iomux_openocd
interpreter: '${python3}'
@ -403,7 +403,7 @@ ql-eos-s3:
output-format: openocd
$PYTHONPATH: '${shareDir}/scripts/'
iomux_binary:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: iomux_binary
interpreter: '${python3}'
@ -419,7 +419,7 @@ ql-eos-s3:
output-format: binary
$PYTHONPATH: '${shareDir}/scripts/'
route:
module: 'common:route'
module: 'route'
values:
device: ql-eos-s3
device_alt: ql-eos-s3_wlcsp
@ -455,7 +455,7 @@ ql-eos-s3:
suppress_warnings: >-
${noisyWarnings},sum_pin_class:check_unbuffered_edges:load_rr_indexed_data_T_values:check_rr_node:trans_per_R:check_route:set_rr_graph_tool_comment
analysis:
module: 'common:analysis'
module: 'analysis'
values:
device: ql-eos-s3
device_alt: ql-eos-s3_wlcsp
@ -495,9 +495,9 @@ ql-eos-s3:
suppress_warnings: >-
${noisyWarnings},sum_pin_class:check_unbuffered_edges:load_rr_indexed_data_T_values:check_rr_node:trans_per_R:check_route:set_rr_graph_tool_comment
fasm:
module: 'common:fasm'
module: 'fasm'
bitstream:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: bitstream
script: qlfasm
@ -516,7 +516,7 @@ ql-eos-s3:
values:
build_dir: .
bitstream_bitheader:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: bitstream_bitheader
script: symbiflow_write_bitheader
@ -533,7 +533,7 @@ ql-eos-s3:
'#2': '${:bitstream}.h'
'#3': '${:iomux_binary}'
bitstream_jlink:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: bitstream_jlink
script: symbiflow_write_jlink
@ -550,7 +550,7 @@ ql-eos-s3:
'#2': '${:bitstream}.jlink'
'#3': '${:iomux_jlink}'
bitstream_openocd:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: bitstream_openocd
script: symbiflow_write_openocd
@ -567,7 +567,7 @@ ql-eos-s3:
'#2': '${:bitstream}.openocd'
'#3': '${:iomux_openocd}'
bitstream_binary:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: bitstream_binary
script: symbiflow_write_binary
@ -584,7 +584,7 @@ ql-eos-s3:
'#2': '${:bitstream}.bin'
'#3': '${:iomux_binary}'
fasm2bels:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: fasm2bels
script: symbiflow_fasm2bels
@ -646,11 +646,11 @@ ql-k4n8_fast: &ql-k4n8
stages: &ql-k4n8-stages
mk_build_dir:
module: 'common:mkdirs'
module: 'mkdirs'
params:
build_dir: 'build/${device}'
synth:
module: 'common:yosys'
module: 'yosys'
params:
produces:
- synth_v
@ -666,9 +666,9 @@ ql-k4n8_fast: &ql-k4n8
OUT_EBLIF: '${:eblif}'
PYTHON3: '${python3}'
pack:
module: 'common:pack'
module: 'pack'
ioplace:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: ioplace
interpreter: '${python3}'
@ -687,7 +687,7 @@ ql-k4n8_fast: &ql-k4n8
${shareDir}/arch/qlf_k4n8-qlf_k4n8_umc22_fast_qlf_k4n8-qlf_k4n8_umc22_fast/pinmap_qlf_k4n8_umc22.csv
$PYTHONPATH: '${binDir}/python/'
repack: &ql-k4n8-stages-repack
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: repack
interpreter: '${python3}'
@ -725,25 +725,25 @@ ql-k4n8_fast: &ql-k4n8
repacking_rules: >-
${shareDir}/arch/qlf_k4n8-qlf_k4n8_umc22_fast_qlf_k4n8-qlf_k4n8_umc22_fast/qlf_k4n8-qlf_k4n8_umc22_fast.repacking_rules.json
place:
module: 'common:place'
module: 'place'
route:
module: 'common:io_rename'
module: 'io_rename'
params:
module: 'common:route'
module: 'route'
rename_takes:
eblif: eblif_repacked
place: place_repacked
net: net_repacked
fasm:
module: 'common:io_rename'
module: 'io_rename'
params:
module: 'common:fasm'
module: 'fasm'
rename_takes:
eblif: eblif_repacked
place: place_repacked
net: net_repacked
bitstream:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: bitstream
script: qlf_fasm
@ -780,7 +780,7 @@ ql-k4n8_slow:
stages:
<<: *ql-k4n8-stages
ioplace:
module: 'common:generic_script_wrapper'
module: 'generic_script_wrapper'
params:
stage_name: ioplace
interpreter: '${python3}'