NAME_SIG: string := "<sig>"
);
port (
- ref: in std_logic; -- Reference signal for setup/hold times, e.g. clock
- sig: in std_logic
+ ref: in std_logic; -- Reference signal for setup/hold times, e.g. clock
+ sig: in std_logic;
+ gate: in std_logic := '1' -- Set to 1 when edges should be checked - for when setup time is greater than clock period
);
end assert_setuphold;
end if;
-- Check setup time constraint unless this is the beginning of the simulation
- if now > 0 ps then
+ if now > 0 ps and gate = '1' then
assert setup_time >= T_SETUP
report "Setup time to '" & NAME_REF & "' <= " & std_logic'image(LEVEL) & " violation for " & NAME_SIG &
" (actual: " & time'image(setup_time) & ", required: " & time'image(T_SETUP) & ")"
end if;
-- Detect changes in "sig" but only if "ref" has had an edge before
- if sig'event and last_edge > 0 ps then
+ if sig'event and last_edge > 0 ps and gate = '1' then
-- Checking against ref'last_event is tempting, but it might catch the wrong kind of transition
hold_time := now - last_edge;
NAME_SIG: string := "<sig>"
);
port (
- ref: in std_logic; -- Reference signal for setup/hold times, e.g. clock
- sig: in std_logic_vector
+ ref: in std_logic; -- Reference signal for setup/hold times, e.g. clock
+ sig: in std_logic_vector;
+ gate: in std_logic := '1' -- Set to 1 when edges should be checked - for when setup time is greater than clock period
);
end assert_setuphold_vec;
end if;
-- Check setup time constraint unless this is the beginning of the simulation
- if now > 0 ps then
+ if now > 0 ps and gate = '1' then
assert setup_time >= T_SETUP
report "Setup time to '" & NAME_REF & "' <= " & std_logic'image(LEVEL) & " violation for " & NAME_SIG &
" (actual: " & time'image(setup_time) & ", required: " & time'image(T_SETUP) & ")"
end if;
-- Detect changes in "sig" but only if "ref" has had an edge before
- if sig'event and last_edge > 0 ps then
+ if sig'event and last_edge > 0 ps and gate = '1' then
-- Checking against ref'last_event is tempting, but it might catch the wrong kind of transition
hold_time := now - last_edge;