VHDL Rising Edge
Quick Syntax
If you are asking about a clock's rising edge, it's this:
if rising_edge(clk) then
output <= input;
end if;
If you are asking about a discrete signal's rising edge, then the easiest way is to register the signal which causes a 1 clock delay, then AND the original signal with a not version of the delayed signal. Here's an example:
PROC_RISING_EDGE_DETECT : process (clk,reset)
begin
if rising_edge(clk) then
if (reset = '1') then
input_1q <= '0';
else
-- delay input by 1 clock
input_1q <= input;
-- detect rising edge
rising_edge_detect <= input and (not input_1q);
end if;
end if;
end process;
Purpose
Clocks:
In digital design, a lot of what we do has to do with signal edges.
Synchronous designs use a clock to drive logic. Therefore, a clock edge is a special event where things happen. There is two ways to use a rising edge of a clock:
1. (clk'event and clk='1')
2. rising_edge(clk)
There is some debate online of which one is "better". I've seen both in my professional career. The general consensus favors using rising_edge(clk) since it seems to handle the different transitions allowed on a std_logic signal, which is what your clock typically will be. That's what I use.
Signals:
You will often need to know when edges of discrete signals occur. Luckily, it's pretty easy to do this with logic in your design. Keep in mind that you cannot use either of the clock options above on discrete signals. The reasons why are beyond the scope of my answer here.
Best Practices
1. Use rising_edge(clk) for your clocks.
2. Use logic to detect rising edges of your other signals. The AND of the original signal and it's delayed not version can be either clocked or outside the process depending on your needs (if you don't want an extra clock delay on the detect). For higher frequency, consider making the detect clocked to help your routing and timing performance.