--FILENAME: wgenerator_SN54LS04.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_SN54LS04 is constant I_Pins : PINSET := NEW_PINSET (( TP_a1, TP_a2, TP_a3, TP_a4, TP_a5, TP_a6 )) ; constant O_Pins : PINSET := ALL_PINS and not I_PINS ; constant EMPTY_EVENT : INTEGER := -1 ; procedure SN54LS04_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) ; -- Order of signals: -- -- (y1, y2, y3, y4, y5, y6, -- a1, a2, a3, a4, a5, a6) -- variable WAVEFORM : WAVE_SLICE_LIST (1 to 12) := ( ( "UUUUUU" & "UUUUUU", T1), ( "XXXXXX" & "XXXXXX", T1), ( "000000" & "111111", T1), ( "XXXXXX" & "XXXXXX", T1), ( "111111" & "LLLLLL", T1), ( "XXXXXX" & "XXXXXX", T1), ( "000000" & "HHHHHH", T1), ( "XXXXXX" & "XXXXXX", T1), ( "111111" & "000000", T1), ( "000000" & "111111", T1), ( "111111" & "000000", T1), ( "000000" & "111111", T1) ) ; begin APPLY_LIST(CONNECT, WAVEFORM) ; end ; procedure SN54LS04_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 Period_TDelay : EVENT_TIME := ETIME (15 ns) ; 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 SN54LS04_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 SN54LS04_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 SN54LS04_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 SN54LS04_FILE_SLICE.END_OF_FILE loop READ_FILE_SLICE(Input_File, SN54LS04_FILE_SLICE); if (SN54LS04_FILE_SLICE.PERIOD_SET = TRUE) then if (SN54LS04_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 (SN54LS04_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 SN54LS04_FILE_SLICE.INDEX >= SN54LS04_UNCERTAINTY'LEFT and SN54LS04_FILE_SLICE.INDEX <= SN54LS04_UNCERTAINTY'RIGHT report "Error - Index out of range in file format" severity ERROR; WAVEFORM := (SN54LS04_FILE_SLICE.CODES, (SN54LS04_FILE_SLICE.PERIOD, SN54LS04_UNCERTAINTY(SN54LS04_FILE_SLICE.INDEX))); APPLY_SLICE(CONNECT, WAVEFORM) ; elsif (use_period = TRUE) then WAVEFORM := (SN54LS04_FILE_SLICE.CODES, (SN54LS04_FILE_SLICE.PERIOD, PERIOD_TD)); APPLY_SLICE(CONNECT, WAVEFORM) ; elsif (use_index = TRUE) then assert SN54LS04_FILE_SLICE.INDEX >= SN54LS04_TIMING'LEFT and SN54LS04_FILE_SLICE.INDEX <= SN54LS04_TIMING'RIGHT report "Error - Index out of range in file format" severity ERROR; WAVEFORM := (SN54LS04_FILE_SLICE.CODES, SN54LS04_TIMING(SN54LS04_FILE_SLICE.INDEX)); APPLY_SLICE(CONNECT, WAVEFORM) ; else WAVEFORM := (SN54LS04_FILE_SLICE.CODES, DEFAULT_TIMING); APPLY_SLICE(CONNECT, WAVEFORM) ; end if; end loop ; end ; end wgenerator_SN54LS04 ;