From 86266dade5d7f7c61095a2149bd313258443a166 Mon Sep 17 00:00:00 2001 From: Robert Glein Date: Mon, 9 Jul 2018 12:51:43 -0600 Subject: [PATCH 01/13] support of block designs including development boards --- ipbb/depparser/VivadoProjectMaker.py | 34 ++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/ipbb/depparser/VivadoProjectMaker.py b/ipbb/depparser/VivadoProjectMaker.py index 1b0ac273..53403986 100644 --- a/ipbb/depparser/VivadoProjectMaker.py +++ b/ipbb/depparser/VivadoProjectMaker.py @@ -2,6 +2,8 @@ import time import os import collections +import glob +import subprocess from string import Template as tmpl @@ -24,7 +26,8 @@ class VivadoProjectMaker(object): '.xci': 'sources_1', '.ngc': 'sources_1', '.edn': 'sources_1', - '.edf': 'sources_1' + '.edf': 'sources_1', + '.bd': 'sources_1' # Legacy ISE files # '.ucf': 'ise_1', # '.xco': 'ise_1', @@ -61,6 +64,16 @@ def write(self, aTarget, aScriptVariables, aComponentPaths, aCommandList, aLibs, ) ) + # for block designs of development boards + if 'board_part' not in aScriptVariables: + pass + else: + write( + 'set_property BOARD_PART {board_part} [current_project]'.format( + **aScriptVariables + ) + ) + write( 'if {[string equal [get_filesets -quiet constrs_1] ""]} {create_fileset -constrset constrs_1}') write( @@ -95,6 +108,23 @@ def write(self, aTarget, aScriptVariables, aComponentPaths, aCommandList, aLibs, lXciBasenames.append(lName) lXciTargetFiles.append(lTargetFile) + + # Support block designs + elif lExt == '.bd': # import pdb; pdb.set_trace() + + fl=glob.glob(lPath+'/*') # delete build artefacts to include recursive submodules + fl.remove(lPath+'/'+lBasename) # do not delete the design + if os.path.exists(lPath+'/hdl'): # do not delete hdl file if it exists + fl.remove(lPath+'/hdl') + for file in fl: + subprocess.Popen(['rm', '-rf', file]) + + # hard write to add, open, and close board design + write(str('add_files -fileset sources_1 {'+lPath+'/'+lBasename+'}')) + write(str('open_bd_design {'+lPath+'/'+lBasename+'}')) # open design to add all submodules + write('close_bd_design [current_bd_design]') + write(str('generate_target all [get_files '+lPath+'/'+lBasename+']')) # get all submodules + else: if src.Include: @@ -128,7 +158,7 @@ def write(self, aTarget, aScriptVariables, aComponentPaths, aCommandList, aLibs, write('set_property top top [current_fileset]') write('set_property "steps.synth_design.args.flatten_hierarchy" "none" [get_runs synth_1]') - + for i in lXciBasenames: write('upgrade_ip [get_ips {0}]'.format(i)) for i in lXciTargetFiles: From e8fef1c89d5b2b7879c0f0952a131565f3ae7a40 Mon Sep 17 00:00:00 2001 From: Robert Glein Date: Mon, 9 Jul 2018 12:56:31 -0600 Subject: [PATCH 02/13] support of block designs including development boards --- ipbb/depparser/VivadoProjectMaker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipbb/depparser/VivadoProjectMaker.py b/ipbb/depparser/VivadoProjectMaker.py index 53403986..9095b36f 100644 --- a/ipbb/depparser/VivadoProjectMaker.py +++ b/ipbb/depparser/VivadoProjectMaker.py @@ -158,7 +158,7 @@ def write(self, aTarget, aScriptVariables, aComponentPaths, aCommandList, aLibs, write('set_property top top [current_fileset]') write('set_property "steps.synth_design.args.flatten_hierarchy" "none" [get_runs synth_1]') - + for i in lXciBasenames: write('upgrade_ip [get_ips {0}]'.format(i)) for i in lXciTargetFiles: From 387d6bb0323c34473aecf10fb170771479be64b5 Mon Sep 17 00:00:00 2001 From: Robert Glein Date: Tue, 10 Jul 2018 10:10:27 -0600 Subject: [PATCH 03/13] rm if exsist to enable git folder repo --- ipbb/cli/repo.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ipbb/cli/repo.py b/ipbb/cli/repo.py index f5484ec8..1bb10f5b 100644 --- a/ipbb/cli/repo.py +++ b/ipbb/cli/repo.py @@ -76,11 +76,11 @@ def git(env, repo, branch, dest): lRepoName = splitext(basename(lUrl.path))[0] if dest is None else dest lRepoLocalPath = join(env.work.path, kSourceDir, lRepoName) - # Check for - if exists(lRepoLocalPath): - raise click.ClickException( - 'Repository already exists \'%s\'' % lRepoLocalPath - ) + # Check for # import pdb; pdb.set_trace() +# if exists(lRepoLocalPath): +# raise click.ClickException( +# 'Repository already exists \'%s\'' % lRepoLocalPath +# ) if branch is not None: lLsRemote = sh.git('ls-remote', '-h','-t', repo, branch) @@ -402,4 +402,4 @@ def status(env): @srcs.command('find', short_help="Find src files.") @click.pass_obj def find(env): - sh.find(env.srcdir,'-name', '*.vhd', _out=sys.stdout) \ No newline at end of file + sh.find(env.srcdir,'-name', '*.vhd', _out=sys.stdout) From 6dc2c0c1615b79da08275deffc0d0f0b62f9fffb Mon Sep 17 00:00:00 2001 From: Robert Glein Date: Tue, 10 Jul 2018 10:25:51 -0600 Subject: [PATCH 04/13] glein hack --- ipbb/cli/repo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ipbb/cli/repo.py b/ipbb/cli/repo.py index 1bb10f5b..15dd68cf 100644 --- a/ipbb/cli/repo.py +++ b/ipbb/cli/repo.py @@ -76,7 +76,7 @@ def git(env, repo, branch, dest): lRepoName = splitext(basename(lUrl.path))[0] if dest is None else dest lRepoLocalPath = join(env.work.path, kSourceDir, lRepoName) - # Check for # import pdb; pdb.set_trace() + # Check for #glein: # import pdb; pdb.set_trace() # if exists(lRepoLocalPath): # raise click.ClickException( # 'Repository already exists \'%s\'' % lRepoLocalPath @@ -122,7 +122,7 @@ def git(env, repo, branch, dest): if dest is not None: lArgs += [dest] - sh.git(*lArgs, _out=sys.stdout, _cwd=env.srcdir) + sh.git(*lArgs)#glein: , _out=sys.stdout, _cwd=env.srcdir) if branch is not None: From 2a6dfac520ceef04bf53766284059c717e219bb4 Mon Sep 17 00:00:00 2001 From: Robert Glein Date: Tue, 10 Jul 2018 15:21:52 -0600 Subject: [PATCH 05/13] add check for .git extension --- ipbb/cli/repo.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ipbb/cli/repo.py b/ipbb/cli/repo.py index 15dd68cf..35e6fefc 100644 --- a/ipbb/cli/repo.py +++ b/ipbb/cli/repo.py @@ -72,15 +72,19 @@ def git(env, repo, branch, dest): # Maybe not necessary lUrl = urlparse(repo) - # Strip '.git' at the end - lRepoName = splitext(basename(lUrl.path))[0] if dest is None else dest + # Strip '.git' at the end if it exists, this supports git in a folder + if 'git' in lUrl.path: + lRepoName = splitext(basename(lUrl.path))[0] if dest is None else dest + else: + lRepoName = lUrl.path if dest is None else dest + lRepoLocalPath = join(env.work.path, kSourceDir, lRepoName) - # Check for #glein: # import pdb; pdb.set_trace() -# if exists(lRepoLocalPath): -# raise click.ClickException( -# 'Repository already exists \'%s\'' % lRepoLocalPath -# ) + # Check for + if exists(lRepoLocalPath): + raise click.ClickException( + 'Repository already exists \'%s\'' % lRepoLocalPath + ) if branch is not None: lLsRemote = sh.git('ls-remote', '-h','-t', repo, branch) From 9d8f8bd768ff25248956da8c05fc0bf38f6593e5 Mon Sep 17 00:00:00 2001 From: Robert Glein Date: Wed, 15 Aug 2018 15:56:59 -0600 Subject: [PATCH 06/13] add vivado sim support plus doc --- ipbb/cli/vivado.py | 48 +++++++++++++++++++++++++++++++++++ vivado_simulation.md | 59 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 vivado_simulation.md diff --git a/ipbb/cli/vivado.py b/ipbb/cli/vivado.py index 6a1b4f2c..8e0d54f1 100644 --- a/ipbb/cli/vivado.py +++ b/ipbb/cli/vivado.py @@ -8,6 +8,7 @@ import sys import sh import time +import re # Elements from os.path import join, split, exists, splitext, abspath, basename @@ -20,6 +21,8 @@ from ..depparser.VivadoProjectMaker import VivadoProjectMaker from ..tools.xilinx import VivadoOpen, VivadoConsoleError, VivadoSnoozer +# Debugging and testing +#import pdb; pdb.set_trace() # ------------------------------------------------------------------------------ def ensureVivado(env): @@ -259,6 +262,51 @@ def synth(env, jobs): secho("\n{}: Synthesis completed successfully.\n".format(env.currentproj.name), fg='green') # ------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ +@vivado.command('sim', short_help='Run the simulation step on the specified dependency.') +@click.option('-rf', '--run-for', metavar='