Is the use of 'event attribute on non-clock signal bad practice?
up vote
1
down vote
favorite
There is a similar question here, which was answered with
Yes,
rising_edge()/falling_edge()should only be used for clock
signal. While it works in simulation it can cause problems and
unintended hardware in synthesis.
Is the same thing true for using the 'event attribute to detect edges of non-clock signals like in the following example?
process (rndm_sig)
begin
if (rndm_sig'event and rndm_sig = 1) then
-- do something.
end if;
end process;
vhdl fpga
add a comment |
up vote
1
down vote
favorite
There is a similar question here, which was answered with
Yes,
rising_edge()/falling_edge()should only be used for clock
signal. While it works in simulation it can cause problems and
unintended hardware in synthesis.
Is the same thing true for using the 'event attribute to detect edges of non-clock signals like in the following example?
process (rndm_sig)
begin
if (rndm_sig'event and rndm_sig = 1) then
-- do something.
end if;
end process;
vhdl fpga
Here, you define the same thing asif rising_edge(rndm_sig) then! In synthesis,rndm_sigwill be considered as a clock signal.
– grorel
Nov 9 at 9:25
Yes, but ifrndm_sigis say a signal from a input port then this signal would have to be connected to a clock buffer, which would, according to the other thread, lead to a error during synthesis, correct? My question basically is: Is the same true for using'event?
– Andy Ef
Nov 9 at 9:30
Whether you sayrising_edge(some_signal)orsome_signal=1 and some_signal'eventis utterly irrlevant. In both of thesesome_signalwill be connected to the clock input of a flip-flop and is, therefore, a clock.
– Matthew Taylor
Nov 9 at 9:35
Sounds like an X-Y problem, honestly, a detected edge in digital design is meaningless unless it's either a clock or the edge can be expressed in relation to the clock that will use the decision of the detected edge. In the first case, your question is invalid, in the second there's no reason to use 'event if you have a clock that fulfills Nyquist and the third option is that you're not doing pure digital design, which means you shouldn't be using an FPGA (which you tagged).
– DonFusili
Nov 9 at 12:10
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
There is a similar question here, which was answered with
Yes,
rising_edge()/falling_edge()should only be used for clock
signal. While it works in simulation it can cause problems and
unintended hardware in synthesis.
Is the same thing true for using the 'event attribute to detect edges of non-clock signals like in the following example?
process (rndm_sig)
begin
if (rndm_sig'event and rndm_sig = 1) then
-- do something.
end if;
end process;
vhdl fpga
There is a similar question here, which was answered with
Yes,
rising_edge()/falling_edge()should only be used for clock
signal. While it works in simulation it can cause problems and
unintended hardware in synthesis.
Is the same thing true for using the 'event attribute to detect edges of non-clock signals like in the following example?
process (rndm_sig)
begin
if (rndm_sig'event and rndm_sig = 1) then
-- do something.
end if;
end process;
vhdl fpga
vhdl fpga
asked Nov 9 at 9:01
Andy Ef
112
112
Here, you define the same thing asif rising_edge(rndm_sig) then! In synthesis,rndm_sigwill be considered as a clock signal.
– grorel
Nov 9 at 9:25
Yes, but ifrndm_sigis say a signal from a input port then this signal would have to be connected to a clock buffer, which would, according to the other thread, lead to a error during synthesis, correct? My question basically is: Is the same true for using'event?
– Andy Ef
Nov 9 at 9:30
Whether you sayrising_edge(some_signal)orsome_signal=1 and some_signal'eventis utterly irrlevant. In both of thesesome_signalwill be connected to the clock input of a flip-flop and is, therefore, a clock.
– Matthew Taylor
Nov 9 at 9:35
Sounds like an X-Y problem, honestly, a detected edge in digital design is meaningless unless it's either a clock or the edge can be expressed in relation to the clock that will use the decision of the detected edge. In the first case, your question is invalid, in the second there's no reason to use 'event if you have a clock that fulfills Nyquist and the third option is that you're not doing pure digital design, which means you shouldn't be using an FPGA (which you tagged).
– DonFusili
Nov 9 at 12:10
add a comment |
Here, you define the same thing asif rising_edge(rndm_sig) then! In synthesis,rndm_sigwill be considered as a clock signal.
– grorel
Nov 9 at 9:25
Yes, but ifrndm_sigis say a signal from a input port then this signal would have to be connected to a clock buffer, which would, according to the other thread, lead to a error during synthesis, correct? My question basically is: Is the same true for using'event?
– Andy Ef
Nov 9 at 9:30
Whether you sayrising_edge(some_signal)orsome_signal=1 and some_signal'eventis utterly irrlevant. In both of thesesome_signalwill be connected to the clock input of a flip-flop and is, therefore, a clock.
– Matthew Taylor
Nov 9 at 9:35
Sounds like an X-Y problem, honestly, a detected edge in digital design is meaningless unless it's either a clock or the edge can be expressed in relation to the clock that will use the decision of the detected edge. In the first case, your question is invalid, in the second there's no reason to use 'event if you have a clock that fulfills Nyquist and the third option is that you're not doing pure digital design, which means you shouldn't be using an FPGA (which you tagged).
– DonFusili
Nov 9 at 12:10
Here, you define the same thing as
if rising_edge(rndm_sig) then ! In synthesis, rndm_sig will be considered as a clock signal.– grorel
Nov 9 at 9:25
Here, you define the same thing as
if rising_edge(rndm_sig) then ! In synthesis, rndm_sig will be considered as a clock signal.– grorel
Nov 9 at 9:25
Yes, but if
rndm_sig is say a signal from a input port then this signal would have to be connected to a clock buffer, which would, according to the other thread, lead to a error during synthesis, correct? My question basically is: Is the same true for using 'event?– Andy Ef
Nov 9 at 9:30
Yes, but if
rndm_sig is say a signal from a input port then this signal would have to be connected to a clock buffer, which would, according to the other thread, lead to a error during synthesis, correct? My question basically is: Is the same true for using 'event?– Andy Ef
Nov 9 at 9:30
Whether you say
rising_edge(some_signal) or some_signal=1 and some_signal'event is utterly irrlevant. In both of these some_signal will be connected to the clock input of a flip-flop and is, therefore, a clock.– Matthew Taylor
Nov 9 at 9:35
Whether you say
rising_edge(some_signal) or some_signal=1 and some_signal'event is utterly irrlevant. In both of these some_signal will be connected to the clock input of a flip-flop and is, therefore, a clock.– Matthew Taylor
Nov 9 at 9:35
Sounds like an X-Y problem, honestly, a detected edge in digital design is meaningless unless it's either a clock or the edge can be expressed in relation to the clock that will use the decision of the detected edge. In the first case, your question is invalid, in the second there's no reason to use 'event if you have a clock that fulfills Nyquist and the third option is that you're not doing pure digital design, which means you shouldn't be using an FPGA (which you tagged).
– DonFusili
Nov 9 at 12:10
Sounds like an X-Y problem, honestly, a detected edge in digital design is meaningless unless it's either a clock or the edge can be expressed in relation to the clock that will use the decision of the detected edge. In the first case, your question is invalid, in the second there's no reason to use 'event if you have a clock that fulfills Nyquist and the third option is that you're not doing pure digital design, which means you shouldn't be using an FPGA (which you tagged).
– DonFusili
Nov 9 at 12:10
add a comment |
1 Answer
1
active
oldest
votes
up vote
5
down vote
accepted
Any signal used as X'event and X= 1 or rising_edge.(X) will be treated by the synthesis tool as a clock.
In an FPGA that means the routing tool will try to assign a dedicated clock net to the signal, with all that it entails. e.g. the signal has to be routed to a dedicated clock input which can cause significant delay and skew against the other signals.
Also the signal had better be 'clean'. It means that a FF will clock if there is the tiniest spike on the signal. It also means that if your signal is not 'clean', some FFs may trigger and some may not.
The timing tool will need to know the period and high/low time and try to make the set-up and hold time work against all other clocks. This can cause major problems and/or extra logic in the design. If the signal is totally asynchronous against the other clocks you can have meta stability and may need to add synchronizers after the clocked register(s).
So it comes down to: it is strongly recommended to use only 'real' clock signals for the X'event and X= 1 or rising_edge.(X) constructs.
At the same time there is one rule in digital design which says: all rules are out if there is no other solution.
In the ASIC industry, where I come from, you had to talk to some senior designers before you broke the basic rules. Then you had to add some big emphasized comment around the code stating "Yes this breaks the rule but there was no other way because we had this and this and this and it has been reviewed and signed of by X and Y " And yes, I once used a latch in a design.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
Any signal used as X'event and X= 1 or rising_edge.(X) will be treated by the synthesis tool as a clock.
In an FPGA that means the routing tool will try to assign a dedicated clock net to the signal, with all that it entails. e.g. the signal has to be routed to a dedicated clock input which can cause significant delay and skew against the other signals.
Also the signal had better be 'clean'. It means that a FF will clock if there is the tiniest spike on the signal. It also means that if your signal is not 'clean', some FFs may trigger and some may not.
The timing tool will need to know the period and high/low time and try to make the set-up and hold time work against all other clocks. This can cause major problems and/or extra logic in the design. If the signal is totally asynchronous against the other clocks you can have meta stability and may need to add synchronizers after the clocked register(s).
So it comes down to: it is strongly recommended to use only 'real' clock signals for the X'event and X= 1 or rising_edge.(X) constructs.
At the same time there is one rule in digital design which says: all rules are out if there is no other solution.
In the ASIC industry, where I come from, you had to talk to some senior designers before you broke the basic rules. Then you had to add some big emphasized comment around the code stating "Yes this breaks the rule but there was no other way because we had this and this and this and it has been reviewed and signed of by X and Y " And yes, I once used a latch in a design.
add a comment |
up vote
5
down vote
accepted
Any signal used as X'event and X= 1 or rising_edge.(X) will be treated by the synthesis tool as a clock.
In an FPGA that means the routing tool will try to assign a dedicated clock net to the signal, with all that it entails. e.g. the signal has to be routed to a dedicated clock input which can cause significant delay and skew against the other signals.
Also the signal had better be 'clean'. It means that a FF will clock if there is the tiniest spike on the signal. It also means that if your signal is not 'clean', some FFs may trigger and some may not.
The timing tool will need to know the period and high/low time and try to make the set-up and hold time work against all other clocks. This can cause major problems and/or extra logic in the design. If the signal is totally asynchronous against the other clocks you can have meta stability and may need to add synchronizers after the clocked register(s).
So it comes down to: it is strongly recommended to use only 'real' clock signals for the X'event and X= 1 or rising_edge.(X) constructs.
At the same time there is one rule in digital design which says: all rules are out if there is no other solution.
In the ASIC industry, where I come from, you had to talk to some senior designers before you broke the basic rules. Then you had to add some big emphasized comment around the code stating "Yes this breaks the rule but there was no other way because we had this and this and this and it has been reviewed and signed of by X and Y " And yes, I once used a latch in a design.
add a comment |
up vote
5
down vote
accepted
up vote
5
down vote
accepted
Any signal used as X'event and X= 1 or rising_edge.(X) will be treated by the synthesis tool as a clock.
In an FPGA that means the routing tool will try to assign a dedicated clock net to the signal, with all that it entails. e.g. the signal has to be routed to a dedicated clock input which can cause significant delay and skew against the other signals.
Also the signal had better be 'clean'. It means that a FF will clock if there is the tiniest spike on the signal. It also means that if your signal is not 'clean', some FFs may trigger and some may not.
The timing tool will need to know the period and high/low time and try to make the set-up and hold time work against all other clocks. This can cause major problems and/or extra logic in the design. If the signal is totally asynchronous against the other clocks you can have meta stability and may need to add synchronizers after the clocked register(s).
So it comes down to: it is strongly recommended to use only 'real' clock signals for the X'event and X= 1 or rising_edge.(X) constructs.
At the same time there is one rule in digital design which says: all rules are out if there is no other solution.
In the ASIC industry, where I come from, you had to talk to some senior designers before you broke the basic rules. Then you had to add some big emphasized comment around the code stating "Yes this breaks the rule but there was no other way because we had this and this and this and it has been reviewed and signed of by X and Y " And yes, I once used a latch in a design.
Any signal used as X'event and X= 1 or rising_edge.(X) will be treated by the synthesis tool as a clock.
In an FPGA that means the routing tool will try to assign a dedicated clock net to the signal, with all that it entails. e.g. the signal has to be routed to a dedicated clock input which can cause significant delay and skew against the other signals.
Also the signal had better be 'clean'. It means that a FF will clock if there is the tiniest spike on the signal. It also means that if your signal is not 'clean', some FFs may trigger and some may not.
The timing tool will need to know the period and high/low time and try to make the set-up and hold time work against all other clocks. This can cause major problems and/or extra logic in the design. If the signal is totally asynchronous against the other clocks you can have meta stability and may need to add synchronizers after the clocked register(s).
So it comes down to: it is strongly recommended to use only 'real' clock signals for the X'event and X= 1 or rising_edge.(X) constructs.
At the same time there is one rule in digital design which says: all rules are out if there is no other solution.
In the ASIC industry, where I come from, you had to talk to some senior designers before you broke the basic rules. Then you had to add some big emphasized comment around the code stating "Yes this breaks the rule but there was no other way because we had this and this and this and it has been reviewed and signed of by X and Y " And yes, I once used a latch in a design.
answered Nov 9 at 11:35
Oldfart
2,2792710
2,2792710
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53222603%2fis-the-use-of-event-attribute-on-non-clock-signal-bad-practice%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Here, you define the same thing as
if rising_edge(rndm_sig) then! In synthesis,rndm_sigwill be considered as a clock signal.– grorel
Nov 9 at 9:25
Yes, but if
rndm_sigis say a signal from a input port then this signal would have to be connected to a clock buffer, which would, according to the other thread, lead to a error during synthesis, correct? My question basically is: Is the same true for using'event?– Andy Ef
Nov 9 at 9:30
Whether you say
rising_edge(some_signal)orsome_signal=1 and some_signal'eventis utterly irrlevant. In both of thesesome_signalwill be connected to the clock input of a flip-flop and is, therefore, a clock.– Matthew Taylor
Nov 9 at 9:35
Sounds like an X-Y problem, honestly, a detected edge in digital design is meaningless unless it's either a clock or the edge can be expressed in relation to the clock that will use the decision of the detected edge. In the first case, your question is invalid, in the second there's no reason to use 'event if you have a clock that fulfills Nyquist and the third option is that you're not doing pure digital design, which means you shouldn't be using an FPGA (which you tagged).
– DonFusili
Nov 9 at 12:10