Hi,
I'm very new to VHDL, so sorry in advance for my ignorant questions.
I would like to extract 8 bits from a couple of vectors. In the first
case, the vector is 128bits and is accessed as if it were 16 bytes. The
second vector is some large number of bits, and the byte to be extracted
is not byte-aligned.
Here's the code I've tried:
1 | byteData : buffer std_logic_vector(15 downto 0);
|
2 | constant bitData : std_logic_vector(518 downto 0);
|
3 | variable tempByte : std_logic_vector(7 downto 0);
|
4 |
|
5 | tempByte := byteData((byteIndex * 8 + 7) downto (byteIndex * 8)) xor bitData((bitIndex+7) downto bitIndex);
|
6 |
|
7 | -- bitIndex and byteIndex as std_logic_vectors too
|
Quartus doesn't like my use of the '*' operator.
What is the best way to do this kind of thing? Am I able to indirectly
access the bits at certain offsets in the vectors? Should I be using
shifts (e.g. sll) instead?
Thanks for any insight you can provide.
Cheers,
Dave