hi,
i had some 40 nos of 32 bit constant in a verilog module used for some calculations. i am replicating this module for some 10 times.
so basically i am repeating the values in all the modules and wasting resources. so is it possible to declare it only once and use it in all the 10 modules.
10 instantiations are from the same module.
Constants known at synthesis time are inserted in each expression separately. The definition method doesn't affect the logic or memory utilization. It's only a question of effective code writing.
In the System Verilog world, packages are a suitable way to define global constants (as in VHDL since ever).
In plain Verilog, including constant definitions is probably the best way.
Yes. There are however some cases where array constants can be more effectively implemented as initialized block ram, e.g. when multiple constants are muxed to a single target.