You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For verification components, common enumeration types should be upstreamed from specific VCs like SPI to the common package, so multiple VCs can reuse these types.
Proposed Additions
1. Common Enumeration Types:
type ClockPolarity is (HIGH_ACTIVE, LOW_ACTIVE);
type ClockPhase is (RISING_EDGE, FALLING_EDGE);
type BitOrder is (LSB_FIRST, MSB_FIRST);
function position(iterator: natural; length: natural; bitOrder : SpiBitOrder) returnnatural;
function to_sl(ClockPhase : SpiClockPhase) returnstd_logic;
function to_sl(ClockPolarity : SpiClockPolarity) returnstd_logic;
Bodies:
function position(iterator: natural; length: natural; bitOrder : SpiBitOrder) returnnaturalisbeginif bitOrder = LSB_FIRST thenreturn iterator; -- filling from left to right in a downto vectorelsereturn length - iterator -1; -- filling from right to left in a downto vectorendif;
endfunction;
function to_sl(ClockPhase : SpiClockPhase) returnstd_logicisbeginif ClockPhase =FALLING_EDGEthenreturn'0';
elsereturn'1';
endif;
endfunction;
function to_sl(ClockPolarity : SpiClockPolarity) returnstd_logicisbeginif ClockPolarity = LOW_ACTIVE thenreturn'0';
elsereturn'1';
endif;
endfunction;
Usecases
XOR Operator
SCLK <= SpiClock xor ClockPolarity;
Position Function
MOSI <= TransmitStim.Data(position(i, TransmitStim.Data'length, BitOrder)) after tpd_Clk_MOSI;
to_sl(..) Conversion
waituntil SCLK = to_sl(ClockPhase);
Further Improvements
If OSVVM has a boolean to std_ulogic conversion, then some of the if..else-statements could be replaced by a function call.
For verification components, common enumeration types should be upstreamed from specific VCs like SPI to the common package, so multiple VCs can reuse these types.
Proposed Additions
1. Common Enumeration Types:
2. Overloaded Operators:
Bodies:
3. Helper Functions and Converters:
Bodies:
Usecases
XOR Operator
Position Function
to_sl(..) Conversion
Further Improvements
If OSVVM has a
boolean
tostd_ulogic
conversion, then some of theif..else
-statements could be replaced by a function call./cc @Asif71
The text was updated successfully, but these errors were encountered: