Search code examples
resourcesvhdlconstants

Does a constant use a register in an FPGA?


I would like to know how a constant is implemented on an FPGA.

If I declare :

constant my_constant : std_logic_vector(4 downto 0) := "11010"; 

in a VHDL code, does the place & route implement 5 DFFs ?

Thanks,

SLP


Solution

  • A constant will not use any flip flops. On it's own, it will do nothing and effectively be ignored by the synthesis engine.

    If you use it in an comparison for example where you are comparing an input from some source against the constant value, then that will use some LUTs to implement that logic function (the comparison).

    If you do that comparison in a synchronous (clocked) process then the output of that comparison will use some registers (flip-flops) to store the result.

    As suggested already, try synthesising some simple examples and see what the tool does.