lowRISC / style-guides

lowRISC Style Guides
Creative Commons Attribution 4.0 International
345 stars 122 forks source link

FSM must be implement with two process blocks #70

Closed danieldanino17 closed 7 months ago

danieldanino17 commented 7 months ago

in the style guide you wrote that FSM must be implement with two process blocks. why? why not only one? is there a reason or only for the standard? image

marnovandermaas commented 7 months ago

Hi Daniel,

Thank you for your question. The reason why we recommend implementing them in two blocks is that usually the combinational and clocked blocks are independent of each other. For small FSMs it might not be apparent why we would want to split them up, but in larger FSMs it becomes more apparent. As an example the I2C block in OpenTitan has many states. It has a combinational block where just based on the current state it drives the output, and it has a separate block to decide what state transitions to take.

This is and always will be a style guide, so it does not mean that writing an FSM with one block is wrong, it is just not the preferred default for lowRISC projects.

Hope that helps, Marno