Merge pull request #1429 from litghost/break_circular_import

Fix python on kokoro and break circular import through tile_segbits.
This commit is contained in:
litghost 2020-10-01 17:30:37 -07:00 committed by GitHub
commit 7692b9bea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 48 additions and 30 deletions

View File

@ -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,12 +63,19 @@ sudo apt-get install -y \
jq \
nodejs \
psmisc \
python \
python3 \
python3-dev \
python3-virtualenv \
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 "----------------------------------------"

View File

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

View File

@ -5,7 +5,7 @@
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
N := 4
N := 6
SLICEL ?= N
include ../clb.mk

View File

@ -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
@ -126,9 +126,15 @@ for clbi in range(CLBN):
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()

View File

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

View File

@ -1,5 +1,6 @@
-e third_party/fasm
-e third_party/python-sdf-timing
-e .
intervaltree
junit-xml
numpy

View File

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

View File

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