--FILENAME: wgenerator_SN54LS112.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. It was written specifically -- to apply test vectors to the model being tested. -- -- ------------------------------------------------------------------ library STD_PACK ; use STD_PACK.BASICDEFS.all ; use STD.Textio.all ; library FRAMES ; use FRAMES.Waves_Frames.all ; library DEVICE ; use DEVICE.Waves_Device.all ; use DEVICE.Waves_Objects.all ; library EVENTS ; use EVENTS.Waves_Utilities.all ; package body wgenerator_SN54LS112 is constant O_Pins : PINSET := NEW_PINSET (( TP_q1, TP_qb1, TP_q2, TP_qb2 )) ; constant I_Pins : PINSET := ALL_PINS and not O_PINS ; constant EMPTY_EVENT : INTEGER := -1 ; procedure SN54LS112_Test( signal Connect : inout Waves_Port_List) is constant Period : Time := 100 ns ; constant Uncertainty_Pct : real := 0.05 ; constant TDelay : EVENT_TIME := ETIME (Period - Uncertainty_Pct * Period); constant FSA : FRAME_SET_ARRAY := ADD_FRAME_SET_ARRAY ( NEW_FRAME_SET_ARRAY ( I_PINS, INPUT_FRAMES), NEW_FRAME_SET_ARRAY ( O_PINS, STROBED_OUTPUT_FRAMES(TDelay)) ); variable TD1 : TIME_DATA := NEW_TIME_DATA ( FSA ) ; variable T1 : WAVE_TIMING := (Period, TD1) ; constant Pulse : Time := 1 ns ; constant PulseDelay : EVENT_TIME := ETIME (Pulse - Uncertainty_Pct * Pulse); constant FSA_pulse : FRAME_SET_ARRAY := ADD_FRAME_SET_ARRAY ( NEW_FRAME_SET_ARRAY ( I_PINS, INPUT_FRAMES), NEW_FRAME_SET_ARRAY ( O_PINS, STROBED_OUTPUT_FRAMES(PulseDelay)) ); variable TD1_pulse : TIME_DATA := NEW_TIME_DATA ( FSA_pulse ) ; variable TP : WAVE_TIMING := (Pulse, TD1_pulse) ; -- Order of signals: -- -- ( q1, qb1, q2, qb2, -- clk1, j1, k1, pr1, clr1, -- clk2, j2, k2, pr2, clr2) -- variable CLEAR_TV_SET : WAVE_SLICE_LIST (1 to 2) := ( ( "????" & "UUUUU" & "UUUUU", T1), ( "0101" & "11110" & "11110", T1) ) ; variable PRESET_TV_SET : WAVE_SLICE_LIST (1 to 2) := ( ( "1010" & "11101" & "11101", T1), ( "1010" & "11111" & "11111", T1) ) ; variable CLK_PULSE : WAVE_SLICE_LIST (1 to 5) := ( ( "0101" & "11010" & "11010", T1), ( "0101" & "11011" & "11011", T1), ( "XXXX" & "N1011" & "N1011", T1), ( "1010" & "01011" & "01011", T1), ( "XXXX" & "P1011" & "P1011", T1) ) ; variable CLR_PULSE : WAVE_SLICE_LIST (1 to 4) := ( ( "0101" & "11110" & "11110", T1), ( "0101" & "1111P" & "1111P", T1), ( "1010" & "11101" & "11101", T1), ( "XXXX" & "1111N" & "1111N", T1) ) ; variable PRESET_PULSE : WAVE_SLICE_LIST (1 to 4) := ( ( "1010" & "11101" & "11101", T1), ( "1010" & "111P1" & "111P1", T1), ( "0101" & "11110" & "11110", T1), ( "XXXX" & "111N1" & "111N1", T1) ) ; variable SETUP_TIME : WAVE_SLICE_LIST (1 to 8) := ( ( "0101" & "11110" & "11110", T1), ( "0101" & "11111" & "11111", T1), ( "????" & "10111" & "10111", TP), ( "XXXX" & "00111" & "00111", T1), ( "0101" & "10110" & "10110", T1), ( "0101" & "10111" & "10111", T1), ( "????" & "11011" & "11011", TP), ( "XXXX" & "01011" & "01011", T1) ) ; variable HOLD_TIME : WAVE_SLICE_LIST (1 to 4) := ( ( "0101" & "11110" & "11110", T1), ( "0101" & "11111" & "11111", T1), ( "????" & "01111" & "01111", TP), ( "XXXX" & "00011" & "00011", T1) ) ; variable UNKNOWNS : WAVE_SLICE_LIST (1 to 12) := ( ( "0101" & "11110" & "11110", T1), ( "XXXX" & "1111X" & "1111X", T1), ( "1010" & "11101" & "11101", T1), ( "1X1X" & "1110X" & "1110X", T1), ( "1111" & "11100" & "11100", T1), ( "1010" & "11101" & "11101", T1), ( "XXXX" & "111X1" & "111X1", T1), ( "0101" & "11110" & "11110", T1), ( "X1X1" & "111X0" & "111X0", T1), ( "0101" & "11110" & "11110", T1), ( "0101" & "11111" & "11111", T1), ( "XXXX" & "X1111" & "X1111", T1) ) ; variable NORMAL : WAVE_SLICE_LIST (1 to 13) := ( ( "0101" & "10010" & "10010", T1), ( "0101" & "10011" & "10011", T1), ( "1010" & "10001" & "10001", T1), ( "1010" & "10011" & "10011", T1), ( "1010" & "00011" & "00011", T1), ( "1010" & "10111" & "10111", T1), ( "0101" & "00111" & "00111", T1), ( "0101" & "11011" & "11011", T1), ( "1010" & "01011" & "01011", T1), ( "1010" & "11111" & "11111", T1), ( "0101" & "01111" & "01111", T1), ( "0101" & "11111" & "11111", T1), ( "1010" & "01111" & "01111", T1) ) ; begin assert false report "Clear Outputs" severity note ; APPLY_LIST(CONNECT, CLEAR_TV_SET) ; assert false report "Preset Outputs" severity note ; APPLY_LIST(CONNECT, PRESET_TV_SET) ; assert false report "Clock Pulse Width Violation" severity note ; APPLY_LIST(CONNECT, CLK_PULSE) ; assert false report "Clear Pulse Width Violation" severity note ; APPLY_LIST(CONNECT, CLR_PULSE) ; assert false report "Preset Pulse Width Violation" severity note ; APPLY_LIST(CONNECT, PRESET_PULSE) ; assert false report "Setup Time Violation" severity note ; APPLY_LIST(CONNECT, SETUP_TIME) ; assert false report "Hold Time Violation" severity note ; APPLY_LIST(CONNECT, HOLD_TIME) ; assert false report "Unknown Values on Control Inputs" severity note ; APPLY_LIST(CONNECT, UNKNOWNS) ; assert false report "Normal Operation" severity note ; APPLY_LIST(CONNECT, NORMAL) ; end ; procedure SN54LS112_Test_From_File( signal Connect : out Waves_Port_List ; Input_File_Name : String) is ---------------------------------------------------------------------- -- The following declarations are used when only the PERIOD field is -- read from the external file. ---------------------------------------------------------------------- constant FSA : FRAME_SET_ARRAY := ADD_FRAME_SET_ARRAY ( NEW_FRAME_SET_ARRAY (I_PINS, INPUT_FRAMES), NEW_FRAME_SET_ARRAY (O_PINS, OUTPUT_FRAMES) ); variable PERIOD_TD : TIME_DATA := NEW_TIME_DATA (FSA) ; ---------------------------------------------------------------------- -- The following declarations are used when only the INDEX field is -- read from the external file. ---------------------------------------------------------------------- constant Period1 : Time := 100 ns ; constant Uncertainty_Pct1 : real := 0.05 ; constant TDelay1 : EVENT_TIME := ETIME (Period1 - (Uncertainty_Pct1 * Period1)); constant FSA1 : FRAME_SET_ARRAY := ADD_FRAME_SET_ARRAY ( NEW_FRAME_SET_ARRAY ( I_PINS, INPUT_FRAMES), NEW_FRAME_SET_ARRAY ( O_PINS, STROBED_OUTPUT_FRAMES(TDelay1)) ); variable INDEX_TD1 : TIME_DATA := NEW_TIME_DATA ( FSA1 ) ; constant Period2 : Time := 1 ns ; constant Uncertainty_Pct2 : real := 0.05 ; constant TDelay2 : EVENT_TIME := ETIME (Period2 - Uncertainty_Pct2 * Period2); constant FSA2 : FRAME_SET_ARRAY := ADD_FRAME_SET_ARRAY ( NEW_FRAME_SET_ARRAY ( I_PINS, INPUT_FRAMES), NEW_FRAME_SET_ARRAY ( O_PINS, STROBED_OUTPUT_FRAMES(TDelay2)) ); variable INDEX_TD2 : TIME_DATA := NEW_TIME_DATA ( FSA2 ) ; variable SN54LS112_TIMING : WAVE_TIMING_LIST (1 to 2) := ( (Period1, INDEX_TD1), (Period2, INDEX_TD2) ) ; ---------------------------------------------------------------------- -- The following declarations are used when both the PERIOD field and -- the INDEX field are read from the external file. The uncertainty -- periods are the same as those used when only the INDEX field is set. ---------------------------------------------------------------------- variable SN54LS112_UNCERTAINTY : TIME_DATA_LIST (1 to 2) := ( INDEX_TD1, INDEX_TD2 ) ; ---------------------------------------------------------------------- -- The following declarations are used when neither the PERIOD field -- nor the INDEX field is read from the external file. ---------------------------------------------------------------------- constant Default_Period : Time := 100 ns ; constant Uncertainty_Pct : real := 0.05 ; constant Default_TDelay : EVENT_TIME := ETIME (Default_Period - Uncertainty_Pct * Default_Period); constant Default_FSA : FRAME_SET_ARRAY := ADD_FRAME_SET_ARRAY ( NEW_FRAME_SET_ARRAY ( I_PINS, INPUT_FRAMES), NEW_FRAME_SET_ARRAY ( O_PINS, STROBED_OUTPUT_FRAMES(Default_TDelay)) ); variable TD2 : TIME_DATA := NEW_TIME_DATA ( Default_FSA ) ; variable DEFAULT_TIMING : WAVE_TIMING := (Default_Period, TD2) ; --------------------------------------------------------------------- file Input_File : Text is in Input_File_Name ; variable SN54LS112_FILE_SLICE : FILE_SLICE ; variable WAVEFORM : WAVE_SLICE ; variable use_period_and_index : BOOLEAN := FALSE; variable use_period : BOOLEAN := FALSE; variable use_index : BOOLEAN := FALSE; begin while not SN54LS112_FILE_SLICE.END_OF_FILE loop READ_FILE_SLICE(Input_File, SN54LS112_FILE_SLICE); if (SN54LS112_FILE_SLICE.PERIOD_SET = TRUE) then if (SN54LS112_FILE_SLICE.INDEX_SET = TRUE) then use_period_and_index := TRUE; use_period := FALSE; use_index := FALSE; else use_period := TRUE; use_period_and_index := FALSE; use_index := FALSE; end if; elsif (SN54LS112_FILE_SLICE.INDEX_SET = TRUE) then use_index := TRUE; use_period_and_index := FALSE; use_period := FALSE; end if; if (use_period_and_index = TRUE) then assert SN54LS112_FILE_SLICE.INDEX >= SN54LS112_UNCERTAINTY'LEFT and SN54LS112_FILE_SLICE.INDEX <= SN54LS112_UNCERTAINTY'RIGHT report "Error - Index out of range in file format" severity ERROR; WAVEFORM := (SN54LS112_FILE_SLICE.CODES, (SN54LS112_FILE_SLICE.PERIOD, SN54LS112_UNCERTAINTY(SN54LS112_FILE_SLICE.INDEX))); APPLY_SLICE(CONNECT, WAVEFORM) ; elsif (use_period = TRUE) then WAVEFORM := (SN54LS112_FILE_SLICE.CODES, (SN54LS112_FILE_SLICE.PERIOD, PERIOD_TD)); APPLY_SLICE(CONNECT, WAVEFORM) ; elsif (use_index = TRUE) then assert SN54LS112_FILE_SLICE.INDEX >= SN54LS112_TIMING'LEFT and SN54LS112_FILE_SLICE.INDEX <= SN54LS112_TIMING'RIGHT report "Error - Index out of range in file format" severity ERROR; WAVEFORM := (SN54LS112_FILE_SLICE.CODES, SN54LS112_TIMING(SN54LS112_FILE_SLICE.INDEX)); APPLY_SLICE(CONNECT, WAVEFORM) ; else WAVEFORM := (SN54LS112_FILE_SLICE.CODES, DEFAULT_TIMING); APPLY_SLICE(CONNECT, WAVEFORM) ; end if; end loop ; end ; end wgenerator_SN54LS112 ;