---------------------------------------------------------------------------- -- -- Copyright (c) 1993 by Synopsys, Inc. All rights reserved. -- -- This source file may be used and distributed without restriction -- provided that this copyright statement is not removed from the file -- and that any derivative work contains this copyright notice. -- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -- -- Package name: GS_Types -- -- Purpose: This package defines the types and basic functions -- for the Gate Sim IEEE std_logic_1164 simulations. -- -- Author: TY, SL -- ---------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.std_logic_1164.all; USE IEEE.std_logic_misc.strength; PACKAGE GS_Types IS -- synopsys synthesis_off ------------------------------------------------------------------- -- Define Truth_Table type ------------------------------------------------------------------- TYPE Table_Logic IS ('Z', -- same as MVL9_Z '0', -- same as MVL9_0 '1', -- same as MVL9_1 'X', -- same as MVL9_X 'N' -- no_change ); SUBTYPE val_ZX IS Table_Logic RANGE 'Z' to 'X'; TYPE val_Z01X_vector IS ARRAY ( NATURAL RANGE <>) OF val_ZX; ------------------------------------------------------------------- -- Define integer_vector type ------------------------------------------------------------------- TYPE integer_vector IS ARRAY ( NATURAL RANGE <>) OF integer; ------------------------------------------------------------------- -- Define time_vector type ------------------------------------------------------------------- TYPE time_vector IS ARRAY ( NATURAL RANGE <>) OF time; ------------------------------------------------------------------- -- Define Delay_Param type ------------------------------------------------------------------- TYPE Transition IS (tran_none, tran_01, tran_10, tran_0Z, tran_Z1, tran_1Z, tran_Z0); TYPE pin_delay IS ARRAY ( Transition RANGE tran_01 TO tran_Z0 ) OF TIME; TYPE delay_table IS ARRAY ( NATURAL RANGE <>) OF pin_delay; ------------------------------------------------------------------- -- Additional type / constant / attribute for state-dependent delay ------------------------------------------------------------------- TYPE Transition_vector IS ARRAY ( NATURAL RANGE <>) OF Transition; ATTRIBUTE SDT_FUNCTION : string; ATTRIBUTE CTC_FUNCTION : string; ATTRIBUTE SDT_ARCH : boolean; ATTRIBUTE CTC_ARCH : boolean; ATTRIBUTE SDT_FUNCTION_FLAG : boolean; ATTRIBUTE CTC_FUNCTION_FLAG : boolean; ------------------------------------------------------------------- -- Define InMapZ and sequential lut type ------------------------------------------------------------------- SUBTYPE val_0X IS Table_Logic RANGE '0' to 'X'; TYPE val_01X_vector IS ARRAY ( NATURAL RANGE <>) OF val_0X; ------------------------------------------------------------------- -- Define PulseHandling type ------------------------------------------------------------------- TYPE ph_option IS (ph_inertial, ph_spike, ph_glitch, ph_transport); ------------------------------------------------------------------- -- Define PulseHandling type that allows only Intertial or Transport ------------------------------------------------------------------- TYPE ph_option_IorT IS (ph_inertial, ph_transport); ------------------------------------------------------------------- ------------------------------------------------------------------- -- Define sequential lut_next type ------------------------------------------------------------------- SUBTYPE val_0N IS Table_Logic RANGE '0' to 'N'; TYPE val_01XN_vector IS ARRAY ( NATURAL RANGE <>) OF val_0N; --************************************************************************** --* * --* Historical note: There are two ways of specifying constraints * --* for SEQGENs. The first is via entries in the "constraint_param", * --* the second is via entries in the "cond_constraint_param". The * --* entries in the constraint_param mention a Constraint_Type, whose * --* meaning is defined via the "constraint_define_table" in the * --* gs_libcore package. The entries in the cond_constraint_param * --* allow conditional constraints, for which there is no such * --* global table -- all the parameters are specified in the * --* cond_constraint_param. However, the "conditions" come from * --* a function tied to the SEQGEN through a VSS-specific VHDL kludge, * --* similar to what is used for state-dependent timing functions. * --* The cond_constraint_param can also specify certain kinds of * --* constraints that are completely built-into the SEQGEN's * --* constraint-checking apparatus. * --* * --* Historically, the constraint_param was the first facility. * --* Its method of parameterization is awkward, both because * --* of the use of a table in another package, and because the polarities * --* of the start and end events were not specifiable in the * --* constraint_param itself, thus resulting in an explosion in the * --* number of entries in the table. Certain kinds of "conditional" * --* constraints can be specified, but the set of possible conditions * --* is fixed. * --* * --* When user-programmable constraints were needed, the * --* cond_constraint_param was introduced. Indirection through a * --* separate table was avoided this time, and polarities were made * --* directly programmable in the cond_constraint_param. Some types of * --* constraints, such as "symmetric-skew" and "no-change", didn't * --* fit the format, but were put in as variants in the * --* cond_constraint_param to avoid having yet a third kind of * --* constraint parameter. * --* * --* * --************************************************************************* ------------------------------------------------------------------- -- Define sequential constraint_param type ------------------------------------------------------------------- TYPE Constraint_Type IS ( -------------------------------- -- TIMING CHECK FOR Flip-Flop -- -------------------------------- --- HOLD CHECK --- -- hold_rising_ff, -- from clock rise to data change hold_falling_ff, -- from clock fall to data change --- SETUP CHECK --- -- setup_rising_ff, -- from data change to clock rise setup_falling_ff, -- from data change to clock fall --- RECOVERY CHECK --- -- recovery_clear_rise_rising_ff, -- from clear rise to clock rise recovery_clear_fall_rising_ff, -- from clear fall to clock rise recovery_clear_rise_falling_ff, -- from clear rise to clock fall recovery_clear_fall_falling_ff, -- from clear fall to clock fall recovery_preset_rise_rising_ff, -- from preset rise to clock rise recovery_preset_fall_rising_ff, -- from preset fall to clock rise recovery_preset_rise_falling_ff,-- from preset rise to clock fall recovery_preset_fall_falling_ff,-- from preset fall to clock fall --- PULSE WIDTH CHECK --- -- pwidth_pos_lo_ff, -- clock rise to clock fall, clock active fall pwidth_pos_hi_ff, -- clock rise to clock fall, clock active rise pwidth_neg_hi_ff, -- clock fall to clock rise, clock active rise pwidth_neg_lo_ff, -- clock fall to clock rise, clock active fall --- CLOCK PERIOD CHECK --- -- period_hi_ff, -- clock active rise period_lo_ff, -- clock active fall --- MAX. CLOCK SKEW CHECK --- -- skew_rise_rising_active, -- clk1 rise to clk2 rise, clk2 active rise skew_rise_rising_inactive, -- clk1 rise to clk2 rise, clk2 active fall skew_rise_falling_active, -- clk1 rise to clk2 fall, clk2 active fall skew_rise_falling_inactive, -- clk1 rise to clk2 fall, clk2 active rise skew_fall_rising_active, -- clk1 fall to clk2 rise, clk2 active rise skew_fall_rising_inactive, -- clk1 fall to clk2 rise, clk2 active fall skew_fall_falling_active, -- clk1 fall to clk2 fall, clk2 active fall skew_fall_falling_inactive, -- clk1 fall to clk2 fall, clk2 active rise ---------------------------- -- TIMING CHECK FOR LATCH -- ---------------------------- --- HOLD CHECK --- -- hold_rising_latch, -- from enable rise to data change hold_falling_latch, -- from enable fall to data change --- SETUP CHECK --- -- setup_rising_latch, -- from data change to enable rise setup_falling_latch, -- from data change to enable fall --- RECOVERY CHECK --- -- recovery_clear_rise_rising_latch, -- from clear rise to enable rise recovery_clear_fall_rising_latch, -- from clear fall to enable rise recovery_clear_rise_falling_latch, -- from clear rise to enable fall recovery_clear_fall_falling_latch, -- from clear fall to enable fall recovery_preset_rise_rising_latch, -- from clear rise to enable rise recovery_preset_fall_rising_latch, -- from clear fall to enable rise recovery_preset_rise_falling_latch, -- from clear rise to enable fall recovery_preset_fall_falling_latch, -- from clear fall to enable fall --- PULSE WIDTH CHECK --- -- pwidth_pos_lo_latch, -- enable rise to enable fall, enable active low pwidth_pos_hi_latch, -- enable rise to enable fall, enable active hi pwidth_neg_hi_latch, -- enable fall to enable rise, enable active hi pwidth_neg_lo_latch, -- enable fall to enable rise, enable active low --- CLOCK PERIOD CHECK --- -- period_hi_latch, -- enable active hi period_lo_latch, -- enable active low --- ASYNC DEACTIVE CHECK --- -- deactive_lo_lo, -- async fall to async fall deactive_lo_hi, -- async fall to async rise deactive_hi_lo, -- async rise to async fall deactive_hi_hi, -- async rise to async rise --- REMOVAL CHECK --- -- removal_clear_rise_rising_ff, -- from clock rise to clear rise removal_clear_fall_rising_ff, -- from clock fall to clear rise removal_clear_rise_falling_ff, -- from clock rise to clear fall removal_clear_fall_falling_ff, -- from clock fall to clear fall removal_preset_rise_rising_ff, -- from clock rise to preset rise removal_preset_fall_rising_ff, -- from clock fall to preset rise removal_preset_rise_falling_ff, -- from clock rise to preset fall removal_preset_fall_falling_ff, -- from clock fall to preset fall removal_clear_rise_rising_latch, -- from enable rise to clear rise removal_clear_fall_rising_latch, -- from enable fall to clear rise removal_clear_rise_falling_latch, -- from enable rise to clear fall removal_clear_fall_falling_latch, -- from enable fall to clear fall removal_preset_rise_rising_latch, -- from enable rise to preset rise removal_preset_fall_rising_latch, -- from enable fall to preset rise removal_preset_rise_falling_latch, -- from enable rise to preset fall removal_preset_fall_falling_latch, -- from enable fall to preset fall --- PULSE WIDTH CHECK FOR ASYNC CLEAR/PRESET --- -- pwidth_async_pos, -- async rise to async fall pwidth_async_neg, -- async fall to async rise --- HOLD CHECK for JKFF --- -- hold_rising_jk, -- from clock rise to data change hold_falling_jk, -- from clock fall to data change --- SETUP CHECK for JKFF --- -- setup_rising_jk, -- from data change to clock rise setup_falling_jk, -- from data change to clock fall --- NOCHANGE CHECK --- -- nochange_start_edge_rise, -- from address change to control edge rise nochange_start_edge_fall, -- from address change to control edge fall nochange_end_edge_rise, -- from control edge rise to address change nochange_end_edge_fall -- from control edge fall to address change ); TYPE input_event IS (input_rise, input_fall, input_change); TYPE constraint_flags IS ( TimeIsMinTime, DataEndsEqOut, DataStartsEqOut, PresetActive, ClearActive, EnableActive ); TYPE constraint_flags_vector IS ARRAY (constraint_flags RANGE TimeIsMinTime TO EnableActive) OF BIT; TYPE constraint_data IS RECORD Start_Pin : input_event; End_Pin : input_event; Cfg_flags : constraint_flags_vector; Message : STRING(1 to 8); END RECORD; -- the following type is used in gs_libcore TYPE constraint_define IS ARRAY ( Constraint_Type ) OF constraint_data; TYPE Seq_Check IS RECORD Start_Pin : INTEGER; -- 0 to (total number of inputs-1) End_Pin : INTEGER; Check_Type : Constraint_Type; -- type of constraint Check_time : TIME; END RECORD; TYPE constraint_table IS ARRAY ( NATURAL RANGE <>) OF Seq_Check; TYPE constraint_class IS (conditional, symmetric_skew, no_change); TYPE constraint_time_requirement IS ( Violation_if_too_late, Violation_if_too_soon ); TYPE cond_constraint_spare IS -- will be filled in as required for -- new constraint information RECORD sample_field: integer; -- Replace by actual fields when -- the time comes. END RECORD; CONSTANT nil_spare : cond_constraint_spare := (sample_field => 0); TYPE cond_constraint_data IS RECORD Class : constraint_class; Start_Pin : INTEGER; -- pin number of starting input, -- 0 to (total number of inputs-1) End_Pin : INTEGER; -- pin number of ending input -- 0 to (total number of inputs-1) Start_Pin_Event : input_event; -- transition on starting input End_Pin_Event : input_event; -- transition on ending input Time_Requirement : constraint_time_requirement; Message : STRING(1 to 8); -- format of error message Spare : cond_constraint_spare ; -- Reserved for future expansion. -- Should be coded as "nil_spare" -- in constraints that don't use -- this record. Check_time : TIME; END RECORD; TYPE cond_constraint_table IS ARRAY ( NATURAL RANGE <>) OF cond_constraint_data; TYPE mesg_type IS (hazard, constraint, contention, float, fight, note); TYPE mesg_table is ARRAY (mesg_type RANGE hazard to note) OF CHARACTER; ---------------------------------------------------------------------------- -- Define sequential clock truth table type used in gs_libcore -- The "tbl_CK" truth table is given the last value of the clock and the -- current value of the clock and returns 1 if there is a rise, a 0 if -- there is no change or fall, and a X if the transition is unknown. ---------------------------------------------------------------------------- TYPE ck_table IS ARRAY (val_0X, val_0X) OF val_0X; ---------------------------------------------------------------------------- -- Define delay algorithms used in gs_libcore -- The DELAY_TIME enumerates the different possible delays given -- a signal's old value and new value. -- Note that minimum delay calculations must ignore zero delays. -- The controversial delays are when the signal does not change value. ---------------------------------------------------------------------------- TYPE delay_time IS (max_all, max_10_z0, max_01_z1, max_0z_1z, min_01_0z, max_01_0z, delay_01, delay_0z, min_10_1z, delay_10, max_10_1z, delay_1z, min_z0_z1, delay_z0, delay_z1, min_0z_1z_z0_z1, min_01_10, min_all, zero); -- the following type is used in gs_libcore TYPE generic_delay_table_type IS ARRAY (val_ZX, val_ZX) OF delay_time; ---------------------------------------------------------------------------- -- Define input mapping table type used in gs_libcore ---------------------------------------------------------------------------- TYPE map_input_tbl IS ARRAY (STD_ULOGIC, val_0X) OF val_0X; ---------------------------------------------------------------------------- -- Define output mapping table type used in gs_libcore ---------------------------------------------------------------------------- TYPE map_output_tbl IS ARRAY (val_ZX, STD_ULOGIC, STRENGTH) OF STD_ULOGIC; ---------------------------------------------------------------------------- -- State-dependent delays ---------------------------------------------------------------------------- TYPE sdt_values_t IS ARRAY (NATURAL RANGE <>) OF TIME; ------------------------------------------------------------------- -- Define UNIGEN TruthTable type ------------------------------------------------------------------- TYPE val_Z01XN_vector IS ARRAY ( NATURAL RANGE <>) OF Table_Logic; ------------------------------------------------------------------- -- Define UNIGEN edge_vector type ------------------------------------------------------------------- TYPE EdgeType IS ('R', -- rising edge 'F', -- falling edge 'L' -- level edge ); TYPE edge_vector IS ARRAY ( NATURAL RANGE <>) OF EdgeType; ------------------------------------------------------------------- -- define basic nil functions ------------------------------------------------------------------- FUNCTION nil_constraint RETURN constraint_table; FUNCTION nil_cond_constraint RETURN cond_constraint_table; FUNCTION nil_delay_table RETURN delay_table; FUNCTION nil_sdt_values RETURN sdt_values_t; FUNCTION nil_integer_vector RETURN integer_vector; FUNCTION nil_val_01X_vector RETURN val_01X_vector; -- synopsys synthesis_on END GS_Types; PACKAGE BODY GS_Types IS -- synopsys synthesis_off FUNCTION nil_constraint RETURN constraint_table IS VARIABLE empty : constraint_table( 1 TO 0); BEGIN RETURN empty; END; FUNCTION nil_cond_constraint RETURN cond_constraint_table IS VARIABLE empty : cond_constraint_table( 1 TO 0); BEGIN RETURN empty; END; FUNCTION nil_delay_table RETURN delay_table IS VARIABLE empty : delay_table( 1 TO 0); BEGIN RETURN empty; END; FUNCTION nil_sdt_values RETURN sdt_values_t IS VARIABLE empty : sdt_values_t( 1 TO 0); BEGIN RETURN empty; END; FUNCTION nil_integer_vector RETURN integer_vector IS VARIABLE empty : integer_vector( 1 TO 0); BEGIN RETURN empty; END; FUNCTION nil_val_01X_vector RETURN val_01X_vector IS VARIABLE empty : val_01X_vector( 0 TO -1); BEGIN RETURN empty; END; -- synopsys synthesis_on END GS_Types;