From 0cd104463ed8491bad6d46d23b36ee38f575a701 Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Tue, 23 Feb 2021 22:07:35 +0100 Subject: [PATCH 1/3] docs: Update "new device" section Signed-off-by: Daniel Schultz --- docs/db_dev_process/newpart.rst | 86 +++++++-------------------------- 1 file changed, 18 insertions(+), 68 deletions(-) diff --git a/docs/db_dev_process/newpart.rst b/docs/db_dev_process/newpart.rst index ff4a974e..cd38d6ca 100644 --- a/docs/db_dev_process/newpart.rst +++ b/docs/db_dev_process/newpart.rst @@ -10,9 +10,6 @@ are just more or fewer of them, arranged differently. No new fuzzers are needed. You just need to rerun some fuzzers for the new device to understand how the tiles are connected to each other and to IOs. -*If you are*\ \ **just**\ \ *adding a new package for a device that is -already supported, you can skip Steps 2 through 5.* - Note: Since this guide was written, the xc7a100t has become the primary device in the database, not a secondary device as it was when it was originally added. Therefore the files currently in the repo don’t match @@ -100,50 +97,28 @@ Source this new settings file: Step 3 ~~~~~~ -Add all informations about the part. YAML files for each family are located -at database//mapping/, which contain the part information (parts.yaml), -device to fabric mapping (devices.yaml) or hints about resources -(resources.yaml). - -The first file contains a mapping between a part number and informations -about the device, package and speed grade used by the fuzzers. The -complete part number is used as key. Device, package and speedgrade are parts -of the part numbers. +The project needs to know which device is now available and which fabric it +uses. Because some devices share the same fabric, this mapping needs to be +done manuelly. Edit the device.yaml file for the used family under +settings//device.yaml be adding the device-fabric mapping: :: - "xc7a100tcsg324-1": - device: "xc7a100t" - package: "csg324" - speedgrade: "1" - pins: - 0: "N15" - 1: "U17" - 2: "V17" - 3: "V16" - 4: "V14" - 5: "U14" - 6: "U16" -The second file maps devices to fabrics. Because some fabrics are added to -multiple devices, they are only generated for one and parts with the same link -to the result. - -:: + # device to fabric mapping + "xc7a200t": + fabric: "xc7a200t" + "xc7a100t": + fabric: "xc7a100t" "xc7a50t": fabric: "xc7a50t" "xc7a35t": fabric: "xc7a50t" -The last file contains information about the information about a resource -to support the fuzzers generating the informations. The dictionary pins -defines package pins with the following purpose: +Now, generate all device information for the family: -- ``00`` – this must be a clock pin. You can look at the device in the Vivado - GUI interactively (click on IOs and check their properties until you find - one with IS_CLOCK=true), or run a small clocked design in Vivado and see - which pin is assigned to ‘clk’. +:: -- ``01`` and on – these should be normal data pins on the device. + make db-prepare-artix7 Step 4 ~~~~~~ @@ -170,8 +145,9 @@ Step 5 ~~~~~~ Make sure you’ve sourced your new device settings file (see the end of -step 2). Now it is time to run some fuzzers to figure out how the tiles -on your new device are connected. +step 2) and generated the device information (see the end of set 3). Now it is +time to run some fuzzers to figure out how the tiles on your new device are +connected. Make the following target, with ```` as above, and setting the parallelism factor ``-j`` appropriate for the number of cores @@ -223,34 +199,12 @@ Step 6 The next task is handling the extra parts – those not fully bonded out. These are usually the parts you actually have on the boards you buy. -- Add a new entry in the appropriate ‘harness’ section for any - alternative packages (typically with fewer pins, in this example, 324 - versus 676). If any ``XRAY_PIN_`` values you listed in the - settings file are not bonded out on the new part, you must specify - alternatives. In this example, we need to specify a new clock pin, - ``XRAY_PIN_00=N15``. Here, ``XRAY_PART`` is the extra part, and - ``XRAY_EQUIV_PART`` is the original, fully-bonded version: +After the fabric data is generated with step 5, an further target can generate +all extra parts for the device. :: - db-extras-artix7-harness: - +source settings/artix7.sh && \ - XRAY_PART=xc7a35tftg256-1 $(MAKE) -C fuzzers roi_only - + +source settings/artix7_100t.sh && \ - + XRAY_PART=xc7a100tcsg324-1 $(MAKE) -C fuzzers roi_only - +source settings/artix7_200t.sh && \ - XRAY_PIN_00=V10 XRAY_PIN_01=W10 XRAY_PIN_02=Y11 XRAY_PIN_03=Y12 \ - XRAY_PART=xc7a200tsbg484-1 XRAY_EQUIV_PART=xc7a200tffg1156-1 \ - $(MAKE) -C fuzzers roi_only - -Make the appropriate harness target (adjusting for your family): - -:: - - make -j32 db-extras-artix7-harness - -This target will make updates for the extra parts of all of the family -devices, not just your new device. + make -j MAX_VIVADO_PROCESS= db-roi-only- Step 7 ~~~~~~ @@ -280,10 +234,6 @@ Do a spot check. -rw-rw-r-- 1 daniel daniel 18840 Jan 9 09:58 part.json -rw-rw-r-- 1 daniel daniel 13099 Jan 9 09:58 part.yaml -In this case, the tile grid is the same size since it’s the same chip, -but the size of the package pins files differs, since there are -different numbers of bonded pins. - Note: These changes/additions under ``database/`` do *not* get checked in. They are in the ``prjxray-db`` repo. This spot check is to make sure that your changes in ``prjxray`` will do the right thing when the From f562d6acfd731759e64d1f618dee58704c6196f0 Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Thu, 18 Mar 2021 21:41:49 +0100 Subject: [PATCH 2/3] Makefile: Do not dump the environment during db-prepare The resources.yaml file does not exists at the beginning of the db-prepare calls but the environment wants to read it which leads to the following error: Preparing artix7 files ============================ Traceback (most recent call last): File ".../prjxray/utils/create_environment.py", line 62, in main() File ".../prjxray/utils/create_environment.py", line 55, in main environment = get_environment_variables() File ".../prjxray/utils/create_environment.py", line 37, in get_environment_variables part_info = get_part_information(db_root, part) File ".../prjxray/prjxray/util.py", line 44, in get_part_information "Mapping file {} does not exists".format(filename) AssertionError: Mapping file .../prjxray/database/artix7/mapping/parts.yaml does not exists Do not dump the environment during this stage because the XRAY_PART is the only neccessary information which is set in the .sh script. Signed-off-by: Daniel Schultz --- Makefile | 4 ++-- utils/create_environment.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 782f2504..f436df89 100644 --- a/Makefile +++ b/Makefile @@ -144,8 +144,8 @@ db-prepare-$(1): @echo "============================" @mkdir -p database/$(1)/mapping @cp settings/$(1)/devices.yaml database/$(1)/mapping/ - @+source settings/$(1).sh && $(IN_ENV) ./utils/update_parts.py $(1) - @+source settings/$(1).sh && $(IN_ENV) ./utils/update_resources.py $(1) + @+SKIP_ENV=true source settings/$(1).sh && $(IN_ENV) ./utils/update_parts.py $(1) + @+SKIP_ENV=true source settings/$(1).sh && $(IN_ENV) ./utils/update_resources.py $(1) db-$(1): +source settings/$(1).sh && $$(MAKE) -C fuzzers diff --git a/utils/create_environment.py b/utils/create_environment.py index 852c2218..9303ebdd 100755 --- a/utils/create_environment.py +++ b/utils/create_environment.py @@ -49,6 +49,13 @@ def get_environment_variables(): def main(): + # Only dump the environment when the resource.yaml file for the family + # exists to prevent errors during the creation on the stdout. + # SKIP_ENV in the environment turns off the environment dump for updating + # all parts and resources, which will create the resource.yaml file. + if 'SKIP_ENV' in os.environ: + return + environment = get_environment_variables() for key, value in environment.items(): From 969f1dd5eeaacbc4e9d5c570825e0e0d4ed22a94 Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Fri, 19 Mar 2021 17:11:52 +0100 Subject: [PATCH 3/3] settings: Handle return code correctly "eval $(python3 script.py)" does not handle the return code correctly and would try to evaluate the complete output of the Python traceback. Temporarily save the output in a variable and check the return code. If the RC is unequal to zero, return the RC and leave the bash script. Signed-off-by: Daniel Schultz --- settings/artix7.sh | 7 ++++++- settings/artix7_200t.sh | 7 ++++++- settings/artix7_50t.sh | 7 ++++++- settings/kintex7.sh | 7 ++++++- settings/zynq7.sh | 7 ++++++- settings/zynq7010.sh | 7 ++++++- 6 files changed, 36 insertions(+), 6 deletions(-) diff --git a/settings/artix7.sh b/settings/artix7.sh index 67c0a95b..d5f63df3 100644 --- a/settings/artix7.sh +++ b/settings/artix7.sh @@ -33,4 +33,9 @@ export XRAY_ROI_GRID_Y2="51" source $(dirname ${BASH_SOURCE[0]})/../utils/environment.sh -eval $(python3 ${XRAY_UTILS_DIR}/create_environment.py) +env=`python3 ${XRAY_UTILS_DIR}/create_environment.py` +ENV_RET=$? +if [[ $ENV_RET != 0 ]] ; then + return $ENV_RET +fi +eval $env diff --git a/settings/artix7_200t.sh b/settings/artix7_200t.sh index b7010130..4ec566b9 100644 --- a/settings/artix7_200t.sh +++ b/settings/artix7_200t.sh @@ -23,4 +23,9 @@ export XRAY_IOI3_TILES="RIOI3_X105Y9 LIOI3_X0Y9" source $(dirname ${BASH_SOURCE[0]})/../utils/environment.sh -eval $(python3 ${XRAY_UTILS_DIR}/create_environment.py) +env=`python3 ${XRAY_UTILS_DIR}/create_environment.py` +ENV_RET=$? +if [[ $ENV_RET != 0 ]] ; then + return $ENV_RET +fi +eval $env diff --git a/settings/artix7_50t.sh b/settings/artix7_50t.sh index b73d6417..71615145 100644 --- a/settings/artix7_50t.sh +++ b/settings/artix7_50t.sh @@ -32,4 +32,9 @@ export XRAY_ROI_GRID_Y2="51" source $(dirname ${BASH_SOURCE[0]})/../utils/environment.sh -eval $(python3 ${XRAY_UTILS_DIR}/create_environment.py) +env=`python3 ${XRAY_UTILS_DIR}/create_environment.py` +ENV_RET=$? +if [[ $ENV_RET != 0 ]] ; then + return $ENV_RET +fi +eval $env diff --git a/settings/kintex7.sh b/settings/kintex7.sh index a44a0e41..f7c16c87 100644 --- a/settings/kintex7.sh +++ b/settings/kintex7.sh @@ -27,4 +27,9 @@ export XRAY_ROI_GRID_Y2="156" source $(dirname ${BASH_SOURCE[0]})/../utils/environment.sh -eval $(python3 ${XRAY_UTILS_DIR}/create_environment.py) +env=`python3 ${XRAY_UTILS_DIR}/create_environment.py` +ENV_RET=$? +if [[ $ENV_RET != 0 ]] ; then + return $ENV_RET +fi +eval $env diff --git a/settings/zynq7.sh b/settings/zynq7.sh index ddd69c7d..716dd3fc 100644 --- a/settings/zynq7.sh +++ b/settings/zynq7.sh @@ -29,4 +29,9 @@ export XRAY_ROI_GRID_Y2="155" source $(dirname ${BASH_SOURCE[0]})/../utils/environment.sh -eval $(python3 ${XRAY_UTILS_DIR}/create_environment.py) +env=`python3 ${XRAY_UTILS_DIR}/create_environment.py` +ENV_RET=$? +if [[ $ENV_RET != 0 ]] ; then + return $ENV_RET +fi +eval $env diff --git a/settings/zynq7010.sh b/settings/zynq7010.sh index 4160a1cc..4a9a8836 100644 --- a/settings/zynq7010.sh +++ b/settings/zynq7010.sh @@ -29,4 +29,9 @@ export XRAY_ROI_GRID_Y2="51" source $(dirname ${BASH_SOURCE[0]})/../utils/environment.sh -eval $(python3 ${XRAY_UTILS_DIR}/create_environment.py) +env=`python3 ${XRAY_UTILS_DIR}/create_environment.py` +ENV_RET=$? +if [[ $ENV_RET != 0 ]] ; then + return $ENV_RET +fi +eval $env