을 (, BTW 난 ...이 측면은 시뮬레이터 의존하는 기대하지 않는 경우에도, 퀘 스타를 사용) 파이썬 Cocotb 코드가 가능할 수도 있지만 합성에 사용 된 동일한 값이 전달되도록해야하기 때문에 오류가 발생하기 쉽습니다.
또 다른 해결책은 내용 top_config.vhdl
, 예를 들어, 별도의 파일에 저장되어있는 최상위 엔티티에 대한 구성 패키지를 가지고있다 : 여기에 정의
library ieee;
use ieee.std_logic_1164.all;
package top_config is
constant AA : positive := 5;
constant BB : integer := 10;
end package top_config;
상수, 다음의 기본 값으로 사용된다 최상위 엔티티의 제네릭 또는 최상위 엔티티에 직접 포함됩니다.
패키지
은 Cocotb 테스트 벤치 내에서 일부 파이썬 코드를 통해 지금 구문 분석 할 수 있습니다
이
from re import compile as re_compile
constantRegExpStr = r"^\s*constant\s*" # keyword and spaces
constantRegExpStr += r"(?P<name>\w+)" # name fo constant
constantRegExpStr += r"\s*:\s*" # divider and spaces
constantRegExpStr += r"(?P<type>\w+)" # type name
constantRegExpStr += r"\s*:=\s*" # assignment and spaces
constantRegExpStr += r"(?P<value>[0-9]+)" # value
constantRegExpStr += r"\s*;" # end of statement
constantRegExp = re_compile(constantRegExpStr)
with open("top_config.vhdl") as f:
for line in f.readlines():
m = constantRegExp.match(line)
if m is not None:
print("constant '{0}' with value '{1}'".format(m.group('name'), m.group('value')))
대신 경기를 인쇄, 당신은 사전에 추가 또는 뭔가 다른 작업을 수행 할 수 있습니다.
신디사이저의 출력이 RTL처럼 보이지 않는 경우가 종종 있습니다. 고전적인 방법은 랩퍼를 사용하는 것입니다. 인터페이스 (VHDL 케이스의 엔티티)가 원본 RTL처럼 보이는 더미 계층 구조에서 게이트 레벨 모델을 인스턴스화합니다. –