저는 VHDL-2008에서 일반 패키지 (목록)를 만들고 있습니다. 이 패키지에는 요소 유형에 대한 유형이 있습니다. 패키지 내에이 요소 유형의 배열 유형을 선언하면 새로운 유형입니다. 예를 들어 정수, 내 새로운 integer_array가 라이브러리 ieee의 integer_vector와 호환되지 않습니다.배열 형식을 제네릭 형식 매개 변수로 VHDL 패키지에 전달하는 방법은 무엇입니까?
그래서 배열 유형 (예 : integer_vector)을 전달해야합니다.
Prefix of attribute "range" must be appropriate for an array object or must denote an array subtype.
어떻게 제네릭 형식 매개 변수가 배열되는 나타낸다 : 해당 배열 형식의 배열 인스턴스가 'range
속성을 사용하는 경우, 그것은 나 QuestaSim에 경고 준다?
일반 패키지 :
package SortListGenericPkg is
generic (
type ElementType; -- e.g. integer
type ArrayofElementType; -- e.g. integer_vector
function LessThan(L : ElementType; R : ElementType) return boolean; -- e.g. "<"
function LessEqual(L : ElementType; R : ElementType) return boolean -- e.g. "<="
);
function inside (constant E : ElementType; constant A : in ArrayofElementType) return boolean;
end package;
package body SortListGenericPkg is
function inside (constant E : ElementType; constant A : in ArrayofElementType) return boolean is
begin
for i in A'range loop -- this line causes the error
if E = A(i) then
return TRUE ;
end if ;
end loop ;
return FALSE ;
end function inside ;
end package body;
인스턴스화 : 그것은 어쩌면 VHDL 표준 문제, 그래서는
package SortListPkg is
package SortListPkg_int is new work.SortListGenericPkg
generic map (
ElementType => integer,
ArrayofElementType => integer_vector,
LessThan => "<",
LessEqual => "<="
);
alias Integer_SortList is SortListPkg_int.SortListPType;
end package SortListPkg ;
IEEE Std 1076-2008 16.2.3 배열의 사전 정의 된 특성, A'RANGE, Prefix : * 배열 객체 또는 그 별칭에 적합한 모든 접두어 A 또는 색인 범위가 정의 된 배열 하위 유형을 나타냅니다. * ArrayofElementType 클래스 및 하위 유형은 정교화 될 때까지 알 수 없습니다. 6.5.3 인터페이스 유형 선언 * 인터페이스 유형에 대한 값 및 적용 가능한 연산 세트는 환경의 연관된 부속 유형에 의해 결정될 수 있습니다 *, * ... 정의되지 않은 기본 유형 및 기본 유형의 부속 유형. 기본 유형의 클래스 (5.1 참조)가 정의되지 않았습니다. * – user1155120