From fa6840e6db509b8037e2e83cef20dc8e9bc1c0b6 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Tue, 1 Sep 2020 13:18:06 -0700 Subject: [PATCH 1/6] Break circular import through tile_segbits. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- prjxray/tile_segbits.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/prjxray/tile_segbits.py b/prjxray/tile_segbits.py index 1f8807cd..da7f232a 100644 --- a/prjxray/tile_segbits.py +++ b/prjxray/tile_segbits.py @@ -10,9 +10,8 @@ # SPDX-License-Identifier: ISC from collections import namedtuple from prjxray import bitstream -from prjxray.grid import BlockType +from prjxray.grid_types import BlockType import enum -import functools class PsuedoPipType(enum.Enum): From c7033a6a19f4be906d5fc23c84548ee872c27f82 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Wed, 9 Sep 2020 09:40:53 -0700 Subject: [PATCH 2/6] Clean up python install process. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- .github/kokoro/steps/hostsetup.sh | 1 + Makefile | 15 +++++---------- requirements.txt | 1 + utils/environment.python.sh | 2 -- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/kokoro/steps/hostsetup.sh b/.github/kokoro/steps/hostsetup.sh index 7f2948ed..9ce9f995 100755 --- a/.github/kokoro/steps/hostsetup.sh +++ b/.github/kokoro/steps/hostsetup.sh @@ -66,6 +66,7 @@ sudo apt-get install -y \ python3 \ python3-dev \ python3-virtualenv \ + python3-venv \ python3-yaml \ virtualenv \ diff --git a/Makefile b/Makefile index efe6deef..293407a4 100644 --- a/Makefile +++ b/Makefile @@ -18,18 +18,13 @@ endif # Tools + Environment IN_ENV = if [ -e env/bin/activate ]; then . env/bin/activate; fi; source utils/environment.python.sh; env: - virtualenv --python=python3 env - # Install prjxray - ln -sf $(PWD)/prjxray env/lib/python3.*/site-packages/ - $(IN_ENV) python -c "import prjxray" - # Install fasm from third_party - $(IN_ENV) pip install --upgrade -e third_party/fasm - # Install sdfparse form third party - $(IN_ENV) pip install --upgrade -e third_party/python-sdf-timing + python3 -mvenv env # Install project dependencies - $(IN_ENV) pip install -r requirements.txt + $(IN_ENV) python -mpip install -r requirements.txt # Install project's documentation dependencies - $(IN_ENV) pip install -r docs/requirements.txt + $(IN_ENV) python -mpip install -r docs/requirements.txt + # Check that prjxray are available + $(IN_ENV) python -c "import prjxray" # Check fasm library was installed $(IN_ENV) python -c "import fasm" $(IN_ENV) python -c "import fasm.output" diff --git a/requirements.txt b/requirements.txt index 6fd01535..e10243ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ -e third_party/fasm -e third_party/python-sdf-timing +-e . intervaltree junit-xml numpy diff --git a/utils/environment.python.sh b/utils/environment.python.sh index a4b8e382..06577010 100644 --- a/utils/environment.python.sh +++ b/utils/environment.python.sh @@ -1,4 +1,3 @@ -# FIXME: fasm should be installed into the running Python environment. # Copyright (C) 2017-2020 The Project X-Ray Authors. # # Use of this source code is governed by a ISC-style @@ -6,7 +5,6 @@ # https://opensource.org/licenses/ISC # # SPDX-License-Identifier: ISC -export PYTHONPATH="${XRAY_DIR}:${XRAY_DIR}/third_party/fasm:$PYTHONPATH" # Suppress the following warnings; # - env/lib/python3.7/distutils/__init__.py:4: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses From 8f2456e4bd8e0000fde4258057a337d757128d29 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Wed, 9 Sep 2020 09:56:49 -0700 Subject: [PATCH 3/6] Output python3 version. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- .github/kokoro/steps/hostsetup.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/kokoro/steps/hostsetup.sh b/.github/kokoro/steps/hostsetup.sh index 9ce9f995..d8c726e8 100755 --- a/.github/kokoro/steps/hostsetup.sh +++ b/.github/kokoro/steps/hostsetup.sh @@ -22,6 +22,7 @@ echo "Host adding PPAs" echo "----------------------------------------" wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add - sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main' +sudo add-apt-repository ppa:deadsnakes/ppa echo "----------------------------------------" echo @@ -62,13 +63,19 @@ sudo apt-get install -y \ jq \ nodejs \ psmisc \ - python \ - python3 \ - python3-dev \ - python3-virtualenv \ - python3-venv \ - python3-yaml \ - virtualenv \ + python3.8 \ + python3.8-dev \ + python3.8-venv + +echo "========================================" +echo "Enter virtual env for python 3.8" +echo "----------------------------------------" +python3.8 -mvenv startup_python +source startup_python/bin/activate +which python +python --version +which python3 +python3 --version echo "----------------------------------------" From f1eabc62b7c2da05646034414cd7538d164a394a Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Fri, 11 Sep 2020 10:51:21 -0700 Subject: [PATCH 4/6] Add some determinism to the randomness in 018. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- fuzzers/018-clb-ram/Makefile | 2 +- fuzzers/018-clb-ram/top.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fuzzers/018-clb-ram/Makefile b/fuzzers/018-clb-ram/Makefile index 42ecfe74..104f605d 100644 --- a/fuzzers/018-clb-ram/Makefile +++ b/fuzzers/018-clb-ram/Makefile @@ -5,7 +5,7 @@ # https://opensource.org/licenses/ISC # # SPDX-License-Identifier: ISC -N := 4 +N := 6 SLICEL ?= N include ../clb.mk diff --git a/fuzzers/018-clb-ram/top.py b/fuzzers/018-clb-ram/top.py index 755b7d39..f6ec0809 100644 --- a/fuzzers/018-clb-ram/top.py +++ b/fuzzers/018-clb-ram/top.py @@ -50,14 +50,14 @@ verilog.top_harness(DIN_N, DOUT_N) f = open('params.csv', 'w') f.write('module,loc,bela,belb,belc,beld\n') -slices = gen_slicems() +slices = sorted(gen_slicems()) +random.shuffle(slices) + print( 'module roi(input clk, input [%d:0] din, output [%d:0] dout);' % (DIN_N - 1, DOUT_N - 1)) randluts = 0 -for clbi in range(CLBN): - loc = next(slices) - +for clbi, loc in zip(range(CLBN), slices): params = '' cparams = '' # Multi module From 5ad24eb6cdde0f0e8c8417b20f59dd6d8a9ed01d Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Fri, 25 Sep 2020 12:59:13 -0700 Subject: [PATCH 5/6] Make 018 more robust by selectively disabling inputs and outputs. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- fuzzers/018-clb-ram/top.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fuzzers/018-clb-ram/top.py b/fuzzers/018-clb-ram/top.py index f6ec0809..64fbb1a1 100644 --- a/fuzzers/018-clb-ram/top.py +++ b/fuzzers/018-clb-ram/top.py @@ -126,9 +126,15 @@ for clbi, loc in zip(range(CLBN), slices): print(' %s' % module) print(' #(.LOC("%s")%s)' % (loc, params)) - print( - ' clb_%d (.clk(clk), .din(din[ %d +: 8]), .dout(dout[ %d +: 8]));' - % (clbi, 8 * clbi, 8 * clbi)) + sel = random.random() + if sel > .15: + print( + ' clb_%d (.clk(clk), .din(din[ %d +: 8]), .dout(dout[ %d +: 8]));' + % (clbi, 8 * clbi, 8 * clbi)) + else: + print( + " clb_%d (.clk(clk), .din({8{1'b1}}), .dout());" % + (clbi, )) f.write('%s,%s%s\n' % (module, loc, cparams)) f.close() From 837e1605604ebebf09fe8058de823b2647ea6392 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Wed, 30 Sep 2020 12:05:50 -0700 Subject: [PATCH 6/6] Add fix to prevent INT features with 3 bits. This may help fix #1246. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- utils/dbfixup.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/utils/dbfixup.py b/utils/dbfixup.py index 015718a3..1d3bc2cd 100755 --- a/utils/dbfixup.py +++ b/utils/dbfixup.py @@ -9,8 +9,10 @@ # # SPDX-License-Identifier: ISC -import sys, os, re import itertools +import os +import re + from prjxray import util clb_int_zero_db = [ @@ -283,6 +285,16 @@ def add_zero_bits( """ if clb_int: zero_range(tag, bits, 22, 25) + + set_bits = [bit for bit in bits if bit[0] != '!'] + if len(set_bits) not in [2, 4]: + # All INT bits appear to be only have 2 or 4 bits. + verbose and print( + "WARNING: dropping line with %d bits, not [2, 4]: %s, %s" + % (len(set_bits), bits, line)) + drops += 1 + continue + zero_groups.add_bits_from_zero_groups( tag, bits, strict=strict, verbose=verbose) @@ -303,7 +315,6 @@ def add_zero_bits( if new_line != line: changes += 1 new_lines.add(new_line) - llast = line if drops: print("WARNING: %s dropped %s unresolved lines" % (fn_in, drops))