M
M. Norton
Hello again. I'm running into something I think ought to work, and as
far as I can tell from Ashenden, it ought to work, but it all is based
around values being locally static.
I have a record type to aggregate information about my memory map.
Something like:
type MEMORY_STRUCT is record
source_device_id : std_logic;
source_channel : unsigned(3 downto 0);
mem_bank : std_logic;
mem_base_addr : unsigned(15 downto 0);
end record;
Then using this I defined constants:
constant C_MYCHANNEL : MEMORY_STRUCT := ('1', X"2", '0', X"8000");
This is declared IN THE ARCHITECTURE BODY, which appears to be an
important point. The only discussion of doing this sort of thing I
found in Ashenden was handling deferred constants that were declared
but not defined in a package. As far as I can tell for this
architecture, the constant ought to be static and known at the time of
analysis.
Then later I'm getting errors are a case choice:
case current_channel is
when C_MYCHANNEL.source_channel =>
And the compiler declares C_MYCHANNEL.source_channel to not be locally
static. However it's constant, declared local to the architecture
body, fully defined in the architecture body... what am I missing
here? Is it the fact that I'm referencing a record subvalue? Still,
the value of that is constant as far as I can tell and additionally
declared and defined locally, so I'm not entirely certain what isn't
locally static.
Fortunately it's not a major issue, there are only 15 choices and I
can just go in and declare string constants, but I'd prefer to
abstract that out if possible. It just seems to make more sense that
way.
Anyhow, if anyone knows why the constant isn't static, I'm all ears.
Thanks!
Best regards,
Mark Norton
far as I can tell from Ashenden, it ought to work, but it all is based
around values being locally static.
I have a record type to aggregate information about my memory map.
Something like:
type MEMORY_STRUCT is record
source_device_id : std_logic;
source_channel : unsigned(3 downto 0);
mem_bank : std_logic;
mem_base_addr : unsigned(15 downto 0);
end record;
Then using this I defined constants:
constant C_MYCHANNEL : MEMORY_STRUCT := ('1', X"2", '0', X"8000");
This is declared IN THE ARCHITECTURE BODY, which appears to be an
important point. The only discussion of doing this sort of thing I
found in Ashenden was handling deferred constants that were declared
but not defined in a package. As far as I can tell for this
architecture, the constant ought to be static and known at the time of
analysis.
Then later I'm getting errors are a case choice:
case current_channel is
when C_MYCHANNEL.source_channel =>
And the compiler declares C_MYCHANNEL.source_channel to not be locally
static. However it's constant, declared local to the architecture
body, fully defined in the architecture body... what am I missing
here? Is it the fact that I'm referencing a record subvalue? Still,
the value of that is constant as far as I can tell and additionally
declared and defined locally, so I'm not entirely certain what isn't
locally static.
Fortunately it's not a major issue, there are only 15 choices and I
can just go in and declare string constants, but I'd prefer to
abstract that out if possible. It just seems to make more sense that
way.
Anyhow, if anyone knows why the constant isn't static, I'm all ears.
Thanks!
Best regards,
Mark Norton