📄 timing_b.vhdl
字号:
WHEN 'Z' => Result := Delay(tr0z); WHEN OTHERS => Result := MINIMUM(Delay(tr01), Delay(tr0z)); END CASE; WHEN '1' | 'H' => CASE Newval IS WHEN '0' | 'L' => Result := Delay(tr10); WHEN '1' | 'H' => Result := Delay(tr01); WHEN 'Z' => Result := Delay(tr1z); WHEN OTHERS => Result := MINIMUM(Delay(tr10), Delay(tr1z)); END CASE; WHEN 'Z' => CASE Newval IS WHEN '0' | 'L' => Result := Delay(trz0); WHEN '1' | 'H' => Result := Delay(trz1); WHEN 'Z' => Result := MAXIMUM (Delay(tr0z), Delay(tr1z)); WHEN OTHERS => Result := MINIMUM (Delay(trz1), Delay(trz0)); END CASE; WHEN 'U' | 'X' | 'W' | '-' => CASE Newval IS WHEN '0' | 'L' => Result := MAXIMUM(Delay(tr10), Delay(trz0)); WHEN '1' | 'H' => Result := MAXIMUM(Delay(tr01), Delay(trz1)); WHEN 'Z' => Result := MAXIMUM(Delay(tr1z), Delay(tr0z)); WHEN OTHERS => Result := MAXIMUM(Delay(tr10), Delay(tr01)); END CASE; END CASE; RETURN Result; END VitalCalcDelay; --------------------------------------------------------------------------- -- -- VitalSelectPathDelay returns the path delay selected by the Paths array. -- If no paths are selected, it returns either the appropriate default -- delay or TIME'HIGH, depending upon the value of IgnoreDefaultDelay. -- FUNCTION VitalSelectPathDelay ( CONSTANT NewValue : IN std_logic; CONSTANT OldValue : IN std_logic; CONSTANT OutSignalName : IN string; CONSTANT Paths : IN VitalPathArrayType; CONSTANT DefaultDelay : IN VitalDelayType; CONSTANT IgnoreDefaultDelay : IN BOOLEAN ) RETURN TIME IS VARIABLE TmpDelay : TIME; VARIABLE InputAge : TIME := TIME'HIGH; VARIABLE PropDelay : TIME := TIME'HIGH; BEGIN -- for each delay path FOR i IN Paths'RANGE LOOP -- ignore the delay path if it is not enabled NEXT WHEN NOT Paths(i).PathCondition; -- ignore the delay path if a more recent input event has been seen NEXT WHEN Paths(i).InputChangeTime > InputAge; -- This is the most recent input change (so far) -- Get the transition dependent delay TmpDelay := VitalCalcDelay(NewValue, OldValue, Paths(i).PathDelay); -- If other inputs changed at the same time, -- then use the minimum of their propagation delays, -- else use the propagation delay from this input. IF Paths(i).InputChangeTime < InputAge THEN PropDelay := TmpDelay; ELSE -- Simultaneous inputs change IF TmpDelay < PropDelay THEN PropDelay := TmpDelay; END IF; end if; InputAge := Paths(i).InputChangeTime; END LOOP; -- If there were no paths (with an enabled condition), -- use the default delay, if so indicated, otherwise return TIME'HIGH IF (PropDelay = TIME'HIGH) THEN IF (IgnoreDefaultDelay) THEN PropDelay := VitalCalcDelay(NewValue, OldValue, DefaultDelay); END IF; -- If the time since the most recent selected input event is -- greater than the propagation delay from that input, -- then use the default delay (won't happen if no paths are selected) ELSIF (InputAge > PropDelay) THEN PropDelay := VitalCalcDelay(NewValue, OldValue, DefaultDelay); -- Adjust the propagation delay by the time since the -- the input event occurred (Usually 0 ns). ELSE PropDelay := PropDelay - InputAge; END IF; RETURN PropDelay; END; FUNCTION VitalSelectPathDelay ( CONSTANT NewValue : IN std_logic; CONSTANT OldValue : IN std_logic; CONSTANT OutSignalName : IN string; CONSTANT Paths : IN VitalPathArray01Type; CONSTANT DefaultDelay : IN VitalDelayType01; CONSTANT IgnoreDefaultDelay : IN BOOLEAN ) RETURN TIME IS VARIABLE TmpDelay : TIME; VARIABLE InputAge : TIME := TIME'HIGH; VARIABLE PropDelay : TIME := TIME'HIGH; BEGIN -- for each delay path FOR i IN Paths'RANGE LOOP -- ignore the delay path if it is not enabled NEXT WHEN NOT Paths(i).PathCondition; -- ignore the delay path if a more recent input event has been seen NEXT WHEN Paths(i).InputChangeTime > InputAge; -- This is the most recent input change (so far) -- Get the transition dependent delay TmpDelay := VitalCalcDelay(NewValue, OldValue, Paths(i).PathDelay); -- If other inputs changed at the same time, -- then use the minimum of their propagation delays, -- else use the propagation delay from this input. IF Paths(i).InputChangeTime < InputAge THEN PropDelay := TmpDelay; ELSE -- Simultaneous inputs change IF TmpDelay < PropDelay THEN PropDelay := TmpDelay; END IF; end if; InputAge := Paths(i).InputChangeTime; END LOOP; -- If there were no paths (with an enabled condition), -- use the default delay, if so indicated, otherwise return TIME'HIGH IF (PropDelay = TIME'HIGH) THEN IF (IgnoreDefaultDelay) THEN PropDelay := VitalCalcDelay(NewValue, OldValue, DefaultDelay); END IF; -- If the time since the most recent selected input event is -- greater than the propagation delay from that input, -- then use the default delay (won't happen if no paths are selected) ELSIF (InputAge > PropDelay) THEN PropDelay := VitalCalcDelay(NewValue, OldValue, DefaultDelay); -- Adjust the propagation delay by the time since the -- the input event occurred (Usually 0 ns). ELSE PropDelay := PropDelay - InputAge; END IF; RETURN PropDelay; END; FUNCTION VitalSelectPathDelay ( CONSTANT NewValue : IN std_logic; CONSTANT OldValue : IN std_logic; CONSTANT OutSignalName : IN string; CONSTANT Paths : IN VitalPathArray01ZType; CONSTANT DefaultDelay : IN VitalDelayType01Z; CONSTANT IgnoreDefaultDelay : IN BOOLEAN ) RETURN TIME IS VARIABLE TmpDelay : TIME; VARIABLE InputAge : TIME := TIME'HIGH; VARIABLE PropDelay : TIME := TIME'HIGH; BEGIN -- for each delay path FOR i IN Paths'RANGE LOOP -- ignore the delay path if it is not enabled NEXT WHEN NOT Paths(i).PathCondition; -- ignore the delay path if a more recent input event has been seen NEXT WHEN Paths(i).InputChangeTime > InputAge; -- This is the most recent input change (so far) -- Get the transition dependent delay TmpDelay := VitalCalcDelay(NewValue, OldValue, Paths(i).PathDelay); -- If other inputs changed at the same time, -- then use the minimum of their propagation delays, -- else use the propagation delay from this input. IF Paths(i).InputChangeTime < InputAge THEN PropDelay := TmpDelay; ELSE -- Simultaneous inputs change IF TmpDelay < PropDelay THEN PropDelay := TmpDelay; END IF; end if; InputAge := Paths(i).InputChangeTime; END LOOP; -- If there were no paths (with an enabled condition), -- use the default delay, if so indicated, otherwise return TIME'HIGH IF (PropDelay = TIME'HIGH) THEN IF (IgnoreDefaultDelay) THEN PropDelay := VitalCalcDelay(NewValue, OldValue, DefaultDelay); END IF; -- If the time since the most recent selected input event is -- greater than the propagation delay from that input, -- then use the default delay (won't happen if no paths are selected) ELSIF (InputAge > PropDelay) THEN PropDelay := VitalCalcDelay(NewValue, OldValue, DefaultDelay); -- Adjust the propagation delay by the time since the -- the input event occurred (Usually 0 ns). ELSE PropDelay := PropDelay - InputAge; END IF; RETURN PropDelay; END; --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- Glitch Handlers --------------------------------------------------------------------------- --------------------------------------------------------------------------- PROCEDURE ReportGlitch ( CONSTANT GlitchRoutine : IN STRING; CONSTANT OutSignalName : IN STRING; CONSTANT PreemptedTime : IN TIME; CONSTANT PreemptedValue : IN std_ulogic; CONSTANT NewTime : IN TIME; CONSTANT NewValue : IN std_ulogic; CONSTANT Index : IN INTEGER := 0; CONSTANT IsArraySignal : IN BOOLEAN := FALSE; CONSTANT MsgSeverity : IN SEVERITY_LEVEL := WARNING ) IS VARIABLE StrPtr1, StrPtr2, StrPtr3, StrPtr4, StrPtr5 : LINE; BEGIN Write (StrPtr1, PreemptedTime ); Write (StrPtr2, NewTime); Write (StrPtr3, LogicCvtTable(PreemptedValue)); Write (StrPtr4, LogicCvtTable(NewValue)); IF IsArraySignal THEN Write (StrPtr5, STRING'( "(" ) ); Write (StrPtr5, Index); Write (StrPtr5, STRING'( ")" ) ); ELSE Write (StrPtr5, STRING'( " " ) ); END IF; -- Issue Report only if Preempted value has not been -- removed from event queue ASSERT PreemptedTime > NewTime REPORT GlitchRoutine & ": GLITCH Detected on port " & OutSignalName & StrPtr5.ALL & "; Preempted Future Value := " & StrPtr3.ALL & " @ " & StrPtr1.ALL & "; Newly Scheduled Value := " & StrPtr4.ALL & " @ " & StrPtr2.ALL & ";" SEVERITY MsgSeverity; ASSERT PreemptedTime <= NewTime REPORT GlitchRoutine & ": GLITCH Detected on port " & OutSignalName & StrPtr5.ALL & "; Negative Preempted Value := " & StrPtr3.ALL & " @ " & StrPtr1.ALL & "; Newly Scheduled Value := " & StrPtr4.ALL & " @ " & StrPtr2.ALL & ";" SEVERITY MsgSeverity; DEALLOCATE(StrPtr1); DEALLOCATE(StrPtr2); DEALLOCATE(StrPtr3); DEALLOCATE(StrPtr4); DEALLOCATE(StrPtr5); RETURN; END ReportGlitch; --------------------------------------------------------------------------- PROCEDURE VitalGlitch ( SIGNAL OutSignal : OUT std_logic; VARIABLE GlitchData : INOUT VitalGlitchDataType; CONSTANT OutSignalName : IN string; CONSTANT NewValue : IN std_logic; CONSTANT NewDelay : IN TIME := 0 ns; CONSTANT Mode : IN VitalGlitchKindType := OnEvent; CONSTANT XOn : IN BOOLEAN := TRUE; CONSTANT NegPreemptOn : IN BOOLEAN := FALSE; --IR225 CONSTANT MsgOn : IN BOOLEAN := FALSE; CONSTANT MsgSeverity : IN SEVERITY_LEVEL := WARNING ) IS --------------------------------------------------------------------------- VARIABLE NewGlitch : BOOLEAN := TRUE; VARIABLE dly : TIME := NewDelay; VARIABLE NOW_TIME : TIME := NOW; VARIABLE NegPreemptGlitch : BOOLEAN := FALSE; BEGIN NegPreemptGlitch:=FALSE;--reset Preempt-Glitch -- If nothing to schedule, just return IF NewDelay < 0 ns THEN IF (NewValue /= GlitchData.SchedValue) THEN VitalError ( "VitalGlitch", ErrNegDel, OutSignalName ); END IF; RETURN; END IF; -- If simple signal assignment -- perform the signal assignment IF ( Mode = VitalInertial) THEN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -