Skip to content

Commit

Permalink
aldec: add macro hadler, add default include path
Browse files Browse the repository at this point in the history
  • Loading branch information
mgolokhov committed May 14, 2017
1 parent ef11588 commit b4dcc16
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
9 changes: 7 additions & 2 deletions autohdl/aldec.py
Expand Up @@ -21,10 +21,15 @@ def extend(config):
config['aldec']['src'] = [os.path.normpath(i) for i in config['src']]
config['aldec']['dsn_name'] = config.get('dsn_name')
config['aldec']['all_src'] = structure.search(directory=config['aldec']['wsp_root'],
ignore_dir=IGNORE_REPO_DIRS + ('autohdl',))
ignore_dir=IGNORE_REPO_DIRS + ('autohdl',),
ignore_ext=('.DS_Store',)
)
config['aldec']['dsn_src'] = structure.search(directory=config['aldec']['dsn_root'],
ignore_dir=IGNORE_REPO_DIRS + ('autohdl',)
ignore_dir=IGNORE_REPO_DIRS + ('autohdl',),
ignore_ext=('.DS_Store',)
)
#pprint.pprint(config['aldec']['dsn_src'])
#import sys; sys.exit(0);
config['aldec']['deps'] = [i for i in config['aldec']['src'] if config['aldec']['dsn_root'] not in i]


Expand Down
2 changes: 1 addition & 1 deletion autohdl/data/version.json
@@ -1 +1 @@
{"minor": 0, "major": 3, "build": 1316}
{"minor": 0, "major": 3, "build": 1344}
4 changes: 1 addition & 3 deletions autohdl/manager.py
Expand Up @@ -47,7 +47,7 @@ def cli_handler():
help='synthesis step [default=batch]')
parser.add_argument('-xilinx', nargs='?', const='batch', choices=['batch', 'gui'],
help='implementation step [default=batch]')
parser.add_argument('-mcs', nargs='?', help='generate .mcs from .bit file')
parser.add_argument('-mcs', nargs='?', const="512", help='generate .mcs from .bit file')
parser.add_argument('-upload', action='store_true', help='upload firmware to WebDav server')
parser.add_argument('-message', help='information about firmware')
parser.add_argument('-debug', nargs='?', const='')
Expand Down Expand Up @@ -79,7 +79,6 @@ def kungfu(script_cfg):
subprocess.call('hdl.py -v', shell=True)
alog.info('Processing...')
command_line_cfg = cli_handler()
pprint.pprint(command_line_cfg)
set_debug(vars(command_line_cfg))
alog.debug('Command line args: ' + str(sys.argv))
alog.debug(pprint.pformat(command_line_cfg))
Expand Down Expand Up @@ -111,7 +110,6 @@ def kungfu(script_cfg):
xilinx.bit_to_mcs(cfg)
xilinx.copy_firmware(cfg)
elif cfg.get('mcs'):
print("mcs"*50)
xilinx.bit_to_mcs(cfg)
xilinx.copy_firmware(cfg)

Expand Down
1 change: 1 addition & 0 deletions autohdl/structure.py
Expand Up @@ -84,6 +84,7 @@ def search(directory='.',
dirs.remove(i)
for f in files[:]:
alog.debug('file: ' + f)
# splitext(".file") will return an empty ext
ext = os.path.splitext(f)[1]
if ext in ignore_ext:
files.remove(f)
Expand Down
18 changes: 13 additions & 5 deletions autohdl/template_avhdl_adf.py
Expand Up @@ -38,9 +38,10 @@ def ucf(iPrj):
def include_path(iPrj):
incl_path = iPrj.get('include_path')
if not incl_path:
return ''
incl_path = []
elif type(incl_path) is str:
incl_path = [incl_path]
incl_path += [os.path.join(iPrj.get("dsn_root"), "src")]
counter = 'Count={0}'.format(len(incl_path))
inclDir = ['IncludeDir{0}={1}'.format(i, path) for i, path in enumerate(incl_path)]
return '{0}\n{1}'.format(counter, '\n'.join(inclDir))
Expand Down Expand Up @@ -85,7 +86,12 @@ def files(config):
# import sys; sys.exit(0);

config['aldec']['virt_dirs'] = virt_dirs
config['aldec']['virt_paths'] = virt_paths
config['aldec']['virt_paths'] = []
# packages should be compiled first
for i in virt_paths:
if "_pkg" in i:
config['aldec']['virt_paths'].append(i)
config['aldec']['virt_paths'] += virt_paths


def files_data(iPrj):
Expand All @@ -99,8 +105,10 @@ def files_data(iPrj):


def defineMacro(iPrj):
macros = ""#iPrj.get('hdlManager').get('AldecMacros')
#print(macros)
macros = iPrj.get('AldecMacros')
if type(macros) is str:
macros = [macros]
# print('[DefineMacro]\nGlobal=' + ' '.join(macros) + '\n'); import sys; sys.exit(0);
if macros:
return '[DefineMacro]\nGlobal=' + ' '.join(macros) + '\n'
else:
Expand Down Expand Up @@ -266,7 +274,7 @@ def generate(iPrj):
'SERVERFARM_INCLUDE_INPUT_FILES=*.*\n'
'SERVERFARM_EXCLUDE_INPUT_FILES=log\*.*:implement\*.*\n'
'JOB_SFM_RESOURCE=\n'
'LAST_RUN=1297366639\n'
'LAST_RUN=0\n'

'[PHYS_SYNTHESIS]\n'
+ 'FAMILY={FAMILY}\n'.format(FAMILY=family(iPrj))
Expand Down

0 comments on commit b4dcc16

Please sign in to comment.