Electrical Engineering Asked by Cit5 on December 17, 2021
I have a behavioral model of an external RAM part. This vendor seems to have used some external library functions or procedure they made.
It has these functions like:
MinDelay (a, b) return c; –where a,b,c are VitalDelayTime01
MaxDelay (a, b) return c; — ""
Other subprograms such as this are also included.
I have already asked for this common library they used, but in case they don’t respond, I was looking into just creating these functions myself. I already got a different procedure to compile. Now I am looking into these which do some type of modification of these two VitalDelayType01 variables.
Could I do a comparison of variable that are VitalDelayType01? If so, what is the syntax for that? What if it is a vector of VitalDelayType01?
ex1:
-- MinDelay (returns lesser of a or b)
if a < b then
c <= a;
else
c <= b;
end if;
ex2:
-- a is a VitalDelayType01(n downto 0);
if a(0) < b(0) then
c(0) <= a(0);
else
c(0) <= b(0);
end if;
From the VITAL_Timing package source:
PACKAGE VITAL_Timing IS
TYPE VitalTransitionType IS ( tr01, tr10, tr0z, trz1, tr1z, trz0,
tr0X, trx1, tr1x, trx0, trxz, trzx);
SUBTYPE VitalDelayType IS TIME;
TYPE VitalDelayType01 IS ARRAY (VitalTransitionType RANGE tr01 to tr10)
OF TIME;
The index type of VitalDelayType01 is the enumerated type VitalTransitionType.
IEEE Std 1076-2008
5.2.3 Integer types
5.2.3.1 General
Integer literals are the literals of an anonymous predefined type that is called universal_integer in this standard. Other integer types have no literals. However, for each integer type there exists an implicit conversion that converts a value of type universal_integer into the corresponding value (if any) of the integer type (see 9.3.6).
The literal 0
s in ex2 cannot be converted to type VitalTransitionType without using the predefined attribute VitalTransitionType'VAL(0)
to convert to a position number (An enumerated type has a position from 0 to N, left to right). Here the resulting value would be tr01
.
The element value of the array type VitalDelayType01 is of type TIME. You can rely on the overload and predefined operators of type TIME for operations on elements.
For ex1 relational operators for arrays of values of type TIME don't appear to make arithmetic sense. This precludes using an overload for relational operators which would explain function names MinDelay
and MaxDelay
.
For an array subtype with only two delay elements (tr01
and tr10
) you could imagine identifying either delay element exceeding it's corresponding element time value in the second parameter being sufficient to define Min or Max.
For 'opposite' answers between the corresponding element pairs you'd have to look at the magnitude of the differences between the corresponding elements.
Answered by user8352 on December 17, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP