Merge pull request #507 from natsfr/master

Fixing Fuzzer 072: supporting all pips count
This commit is contained in:
litghost 2019-01-12 14:45:59 -08:00 committed by GitHub
commit a0c2d37294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 5 deletions

View File

@ -4,10 +4,19 @@ import sys
import subprocess
import signal
from multiprocessing import Pool
from itertools import chain
# Can be used to redirect vivado tons of output
# stdout=DEVNULL in subprocess.check_call
#try:
# from subprocess import DEVNULL
#except ImportError:
# import os
# DEVNULL = open(os.devnull, 'wb')
# Worker function called from threads
def start_vivado(argList):
print(argList)
blockID, start, stop = argList
print("Running instance :" + str(blockID))
subprocess.check_call(
@ -16,8 +25,9 @@ def start_vivado(argList):
shell=True)
# Function called once to get the total numbers of pips to list
def get_nb_pips():
print("Fetching nb pips")
print("Fetching total number of pips")
subprocess.check_call(
"${XRAY_VIVADO} -mode batch -source $FUZDIR/get_pipscount.tcl",
shell=True)
@ -31,6 +41,14 @@ def main(argv):
pipscount = get_nb_pips()
blocksize = int(pipscount / nbBlocks)
intPipsCount = blocksize * nbBlocks
# We handle the case of not integer multiple of pips
lastRun = False
modBlocks = pipscount % nbBlocks
if modBlocks != 0:
lastRun = True
nbBlocks = nbBlocks + 1
if not os.path.exists("wires"):
os.mkdir("wires")
@ -38,11 +56,18 @@ def main(argv):
print(
"Pips Count: " + str(pipscount) + " - Number of blocks: " +
str(nbBlocks) + " - Parallel blocks: " + str(nbParBlock) +
" - Blocksize: " + str(blocksize))
" - Blocksize: " + str(blocksize) + " - Modulo Blocks: " +
str(modBlocks))
blockId = range(0, nbBlocks)
startI = range(0, pipscount, blocksize)
stopI = range(blocksize, pipscount + 1, blocksize)
startI = range(0, intPipsCount, blocksize)
stopI = range(blocksize, intPipsCount + 1, blocksize)
# In case we have a last incomplete block we add it as a last
# element in the arguments list
if lastRun == True:
startI = chain(startI, [intPipsCount])
stopI = chain(stopI, [pipscount])
argList = zip(blockId, startI, stopI)