[Chisel] Exiting a loop
What want to do
★
There are multiple modules of the same type
Select one of these that meets the specified condition.
To achieve this, I tried common routine in high-level languages like below.
Define the modules as an array
Looping through an array of modules with Seq.tabulate
Check whether each meets the condition
If meets, select it and end the loop
However, even though chisel syntax allows you to loop, you cannot exit the loop midway (so-called break).
Counter-measure
It is not possible to "exit the loop midway."
If you want to achieve ★, you have to keep running the loop to the end.
I thought it inefficient, but this is because I thought in the viewpoint of software, not hardware.
In the specific situation of ★ , this search is performed in parallel on multiple modules, in other words, all at the same time rather than one after the other.
Therefore, there is no concept of "exiting midway", but some conditions are not checked. This does not make the processing faster, and in the first place, the condition check is not done after waiting for the results of other modules.
Lastly
Because the syntax is similar to high-level languages, I tend to think of it in the same way, but I need to be aware that I am describing "how to operate the hardware."
Recent Posts
See AllPhenomenon There is an array Check whether the index variable is within the size of the array, and access the element only if it is...
Overview When communicating data using a Queue, the following operations are possible: Queue.io.enq.valid: When set to false, data will...
What I want to do There are multiple similar units Most of processes are the same, only some differences. Select an appropriate unit...
Comments