-- FILE NAME: waves_utilities.vhd -- -- DISCLAIMER -- -- This code is the sole property of the Institute for Technology -- Development (ITD), Jackson, Mississippi, and is distributed for -- the purpose of providing examples of VHDL models written to -- modeling standards. This code may not be used for commercial -- purposes, and may not be redistributed without permission from -- the Institute for Technology Development. ITD assumes no -- responsibility for errors, omissions, uses made, or decisions -- based on its use. No warranties, expressed or implied, are given. -- -- This is a modified IEEE WAVES package. This package was modified -- to handle the logic_mv state/strength value system used in the -- models being tested. -- -- ------------------------------------------------------------------ use STD.Textio.all; library WAVES_STANDARD; use WAVES_STANDARD.WAVES_STANDARD.all; library EVENTS ; use EVENTS.Waves_Events.all ; library DEVICE ; use DEVICE.Waves_Device.all ; -- depends on value_dictionary also package body Waves_Utilities is FUNCTION waves_to_logic_mv (waves_code: in CHARACTER) return logic_mv is begin case waves_code is when 'U' => return 'U'; when 'X' => return 'X'; when '0' => return '0'; when '1' => return '1'; when 'Z' => return 'Z'; when 'L' => return 'L'; when 'H' => return 'H'; when 'W' => return 'W'; when others => return 'X'; end case; end waves_to_logic_mv; FUNCTION logic_mv_to_waves(input: in logic_mv) return CHARACTER is begin case input is when 'U' => return 'U'; when 'X' => return 'X'; when '0' => return '0'; when '1' => return '1'; when 'Z' => return 'Z'; when 'L' => return 'L'; when 'H' => return 'H'; when 'W' => return 'W'; when others => return 'X'; end case; end logic_mv_to_waves; FUNCTION Waves_Port_to_Logic_Value(Input: Waves_Port) return Logic_Value is begin if (Input.DATA >= Logic_Value'Pos(Logic_Value'Left) and Input.DATA <= Logic_Value'Pos(Logic_Value'Right)) then return Logic_Value'Val(Input.Data); else return X; end if; end Waves_Port_to_Logic_Value; FUNCTION Integer_to_logic_mv(Input: Integer) return logic_mv is begin if (Input >= logic_mv'Pos(logic_mv'Left) and Input <= logic_mv'Pos(logic_mv'Right)) then return logic_mv'Val(Input); else return 'X'; end if; end Integer_to_logic_mv; procedure Check_Response( constant Which_One : in Positive ; signal Response : in logic_mv; signal Prediction : in Waves_Port ; signal Compare : in boolean ; constant How_To_Report : in Comparison_Format ; constant Assertion_Level : Severity_Level ; signal Match : out boolean ) is variable Comparison_Result : boolean ; variable Out_Line : Line ; begin while TRUE loop wait on Prediction.DATA, Response ; if Compare then if Value_Dictionary(Waves_Port_To_Logic_Value(Prediction)). Response_Logic.Logic_Relevance = Care then Comparison_Result := Prediction.CODE = logic_mv_to_waves(Response) ; case How_To_Report is when Assign_To_Signal => Match <= Comparison_Result ; when Do_Assertion => Write(Out_Line, String'("Device ")); Write(Out_Line, Device_Id) ; Write(Out_Line, String'(" : Pin ")); Write(Out_Line, Pin_name(Test_Pins'Val(Which_One-1))); Write(Out_Line, String'(": Comparison failed at ")); Write(Out_Line, Now); Write(Out_Line, String'(" ; Actual Response is : ")); Write(Out_Line, logic_mv_to_waves(Response)); Write(Out_Line, String'(" ; Prediction was : ")); Write(Out_Line, Prediction.CODE) ; assert Comparison_Result report Out_Line.all severity Assertion_Level ; Deallocate(Out_Line) ; when Write_Comparison_To_File => if Comparison_Result then Write(Out_Line, String'(" ")); else Write(Out_Line, String'("Comparison failed at ")); end if; Write(Out_Line, Now); Write(Out_Line, String'(" ; Actual Response is : ")); Write(Out_Line, logic_mv_to_waves(Response)); Write(Out_Line, String'(" ; Prediction was : ")); Write(Out_Line, logic_mv_to_waves(Integer_to_Logic_mv(Prediction.Data))); Writeline(Output, Out_Line); end case ; else if How_To_Report = Assign_To_Signal then Match <= True ; end if; end if; end if; end loop; end ; procedure Signal_Monitor ( Output_File_Name : in String ; signal Signals : in logic_mv_Vector -- Collection of all ports of DUT -- it has the same length as the number of pins in the DUT -- in the order specified in Test_Pins; ) is file Out_File : TEXT is out Output_File_Name ; variable Last_time : time := 0 ns ; variable Out_line : LINE ; variable Codes : String(Signals'Left + 1 to Signals'Right + 1) ; variable First_Time : boolean := True ; begin write (Out_Line, String'("-- *** ")); write (Out_Line, Device_Id) ; write (Out_Line, String'(" *** ")); writeline (Out_File, Out_Line) ; write (Out_Line, String'("--")); writeline (Out_File, Out_Line) ; for I in 1 to Num_Lines loop write (Out_Line, header(I)); writeline (Out_File, Out_Line); end loop; While TRUE loop for I in Codes'Range loop Codes(I) := logic_mv_to_waves(Signals(I-1)) ; end loop ; write(Out_line, Now, Right, 16, ps); write(Out_line, String'(" ")); for I in Codes'Range loop write (Out_Line, String'(" ")); write(Out_line, Codes(I)); end loop ; writeline(Out_File, Out_line); wait on Signals for 1000 ns ; if not Signals'event then wait; end if; end loop ; end Signal_Monitor ; end Waves_Utilities ;