From 17908522711ebb8a8cbe34e530101fdaf9eae4f0 Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Mon, 15 Aug 2022 03:42:56 +0200 Subject: [PATCH] f4pga: convert part_db from JSON to YAML Signed-off-by: Unai Martinez-Corral --- f4pga/__init__.py | 5 +++-- f4pga/part_db.json | 34 ------------------------------ f4pga/part_db.yml | 47 ++++++++++++++++++++++++++++++++++++++++++ f4pga/requirements.txt | 1 + f4pga/setup.py | 2 +- 5 files changed, 52 insertions(+), 37 deletions(-) delete mode 100644 f4pga/part_db.json create mode 100644 f4pga/part_db.yml diff --git a/f4pga/__init__.py b/f4pga/__init__.py index 6662a2f..37d85f6 100755 --- a/f4pga/__init__.py +++ b/f4pga/__init__.py @@ -41,6 +41,7 @@ from pathlib import Path from argparse import Namespace from sys import argv as sys_argv from os import environ +from yaml import load as yaml_load, Loader as yaml_loader from json import load as json_load from typing import Iterable from colorama import Fore, Style @@ -593,8 +594,8 @@ def get_platform_name_for_part(part_name: str): The reason for such distinction is that plenty of chips with different names differ only in a type of package they use. """ - with (ROOT / 'part_db.json').open('r') as rfptr: - for key, val in json_load(rfptr).items(): + with (ROOT / 'part_db.yml').open('r') as rfptr: + for key, val in yaml_load(rfptr, yaml_loader).items(): if part_name.upper() in val: return key raise Exception(f"Unknown part name <{part_name}>!") diff --git a/f4pga/part_db.json b/f4pga/part_db.json deleted file mode 100644 index 072d51b..0000000 --- a/f4pga/part_db.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "xc7a50t": [ - "XC7A50TCSG324-1", - "XC7A35TCSG324-1", - "XC7A35TCPG236-1" - ], - "xc7a100t": [ - "XC7A100TCSG324-1", - "XC7A100TFGG484-2" - ], - "xc7a200t": [ - "XC7A200TSBG484-1" - ], - "xc7z010t": [ - "XC7C010CLG400-1" - ], - "ql-eos-s3": [ - "EOS3FF512-PDN64", - "EOS3FF512-WRN42", - "EOS3FLF512-PDN64", - "EOS3FLF512-WRN42", - "EOS3CF512-PDN64", - "EOS3CF512-WRN42", - "EOS3CLF512-PDN64", - "EOS3CLF512-WRN42" - ], - "ql-k4n8_slow": [ - "K4N8", - "K4N8_SLOW" - ], - "ql-k4n8_fast": [ - "K4N8_FAST" - ] -} diff --git a/f4pga/part_db.yml b/f4pga/part_db.yml new file mode 100644 index 0000000..b04020a --- /dev/null +++ b/f4pga/part_db.yml @@ -0,0 +1,47 @@ +# Copyright (C) 2022 F4PGA Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +xc7a50t: + - XC7A50TCSG324-1 + - XC7A35TCSG324-1 + - XC7A35TCPG236-1 + +xc7a100t: + - XC7A100TCSG324-1 + - XC7A100TFGG484-2 + +xc7a200t: + - XC7A200TSBG484-1 + +xc7z010t: + - XC7C010CLG400-1 + +ql-eos-s3: + - EOS3FF512-PDN64 + - EOS3FF512-WRN42 + - EOS3FLF512-PDN64 + - EOS3FLF512-WRN42 + - EOS3CF512-PDN64 + - EOS3CF512-WRN42 + - EOS3CLF512-PDN64 + - EOS3CLF512-WRN42 + +ql-k4n8_slow: + - K4N8 + - K4N8_SLOW + +ql-k4n8_fast: + - K4N8_FAST diff --git a/f4pga/requirements.txt b/f4pga/requirements.txt index 3fcfb51..552c616 100644 --- a/f4pga/requirements.txt +++ b/f4pga/requirements.txt @@ -1 +1,2 @@ colorama +pyyaml diff --git a/f4pga/setup.py b/f4pga/setup.py index 99dd82c..baf6641 100644 --- a/f4pga/setup.py +++ b/f4pga/setup.py @@ -88,7 +88,7 @@ setuptools_setup( package_dir={"f4pga": "."}, package_data={ 'f4pga': [ - '*.json', + '*.yml', 'platforms/*.json' ], 'f4pga.wrappers.sh': [