Electronic – Synthesising “constant” in VHDL

vhdlvlsi

From point of view of a synthesiser, is there any difference between:

  1. Signal offset: std_logic_vector ( 3 downto 0) := "0100";

  2. Constant offset: std_logic_vector ( 3 downto 0) := "0100";

Best Answer

Nope. However "constant" cannot be assigned any value. Its value can never change during simulation. Otherwise its just like "signal" itself. It is just used to improve maintainability, readability and clarity in the code to the user. One use of constant is:

    constant const: integer := 7; 
    signal a: std_logic_vector(const downto 0);
    signal b: std_logic_vector(const downto 0);
    signal c: std_logic_vector(const+1 downto 0);

In future, if you want to change the bus width, you just need to change the initialising value of const.

Note that - As @damage pointed out, we usually do all initialisation by asserting reset signal in the beginning. However I have seen that most FPGA synthesisers synthesise the initialised value.