Reply To: How to compare compare std_logic and integer
Why OSVVM™? › Forums › VHDL › How to compare compare std_logic and integer › Reply To: How to compare compare std_logic and integer
October 19, 2012 at 13:17
#415
Jim Lewis
Member
Hi Steve,
CoveragePkg contains a to_integer function for both std_logic and boolean. So your assertion is no more than:
signal sig_std_logic : std_logic ; signal sig_integer : integer ; . . . if to_integer(sig_std_logic) = sig_integer then
OTOH, if you are trying to compare a std_logic_vector, use the to_integer function from package, ieee.numeric_std_unsigned.
The following shows a way to randomize a value between 0 and 1 in std_logic:
TestProc : process
variable RV : RandomPType ; variable B_sl : std_logic ; begin (0 => B_sl) := RV.RandSlv(0, 1, 1) ;
Best,
Jim