M
M. Norton
Well, when Ashenden fails me, here's where I turn. Hopefully this is
a quickie.
I defined an address constant in the following manner (as an example).
constant MY_ADDR : std_logic_vector(7 downto 0) := "10010---";
The intent here is that only the 5 most significant bits are decoded
and the last 3 are don't care.
As a matter of fact, I have an array of these addresses. So, I had
something like the following while processing the addresses (this is
testbench code, never intended for synthesis):
for i in 0 to NUM_ADDR-1 loop
if (addr = MY_ADDR(i)) then
-- Do something incredibly interesting here
end if;
end loop;
What I discovered was that my incredibly interesting code was not
being used. So, thinks I, perhaps the equality operator is taking
this a little more seriously than I wanted? I turn to Ashenden, and
study the bits where std_ulogic is discussed, and then the operators,
and there seems to be no mention of how an equality test treats don't
cares in a vector.
So, language gurus, is this correct? Is equality going to look for
EXACTLY the same vector, including don't cares? If this is true, then
I'll need to do some sort of explicit decode. I'm fairly certain
things like 'and' and 'or' behave nicely with don't cares, so that may
be the way to go. I was hoping for something a little more intuitive,
but such is life sometimes.
Thanks!
Mark Norton
a quickie.
I defined an address constant in the following manner (as an example).
constant MY_ADDR : std_logic_vector(7 downto 0) := "10010---";
The intent here is that only the 5 most significant bits are decoded
and the last 3 are don't care.
As a matter of fact, I have an array of these addresses. So, I had
something like the following while processing the addresses (this is
testbench code, never intended for synthesis):
for i in 0 to NUM_ADDR-1 loop
if (addr = MY_ADDR(i)) then
-- Do something incredibly interesting here
end if;
end loop;
What I discovered was that my incredibly interesting code was not
being used. So, thinks I, perhaps the equality operator is taking
this a little more seriously than I wanted? I turn to Ashenden, and
study the bits where std_ulogic is discussed, and then the operators,
and there seems to be no mention of how an equality test treats don't
cares in a vector.
So, language gurus, is this correct? Is equality going to look for
EXACTLY the same vector, including don't cares? If this is true, then
I'll need to do some sort of explicit decode. I'm fairly certain
things like 'and' and 'or' behave nicely with don't cares, so that may
be the way to go. I was hoping for something a little more intuitive,
but such is life sometimes.
Thanks!
Mark Norton