Commit 48704934 authored by Andreas Bombe's avatar Andreas Bombe

update-ghdl-libraries: Additional 'work' and 'copywork' configuration keys

Both are designed in support of the Synopsys library. The optional key
'work' allows to set the work library different from the value specified
in 'name' (so that it is possible to have 'name = synopsys' with 'work =
ieee').

Another optional key 'copywork' (defaults to off) copies the existing
library to the current subdir before compiling. Synopsys extends the
ieee library, so this can be used to avoid compiling the ieee sources
twice.

debian/synopsys.ghdllib is changed to make use of the enhancements.
parent 6d3a3dfe
[library]
name = ieee
name = synopsys
work = ieee
copywork = yes
subdir = synopsys
depends = std
depends = ieee
standards = 87 93
[compile]
[compile 87]
sources = openieee/std_logic_1164.v87 openieee/std_logic_1164-body.v87
openieee/numeric_bit.v87 openieee/numeric_bit-body.v87
openieee/numeric_std.v87 openieee/numeric_std-body.v87
synopsys/std_logic_arith.vhdl
sources = synopsys/std_logic_arith.vhdl
synopsys/std_logic_unsigned.vhdl
synopsys/std_logic_signed.vhdl
synopsys/std_logic_misc.vhdl synopsys/std_logic_misc-body.vhdl
synopsys/std_logic_textio.vhdl
[compile 93]
sources = openieee/std_logic_1164.v93 openieee/std_logic_1164-body.v93
openieee/numeric_bit.v93 openieee/numeric_bit-body.v93
openieee/numeric_std.v93 openieee/numeric_std-body.v93
openieee/math_real.vhdl openieee/math_real-body.vhdl
synopsys/std_logic_arith.vhdl
sources = synopsys/std_logic_arith.vhdl
synopsys/std_logic_unsigned.vhdl
synopsys/std_logic_signed.vhdl
synopsys/std_logic_misc.vhdl synopsys/std_logic_misc-body.vhdl
......
......@@ -123,6 +123,8 @@ def read_configuration_values(conf, std):
v = {}
v['name'] = lib['name']
v['work'] = lib.get('work', v['name'])
v['copywork'] = lib.getboolean('copywork', False)
v['subdir'] = lib.get('subdir', 'synopsys')
v['depends'] = lib.get('depends', 'ieee')
v['sources'] = comp.get('sources', '').split()
......@@ -214,7 +216,7 @@ def build_libraries(backend, specs, std):
common_args = ['-a', '-O', std['flag']]
for spec in specs:
args = ['--work='+spec['name']]
args = ['--work='+spec['work']]
if spec['name'] == 'std':
args.insert(0, '--bootstrap')
cmdline = [ghdl, *common_args, *args]
......@@ -225,6 +227,14 @@ def build_libraries(backend, specs, std):
destdir.mkdir(exist_ok = True)
os.chdir(destdir)
# if requested, copy the library of the same name to the directory
if spec['copywork']:
copycmd = [ghdl, '--copy', std['flag'], '--work='+spec['work']]
logv(*copycmd)
result = subprocess.run(copycmd)
if result.returncode != 0:
set_fail()
for source in spec['sources']:
srcpath = Path(relsrcdir, source)
logv(*cmdline, srcpath)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment