2016-08-09 11 views
1

을 사용하는 GHDL + 코드 범위이 page (2005 년 Arnim Läuger 출신)은 도구 체인 {GHDL + gcov}이 VHDL 코드 적용을 수행 할 수 있다고 설명합니다.gcov (Ubuntu 16.04 LTS)

질문 : GCC, GCOV 및 GHDL의 최신 버전에서는 여전히 작동합니까?

다음 명령은

$ ghdl -a -Wc,-ftest-coverage -Wc,-fprofile-arcs tb_example.vhd 
ghdl: unknown option '-Wc,-ftest-coverage' for command '-a' 

내 설정은 다음과 같다 실패

$ gcc -v 
Using built-in specs. 
COLLECT_GCC=gcc 
COLLECT_LTO_WRAPPER=/usr/gnat/bin/../libexec/gcc/x86_64-pc-linux-gnu/4.9.4/lto-wrapper 
Target: x86_64-pc-linux-gnu 
Configured with: ../src/configure --enable-languages=ada,c,c++ --enable-dual-exceptions --enable-_cxa_atexit --enable-threads=posix --with-bugurl=URL:mailto:[email protected] --disable-nls --without-libiconv-prefix --disable-libstdcxx-pch --disable-libada --enable-checking=release --disable-multilib --with-mpfr=/boron.a/gnatmail/sandbox/gpl-2016/x86_64-linux/mpfr_stable/install --with-gmp=/boron.a/gnatmail/sandbox/gpl-2016/x86_64-linux/gmp_stable/install --with-mpc=/boron.a/gnatmail/sandbox/gpl-2016/x86_64-linux/mpc_stable/install --with-build-time-tools=/boron.a/gnatmail/sandbox/gpl-2016/x86_64-linux/gcc/build/buildtools/bin --prefix=/boron.a/gnatmail/sandbox/gpl-2016/x86_64-linux/gcc/pkg --build=x86_64-pc-linux-gnu 
Thread model: posix 
gcc version 4.9.4 20160426 (for GNAT GPL 2016 20160515) (GCC) 

$ gcov -v 
gcov (GCC) 4.9.4 20160426 (for GNAT GPL 2016 20160515) 
Copyright (C) 2015 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions. 
There is NO warranty; not even for MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE. 

$ ghdl -v 
GHDL 0.34dev (20151126) [Dunoon edition] 
Compiled with GNAT Version: GPL 2016 (20160515-49) 
mcode code generator 
Written by Tristan Gingold. 

Copyright (C) 2003 - 2015 Tristan Gingold. 
GHDL is free software, covered by the GNU General Public License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

$ cat /proc/version 
Linux version 4.4.0-34-generic ([email protected]) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2.1)) #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 

내가 mCode를 백엔드 절차와 건물을 사용 GHDL를 설치했습니다. 그것은 악의 뿌리일까요?

도움 주셔서 감사합니다.

답변

2

예, 현재 ghdl은 코드 적용 범위를 지원합니다.

ghdl 버전이 최신인지 확인하십시오.하지만 ghdl은 3 코드 생성 백엔드 (LLVM, gcc 및 자체 JIT 컴파일러, mcode)를 지원하지만 gcc 백엔드는 현재 gcov를 통해 코드 적용 범위를 지원합니다. 특히, 빌드 한 mcode 버전이 작동하지 않습니다.

우분투에 적합한 패키지가 있어야합니다. 데비안 Jessie의 소스에서 우분투 용으로 빌드해야하는 빌드 지침이 있습니다. (필요하다면 나는 그들을 파낼 것이다.)

지금 당신이 제공 할 필요가 일부 컴파일 시간 플래그가

ghdl --version 
GHDL 0.34dev (20151126) [Dunoon edition] 
Compiled with GNAT Version: 4.9.3 
GCC back-end code generator 
Written by Tristan Gingold. 

체크 ... ...

ghdl -a --std=08 -g -fprofile-arcs -ftest-coverage myfile.vhd 
ghdl -a --std=08 -g -fprofile-arcs -ftest-coverage my_TB.vhd 

과 정교화를위한 (-Wl,이 링커 옵션 앞에) ...

ghdl -e --std=08 -Wl,-lgcov -Wl,--coverage my_tb 
./my_tb 

그리고 파일 집합을 가지고으로 후 처리해야합니다.(또는 lcovgenhtml, 더욱 까다로운 보고서의 경우)

Vunit 및 OSVVM 라이브러리에서도 작동합니다.

VHDL의 신호 지정 의미 체계가 생성 된 실행 파일에서 많은 양의 분기로 변환되기 때문에 부분적으로 범위가 잘 작동하지 않습니다.

VUnit에서 "코드 커버리지"실험 옵션을 사용하지 않습니다. 대신 관련 플래그를 설정하고 vu.main() 함수를 실행하고 반환을 catch 한 후 lcov를 후 처리 단계로 호출합니다. 불완전한 예제 run.py 스크립트는 다음과 같습니다 :

lib.add_compile_option("ghdl.flags", ["-fprofile-arcs"]) 
vu.set_sim_option("ghdl.flags", ["-Wl,-lgcov"]) 
try: 
    vu.main() 
except SystemExit as exc: 
    all_ok = exc.code == 0 

if all_ok: 
    subprocess.call(["lcov", "--capture", "--directory", ".", "--output-file", "code_coverage.info"]) 
    subprocess.call(["genhtml", "code_coverage.info", "--output-directory", "code_html"]) 
+0

답변 해 주셔서 감사합니다. 매우 도움이됩니다. 나는 시도 할 것이고, 나는 여기에서 피드백을 줄 것이다. –

+0

GCC를 백엔드로 재구성 한 결과 이제는 훌륭하게 작동합니다. 고마워. 케이크에있는 체리는 VUnit이 생성 한 XML에서 커버리지 결과를 직접 포함한다는 것입니다. VUnit xml에 손쉽게 적용 범위를 포함시킬 수 있습니까? (현재는 .gcda +가 있습니다.gcno는 VUnit 실행에 의해 생성되지만 끝에 gcov bymyself를 실행해야합니다. 결과는 xml에 없습니다. –

+0

실험용 VUnit 지원 범위는 다른 시뮬레이터를 지원하기 위해 시작되었지만 ModelSim에만 해당됩니다. – lasplund

관련 문제