Forum Discussion
Altera_Forum
Honored Contributor
15 years agoquestion about unsigned constant
Hi everyone,
I meet a problem when I am trying to define a one bit unsigned constant. I think declaration should be constant var1: unsigned :='1'; But everytime I try this, it always be an error. Does anybody know how to fix it? Thanks.3 Replies
- Altera_Forum
Honored Contributor
You are right, of course.
- Altera_Forum
Honored Contributor
--- Quote Start --- The definition involves two faults. - it's missing a size constraint --- Quote End --- When declaring a constant, sizing is implicit in the constant value, so explicit sizing is not required. constant A : unsigned := "0"; is perfectly legal. - Altera_Forum
Honored Contributor
--- Quote Start --- think declaration should be constant var1: unsigned :='1'; --- Quote End --- The definition involves two faults. - it's missing a size constraint - it uses incorrect bit-vector constant syntaxconstant CONST1: unsigned(0 downto 0) :="1";