f4pga: convert part_db from JSON to YAML

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-08-15 03:42:56 +02:00
parent 86f281349f
commit 1790852271
5 changed files with 52 additions and 37 deletions

View File

@ -41,6 +41,7 @@ from pathlib import Path
from argparse import Namespace from argparse import Namespace
from sys import argv as sys_argv from sys import argv as sys_argv
from os import environ from os import environ
from yaml import load as yaml_load, Loader as yaml_loader
from json import load as json_load from json import load as json_load
from typing import Iterable from typing import Iterable
from colorama import Fore, Style 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 The reason for such distinction is that plenty of chips with different names
differ only in a type of package they use. differ only in a type of package they use.
""" """
with (ROOT / 'part_db.json').open('r') as rfptr: with (ROOT / 'part_db.yml').open('r') as rfptr:
for key, val in json_load(rfptr).items(): for key, val in yaml_load(rfptr, yaml_loader).items():
if part_name.upper() in val: if part_name.upper() in val:
return key return key
raise Exception(f"Unknown part name <{part_name}>!") raise Exception(f"Unknown part name <{part_name}>!")

View File

@ -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"
]
}

47
f4pga/part_db.yml Normal file
View File

@ -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

View File

@ -1 +1,2 @@
colorama colorama
pyyaml

View File

@ -88,7 +88,7 @@ setuptools_setup(
package_dir={"f4pga": "."}, package_dir={"f4pga": "."},
package_data={ package_data={
'f4pga': [ 'f4pga': [
'*.json', '*.yml',
'platforms/*.json' 'platforms/*.json'
], ],
'f4pga.wrappers.sh': [ 'f4pga.wrappers.sh': [