--FILENAME: wgenerator_SN54S251.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_SN54S251 is constant O_Pins : PINSET := NEW_PINSET (( TP_y, TP_w )) ; constant I_Pins : PINSET := ALL_PINS and not O_PINS ; constant EMPTY_EVENT : INTEGER := -1 ; procedure SN54S251_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: -- -- (y, w, -- str, a, b, c, -- d0, d1, d2, d3, d4, d5, d6, d7) -- variable WAVEFORM : WAVE_SLICE_LIST (1 to 26) := ( ( "UU" & "UUUU" & "UUUUUUUU", T1), ( "ZZ" & "1UUU" & "UUUUUUUU", T1), ( "ZZ" & "1ZXW" & "UX01ZLHW", T1), ( "XX" & "X000" & "00000000", T1), ( "01" & "0X00" & "00000000", T1), ( "XX" & "W000" & "00000000", T1), ( "XX" & "Z000" & "00000000", T1), ( "XX" & "XXXX" & "XXXXXXXX", T1), ( "ZZ" & "1000" & "01011100", T1), ( "01" & "0000" & "01011100", T1), ( "10" & "0100" & "01011100", T1), ( "01" & "0010" & "01011100", T1), ( "10" & "0110" & "01011100", T1), ( "10" & "0001" & "01011100", T1), ( "10" & "0101" & "01011100", T1), ( "01" & "0011" & "01011100", T1), ( "01" & "0111" & "01011100", T1), ( "ZZ" & "HLLL" & "HHLLLHHL", T1), ( "10" & "LLLL" & "HHLLLHHL", T1), ( "10" & "LHLL" & "HHLLLHHL", T1), ( "01" & "LLHL" & "HHLLLHHL", T1), ( "01" & "LHHL" & "HHLLLHHL", T1), ( "01" & "LLLH" & "HHLLLHHL", T1), ( "10" & "LHLH" & "HHLLLHHL", T1), ( "10" & "LLHH" & "HHLLLHHL", T1), ( "01" & "LHHH" & "HHLLLHHL", T1) ) ; begin APPLY_LIST(CONNECT, WAVEFORM) ; end ; procedure SN54S251_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 SN54S251_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 SN54S251_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 SN54S251_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 SN54S251_FILE_SLICE.END_OF_FILE loop READ_FILE_SLICE(Input_File, SN54S251_FILE_SLICE); if (SN54S251_FILE_SLICE.PERIOD_SET = TRUE) then if (SN54S251_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 (SN54S251_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 SN54S251_FILE_SLICE.INDEX >= SN54S251_UNCERTAINTY'LEFT and SN54S251_FILE_SLICE.INDEX <= SN54S251_UNCERTAINTY'RIGHT report "Error - Index out of range in file format" severity ERROR; WAVEFORM := (SN54S251_FILE_SLICE.CODES, (SN54S251_FILE_SLICE.PERIOD, SN54S251_UNCERTAINTY(SN54S251_FILE_SLICE.INDEX))); APPLY_SLICE(CONNECT, WAVEFORM) ; elsif (use_period = TRUE) then WAVEFORM := (SN54S251_FILE_SLICE.CODES, (SN54S251_FILE_SLICE.PERIOD, PERIOD_TD)); APPLY_SLICE(CONNECT, WAVEFORM) ; elsif (use_index = TRUE) then assert SN54S251_FILE_SLICE.INDEX >= SN54S251_TIMING'LEFT and SN54S251_FILE_SLICE.INDEX <= SN54S251_TIMING'RIGHT report "Error - Index out of range in file format" severity ERROR; WAVEFORM := (SN54S251_FILE_SLICE.CODES, SN54S251_TIMING(SN54S251_FILE_SLICE.INDEX)); APPLY_SLICE(CONNECT, WAVEFORM) ; else WAVEFORM := (SN54S251_FILE_SLICE.CODES, DEFAULT_TIMING); APPLY_SLICE(CONNECT, WAVEFORM) ; end if; end loop ; end ; end wgenerator_SN54S251 ;