Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When must a signal be inserted into the sensitivity list of a process

Tags:

I am confused about when a signal declared in an architecture must be inserted into the sensitivity list of a process.

Is there is a general law that can be followed in any situation?

I have real difficulties understanding when I have to include a signal in a process sensitivity list.

like image 393
Mazzy Avatar asked Jan 24 '12 17:01

Mazzy


People also ask

What happens when sensitivity list does not have signal needed?

If a signal is in the sensitivity list of a process, the process will "wake up" and be evaluated whenever the value of that signal changes. If it is not in the sensitivity list, a signal can change, but a process will not be re-evaluated to determine what the new outputs should be.

What is the sensitivity list of a process?

The sensitivity list is where you list all the signals that you want to cause the code in the process to be evaluated whenever it changes state. For example, clock or master reset is often used in a sensitivity list. Whenever the reset or clock changes state, the code inside the process is executed.

What is the use of sensitivity list in VHDL?

In hardware description languages (HDL), sensitivity lists are used to indicate which events may trigger a VHDL process or (System)Verilog always statement. These trigger events are usually transitions of signals that are inputs of the process or always statement.

How can a process be declared without a sensitivity list?

A process with a sensitivity list is a handy special case. First, only a process without wait statements can have a sensitivity list. Second, such a process is equivalent to a process without sensitivity list and with an additional wait statement as the last statement.


2 Answers

The "general law" is that

anything that your process needs to know about changes of needs to be in the sensitivity list.


For a typical synthesisable register with a synchronous reset:

process (clk) is begin     if rising_edge(clk) then         if reset = '1' then              -- do reset things         else              -- read some signals, assign some outputs         end if;     end if; end process; 

Only the clock needs to be in the list, as everything else is only looked at when the clock changes (due to the if rising_edge(clk) statement.


If you need an asynchronous reset:

process (clk, reset) is begin     if reset = '1' then         -- do reset things     elsif rising_edge(clk) then         -- read some signals, assign some outputs     end if; end process; 

then the reset signal must also be in the sensitivity list, as your design needs to check the value of it every time it changes, irrespective of what the clock is doing.


For combinatorial logic, I avoid using processes completely because of the problems keeping the sensitivity list up-to-date, and the potential for simulation then behaving differently to the synthesised code. This has been eased by the all keyword in VHDL-2008, but I still haven't found myself wanting to write long complicated combinatorial logic such that a process would help.

like image 116
Martin Thompson Avatar answered Nov 08 '22 05:11

Martin Thompson


If a signal is in the sensitivity list of a process, the process will "wake up" and be evaluated whenever the value of that signal changes. If it is not in the sensitivity list, a signal can change, but a process will not be re-evaluated to determine what the new outputs should be.

For Combinatorial Logic: Likely you want all your input signals to be included in the sensitivity list. If they are not included in the sensitivity list, then that will result in your output not changing even when that input signal changes. This is a common error (due to carelessness). Note that in VHDL 2008 you can use "all" keyword to automatically include all necessary signals in your process and avoid creating latches.

For Synchronous Logic: Likely you only want your clock (and maybe your reset) signal in the sensitivity list. This is because you are only concerned with the value of your signals (other than the clock) when your system clock has changed. This is because you are typically describing registers (composed of flip flops) which only allow changing their output value on a clock edge.

All of this can be confusing in the case of using HDL for synthesis because only a subset of the circuits you describe in VHDL can actually be implemented within a FPGA. For example, you can't have a primitive memory element that is sensitive to two independent clock edges, even though you could describe such a circuit by including two clocks in a sensitivity list.

like image 27
Josh Avatar answered Nov 08 '22 07:11

Josh