Loop for case

How can I create one multiplexer with a FOR loop. Here is a snippet of what I mean:

CASE test IS FOR i IN ... LOOP WHEN i => ... ; END LOOP; END CASE; 

I know that it is possible to put FOR before CASE, but in this case it will generate many multiplexers?

+4
source share
2 answers

You cannot have such a loop to generate expressions for the case statement. You can probably do something close to what you want, without considering this, simply using the for loop:

 FOR i IN ... LOOP IF test = i then output <= myarray(i); END IF; END LOOP; 

... but if all you do is a simple multiplexer like the one above, you don’t need a loop or , you can just index directly with your select signal:

 output <= myarray(to_integer(test)); 
+4
source

Is that what you mean?

 CASE test IS WHEN i to j => ...; END CASE; 
+1
source

Source: https://habr.com/ru/post/1389410/


All Articles