--FILENAME: wgenerator_SN54S138.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_SN54S138 is constant I_Pins : PINSET := NEW_PINSET (( TP_a, TP_b, TP_c, TP_g1, TP_g2a, TP_g2b )) ; constant O_Pins : PINSET := ALL_PINS and not I_PINS ; constant EMPTY_EVENT : INTEGER := -1 ; procedure SN54S138_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: -- -- (y0, y1, y2, y3, y4, y5, y6, y7, -- a, b, c, g1, g2a, g2b) -- variable WAVEFORM : WAVE_SLICE_LIST (1 to 28) := ( ( "UUUUUUUU" & "UUUUUU", T1), ( "11111111" & "000000", T1), ( "01111111" & "000100", T1), ( "10111111" & "100100", T1), ( "11011111" & "010100", T1), ( "11101111" & "110100", T1), ( "11110111" & "001100", T1), ( "11111011" & "101100", T1), ( "11111101" & "011100", T1), ( "11111110" & "111100", T1), ( "111111XX" & "X11100", T1), ( "1X1X1X1X" & "1XX100", T1), ( "XXXXXXXX" & "XXX100", T1), ( "11X11111" & "010X00", T1), ( "11011111" & "010100", T1), ( "11111111" & "0100W0", T1), ( "11X11111" & "0101X0", T1), ( "11011111" & "010100", T1), ( "11X11111" & "01010Z", T1), ( "11111111" & "LLLLLL", T1), ( "01111111" & "LLLHLL", T1), ( "10111111" & "HLLHLL", T1), ( "11011111" & "LHLHLL", T1), ( "11101111" & "HHLHLL", T1), ( "11110111" & "LLHHLL", T1), ( "11111011" & "HLHHLL", T1), ( "11111101" & "LHHHLL", T1), ( "11111110" & "HHHHLL", T1) ) ; begin APPLY_LIST(CONNECT, WAVEFORM) ; end ; procedure SN54S138_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 SN54S138_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 SN54S138_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 SN54S138_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 SN54S138_FILE_SLICE.END_OF_FILE loop READ_FILE_SLICE(Input_File, SN54S138_FILE_SLICE); if (SN54S138_FILE_SLICE.PERIOD_SET = TRUE) then if (SN54S138_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 (SN54S138_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 SN54S138_FILE_SLICE.INDEX >= SN54S138_UNCERTAINTY'LEFT and SN54S138_FILE_SLICE.INDEX <= SN54S138_UNCERTAINTY'RIGHT report "Error - Index out of range in file format" severity ERROR; WAVEFORM := (SN54S138_FILE_SLICE.CODES, (SN54S138_FILE_SLICE.PERIOD, SN54S138_UNCERTAINTY(SN54S138_FILE_SLICE.INDEX))); APPLY_SLICE(CONNECT, WAVEFORM) ; elsif (use_period = TRUE) then WAVEFORM := (SN54S138_FILE_SLICE.CODES, (SN54S138_FILE_SLICE.PERIOD, PERIOD_TD)); APPLY_SLICE(CONNECT, WAVEFORM) ; elsif (use_index = TRUE) then assert SN54S138_FILE_SLICE.INDEX >= SN54S138_TIMING'LEFT and SN54S138_FILE_SLICE.INDEX <= SN54S138_TIMING'RIGHT report "Error - Index out of range in file format" severity ERROR; WAVEFORM := (SN54S138_FILE_SLICE.CODES, SN54S138_TIMING(SN54S138_FILE_SLICE.INDEX)); APPLY_SLICE(CONNECT, WAVEFORM) ; else WAVEFORM := (SN54S138_FILE_SLICE.CODES, DEFAULT_TIMING); APPLY_SLICE(CONNECT, WAVEFORM) ; end if; end loop ; end ; end wgenerator_SN54S138 ;