top of page

[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 All

[Chisel] Don't use polymorphism

What I want to do There are multiple similar units Most of processes are the same, only some differences. Select an appropriate unit...

Comments


Let's do our best with our partner:​ ChatReminder

iphone6.5p2.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Let's do our best with our partner:​ ChatReminder

納品:iPhone6.5①.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Theme diary: Decide the theme and record for each genre

It is a diary application that allows you to post and record with themes and sub-themes for each genre.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png
bottom of page