-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makefiles #24
Draft
radonnachie
wants to merge
14
commits into
ghdl:master
Choose a base branch
from
radonnachie:makefiles
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Makefiles #24
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
801c45a
doc: grammatical hiccups
umarcor b2cefec
ci: use pytest
umarcor 3c79900
vhpidirect(arrays/intvector/vhdlsized): include stdio
umarcor d36171f
ci: use Action setup-ghdl
umarcor 1720993
ignore extra files
radonnachie 7147360
Create makefiles for intvector examples
radonnachie 398afaa
Symbols on 1 line
radonnachie 3e295f0
gitignore clean
radonnachie c6dae5c
test with makefile
radonnachie 82ce224
mkdir_rule, symbols per line
radonnachie 6910b7d
Remove unused TOPLEVEL, conditional assignments
radonnachie 0cf7353
Windows make calls
radonnachie 7e6edf1
README makefile section
radonnachie 7475acf
the d...
radonnachie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM ghdl/vunit:llvm | ||
|
||
RUN apt update -qq \ | ||
&& apt install -y imagemagick \ | ||
&& python3 -m pip install pytest --progress-bar off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,88 +11,72 @@ env: | |
|
||
jobs: | ||
|
||
lin: | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 3 | ||
matrix: | ||
task: [ | ||
vhpidirect/quickstart/random, | ||
vhpidirect/quickstart/math, | ||
vhpidirect/quickstart/customc, | ||
vhpidirect/quickstart/wrapping/basic, | ||
vhpidirect/quickstart/wrapping/time, | ||
vhpidirect/quickstart/linking/bind, | ||
vhpidirect/quickstart/package, | ||
vhpidirect/quickstart/sharedvar, | ||
vhpidirect/shared/shlib, | ||
vhpidirect/shared/dlopen, | ||
vhpidirect/shared/shghdl, | ||
vhpidirect/arrays/intvector, | ||
vhpidirect/arrays/logicvector, | ||
vhpidirect/arrays/matrices, | ||
vhpidirect/arrays/matrices/framebuffer, | ||
vpi/quickstart, | ||
] | ||
lin-docker: | ||
runs-on: ubuntu-latest | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
DOCKER_IMAGE: ghdl/ghdl:buster-llvm-7 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: docker pull $DOCKER_IMAGE | ||
- run: docker run --rm -tv $(pwd):/src -e CI $DOCKER_IMAGE /src/${{ matrix.task}}/run.sh | ||
- run: docker build -t cosim/test - < .github/Dockerfile | ||
- run: docker run --rm -v $(pwd):/src -w /src -e CI cosim/test python3 -m pytest -v -s -ra test.py --color=yes | ||
|
||
vunit: | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 3 | ||
matrix: | ||
task: [ | ||
vhpidirect/arrays/matrices/vunit_axis_vcs, | ||
] | ||
win-stable: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- env: | ||
WINDOWS_RELEASE: 0.37-mingw64-llvm | ||
shell: bash | ||
run: | | ||
curl -fsSL -o ghdl.zip https://github.com/ghdl/ghdl/releases/download/v0.37/ghdl-${WINDOWS_RELEASE}.zip | ||
7z x ghdl.zip "-o../ghdl-tmp" -y | ||
mv ../ghdl-tmp/GHDL/${WINDOWS_RELEASE}/ ../ghdl | ||
rm -rf ../ghdl-tmp ghdl.zip | ||
export PATH=$PATH:$(pwd)/../ghdl/bin | ||
python -m pip install pytest vunit_hdl --progress-bar off | ||
python -m pytest -v -s -ra test.py --color=yes | ||
|
||
lin-setup: | ||
runs-on: ubuntu-latest | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
DOCKER_IMAGE: ghdl/vunit:llvm | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: docker pull $DOCKER_IMAGE | ||
- run: docker run --rm -tv $(pwd):/src -w /src/${{ matrix.task}} -e CI $DOCKER_IMAGE python3 run.py -v | ||
- uses: umarcor/setup-ghdl@master | ||
with: | ||
backend: llvm | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
ghdl --version | ||
sudo apt update -qq | ||
sudo apt install -y imagemagick | ||
python -m pip install --progress-bar off pytest vunit_hdl | ||
- run: python -m pytest -v -s -ra test.py --color=yes | ||
|
||
win: | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 3 | ||
matrix: | ||
task: [ | ||
vhpidirect/quickstart/random, | ||
vhpidirect/quickstart/math, | ||
vhpidirect/quickstart/customc, | ||
vhpidirect/quickstart/wrapping/basic, | ||
vhpidirect/quickstart/wrapping/time, | ||
#vhpidirect/quickstart/linking/bind, ! needs investigation, output of list-link seems to have wrong path format | ||
vhpidirect/quickstart/package, | ||
vhpidirect/quickstart/sharedvar, | ||
vhpidirect/shared/shlib, | ||
#vhpidirect/shared/dlopen, ! dlfcn.h is not available on win | ||
#vhpidirect/shared/shghdl, ! dlfcn.h is not available on win | ||
vhpidirect/arrays/intvector, | ||
vhpidirect/arrays/logicvector, | ||
vhpidirect/arrays/matrices, | ||
#vhpidirect/arrays/matrices/framebuffer, ! needs ImageMagick's 'convert' | ||
vpi/quickstart, | ||
] | ||
win-setup: | ||
runs-on: windows-latest | ||
env: | ||
WINDOWS_RELEASE: 0.37-mingw64-llvm | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- shell: bash | ||
- uses: eine/setup-msys2@v0 | ||
with: | ||
msystem: MINGW64 | ||
update: true | ||
install: mingw-w64-x86_64-python-pip | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The failure of this task should be fixed by adding make here: |
||
- uses: umarcor/setup-ghdl@master | ||
with: | ||
backend: llvm | ||
- name: Install dependencies | ||
shell: msys2 {0} | ||
run: | | ||
curl -fsSL -o ghdl.zip https://github.com/ghdl/ghdl/releases/download/v0.37/ghdl-${WINDOWS_RELEASE}.zip | ||
7z x ghdl.zip "-o../ghdl-tmp" -y | ||
mv ../ghdl-tmp/GHDL/${WINDOWS_RELEASE}/ ../ghdl | ||
rm -rf ../ghdl-tmp ghdl.zip | ||
export PATH=$PATH:$(pwd)/../ghdl/bin | ||
./${{ matrix.task}}/run.sh | ||
ghdl --version | ||
python -m pip install --progress-bar off pytest vunit_hdl | ||
- shell: msys2 {0} | ||
run: | | ||
python -m pytest -v -s -ra test.py --color=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,6 @@ ent* | |
tb* | ||
!*.vhd | ||
!*.vhdl | ||
doc/_build | ||
.vunit_hash | ||
**/vunit_out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
""" | ||
Verify that all example run scripts work correctly | ||
""" | ||
|
||
from sys import executable, platform | ||
from os import environ | ||
from pathlib import Path | ||
from subprocess import check_call | ||
import unittest | ||
import pytest | ||
|
||
|
||
class TestExamples(unittest.TestCase): | ||
""" | ||
Verify that example run scripts work correctly | ||
""" | ||
|
||
def setUp(self): | ||
self.shell = ['bash'] if platform == 'win32' else [] | ||
self.root = Path(__file__).parent | ||
self.vhpidirect = self.root / 'vhpidirect' | ||
self.vpi = self.root / 'vpi' | ||
|
||
def test_vhpidirect_quickstart_random(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'quickstart' / 'random' / 'run.sh')], shell=True) | ||
|
||
def test_vhpidirect_quickstart_math(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'quickstart' / 'math' / 'run.sh')], shell=True) | ||
|
||
def test_vhpidirect_quickstart_customc(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'quickstart' / 'customc' / 'run.sh')], shell=True) | ||
|
||
def test_vhpidirect_quickstart_wrapping_basic(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'quickstart' / 'wrapping' / 'basic' / 'run.sh')], shell=True) | ||
|
||
def test_vhpidirect_quickstart_wrapping_time(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'quickstart' / 'wrapping' / 'time' / 'run.sh')], shell=True) | ||
|
||
@unittest.skipUnless( | ||
platform != 'win32', | ||
"win: needs investigation, output of list-link seems to have wrong path format", | ||
) | ||
def test_vhpidirect_quickstart_linking_bind(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'quickstart' / 'linking' / 'bind' / 'run.sh')], shell=True) | ||
|
||
def test_vhpidirect_quickstart_package(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'quickstart' / 'package' / 'run.sh')], shell=True) | ||
|
||
def test_vhpidirect_quickstart_sharedvar(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'quickstart' / 'sharedvar' / 'run.sh')], shell=True) | ||
|
||
def test_vhpidirect_shared_shlib(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'shared' / 'shlib' / 'run.sh')], shell=True) | ||
|
||
@unittest.skipUnless( | ||
platform != 'win32', | ||
"win: dlfcn.h is not available on win", | ||
) | ||
def test_vhpidirect_shared_dlopen(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'shared' / 'dlopen' / 'run.sh')], shell=True) | ||
|
||
@unittest.skipUnless( | ||
platform != 'win32', | ||
"win: dlfcn.h is not available on win", | ||
) | ||
def test_vhpidirect_shared_shghdl(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'shared' / 'shghdl' / 'run.sh')], shell=True) | ||
|
||
def test_vhpidirect_arrays_intvector(self): | ||
# check_call(self.shell + [str(self.vhpidirect / 'arrays' / 'intvector' / 'run.sh')], shell=True) | ||
check_call(self.shell + ['make', 'run'], shell=True, cwd=str(self.vhpidirect / 'arrays' / 'intvector')) | ||
|
||
|
||
def test_vhpidirect_arrays_logicvector(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'arrays' / 'logicvector' / 'run.sh')], shell=True) | ||
|
||
def test_vhpidirect_arrays_matrices(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'arrays' / 'matrices' / 'run.sh')], shell=True) | ||
|
||
def test_vhpidirect_arrays_matrices_vunit_axis_vcs(self): | ||
check_call([executable, str(self.vhpidirect / 'arrays' / 'matrices' / 'vunit_axis_vcs' / 'run.py')], shell=True) | ||
|
||
@unittest.skipUnless( | ||
platform != 'win32', | ||
"win: needs ImageMagick's 'convert'", | ||
) | ||
def test_vhpidirect_arrays_matrices_framebuffer(self): | ||
check_call(self.shell + [str(self.vhpidirect / 'arrays' / 'matrices' / 'framebuffer' / 'run.sh')], shell=True) | ||
|
||
def test_vpi_quickstart(self): | ||
check_call(self.shell + [str(self.vpi / 'quickstart' / 'run.sh')], shell=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
CC ?= gcc | ||
GHDL ?= ghdl | ||
CFLAGS += -fPIC | ||
STD ?= 93 | ||
|
||
WORK_DIR ?= . | ||
|
||
VHDL_DEPS ?= tb.vhd | ||
VHDL_O_DEPS ?= $(patsubst %.vhd,%.o,$(VHDL_DEPS)) | ||
|
||
# Default | ||
refresh : clean run | ||
|
||
# Executable commands | ||
run : tb tb_main | ||
|
||
tb : c_tb | ||
@echo "Execute tb" | ||
./tb | ||
@echo | ||
|
||
tb_main : main_tb | ||
@echo "Execute main_tb" | ||
./main_tb | ||
@echo | ||
|
||
# Compile executable | ||
|
||
main_% : %.o mkdir_$(WORK_DIR) | ||
$(GHDL) -e --workdir=$(WORK_DIR)/ --std=$(STD) -Wl,main.c -o $@ $(subst main_,,$@) | ||
|
||
c_% : %.o mkdir_$(WORK_DIR) | ||
$(GHDL) -e --workdir=$(WORK_DIR)/ --std=$(STD) -Wl,caux.c $(subst c_,,$@) | ||
|
||
%.o : %.vhd mkdir_$(WORK_DIR) | ||
@echo "Analyze $<" | ||
$(GHDL) -a --std=$(STD) --workdir=$(WORK_DIR) $< | ||
|
||
mkdir_% : | ||
mkdir -p $(subst mkdir_,,$@) | ||
|
||
# Clean | ||
|
||
.PHONY: clean | ||
|
||
clean: clean_work clean_tb clean_tb_main | ||
|
||
clean_tb: | ||
rm -f ./tb | ||
|
||
clean_tb_main: | ||
rm -f ./tb_main | ||
|
||
clean_work: | ||
rm -f $(WORK_DIR)/*.o $(WORK_DIR)/work-obj*.cf |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The failure of this task might be legit. The
make
that is available in the PATH was not explicitly installed by us. It seems to be preinstalled from Chocolatey. We might investigate if we can make it work (e.g.check_call(['make', 'run'], shell=True, cwd=str(self.vhpidirect / 'arrays' / 'intvector'))
) or whether we need to useeine/setup-msys2
here too.I'd say that v0.37 windows releases of GHDL do require a MINGW environment. However, it has been surprising for me that just extracting the zipfile was working fine until now. Maybe GHDL was picking the MINGW libs of Git for Windows, which is installed by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to see it worked. It would have been a pain to fix win-stable otherwise...