Altera_Forum
Honored Contributor
16 years agoHelp in VHDL
Hi, i'm working on a algorithm that will do Run-Length data compression. This is what i'm doing: i initialize a matrix and tranform it in a vector and, while doing that, i discover what will be the size of the compressed new vector. Then i try to declare another vector with that size.
Look a small abstract of the algorithm: PROCESS TYPE line IS ARRAY (0 TO 3) OF INTEGER; TYPE matrix IS ARRAY (0 TO 3) OF linha; variable mat : matrix; BEGIN mat := ( (100, 99, 95, 94), ( 98, 96, 93, 0), ( 97, 92, 0, 0), ( 91, 0, 0, 0)); -- THIS IS WHERE THE VECTOR (100, 99,98,97,96,95,94,93,92,91,0,0,0,0,0,0) IS CREATED AND VECTOR_SIZE IS FOUND OUT. PROCESS TYPE comp IS ARRAY (0 TO VECTOR_SIZE) OF INTEGER; variable COMPRESSED_VECTOR : comp; -- THIS IS WHERE THE VECTOR IS USED TO CREATE THE COMPRESSED VECTOR. THE PROBLEM IS qu(at)rtus WON'T LET ME CREATE AN ARRAY USING A VARIABLE (0 TO VECTOR_SIZE), IT NEED TO BE A CONSTANT. VECTOR_SIZE IS A SHARED VARIABLE AND I WAS THINKING ABOUT CONVERTING IT TO A CONSTANT, IF THAT'S POSSIBLE