Skip to content

ETISS Writer: Loops support is entirely broken #89

@PhilippvK

Description

@PhilippvK

There are several issues with the generation of loops in the ETISS Backend:

  • Generated while and do ... while statements do not have curly braces. If coverage is enabled the only line in the loop body will be like cp.code() += "etiss_coverage_count(1, 5154);\n"; leading to unexpected behaior
    Solution: easy fix possible by adding missing {, }
  • break statements are always considered static, even if their execution actually depends on a non-static if statement
    Solution: Fix would be to either declare a breaks/continues as non-static or keep track if the staticness of all Contionals...
  • Loops are classified as static even if they may conditionally exit early via a break or continue statements
    Solution: Needs to analyze loop body in addition to loop condition
  • parser splits up For loops in multiple statements (count_var delarator (+ count_var initializer) + actual Loop statement) which means that a non-static Loops will still have a statically-generated count_var (e.g. i) which of course breaks the simulation
    Solution: More difficult to handle as the behav.Loop does not know about his predecessor when is is being visited. We would either need to move the initialization statements into the behav.Loop class (self.init_exprs) or have to detect this one-layer earlier

The easiert workaround is of course to disable static loops entirely, but this is not a long-term solution...

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingetiss writerIssues concerning the ETISS writer backend module

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions