I'm wanting to know more about how constants are used in VHDL.
First of all, I know you can only declare a constant within the architecture decloration like:
ARCHITECTURE Behavior OF unit IS
CONSTANT n : INTEGER := 10;
CONSTANT x : STD_ULOGIC_VECTOR(3 DOWNTO 0) := 12;
---so on----
I'm curious on what happens with a constant decloration when it actually gets burned on a chip. The fact that you must declare the type as an integer or a vector makes alarm bells in my head go off. Having to do this decloration makes me think that when I burn my device a segment of it is dedicated to holding the value of the constant, and then everything that refers to the constant just links to that place burned on my device. This is not what I want. I want constants in the sense of C Programming, where the compiler replaces all instances of a constant in my code with the value I have given that constant at compile time.
Meaning:
CONSTANT n : INTEGER := 10;
...snip...
MyOUTPUT <= n;
shouldn't take anymore hardware then just:
MyOUTPUT <= 10;
I'm also wanting to use constants in my entity decloration block, because I'm needing to define different input and output vector lengths based on some constants.
Clarity would give me some peace of mind.
Thanks for your input!
-Nic
First of all, I know you can only declare a constant within the architecture decloration like:
ARCHITECTURE Behavior OF unit IS
CONSTANT n : INTEGER := 10;
CONSTANT x : STD_ULOGIC_VECTOR(3 DOWNTO 0) := 12;
---so on----
I'm curious on what happens with a constant decloration when it actually gets burned on a chip. The fact that you must declare the type as an integer or a vector makes alarm bells in my head go off. Having to do this decloration makes me think that when I burn my device a segment of it is dedicated to holding the value of the constant, and then everything that refers to the constant just links to that place burned on my device. This is not what I want. I want constants in the sense of C Programming, where the compiler replaces all instances of a constant in my code with the value I have given that constant at compile time.
Meaning:
CONSTANT n : INTEGER := 10;
...snip...
MyOUTPUT <= n;
shouldn't take anymore hardware then just:
MyOUTPUT <= 10;
I'm also wanting to use constants in my entity decloration block, because I'm needing to define different input and output vector lengths based on some constants.
Clarity would give me some peace of mind.
Thanks for your input!
-Nic