cucapra/dahlia

Function calls stored in temporaries.

Opened this issue · 0 comments

See discussion and related issues below:
Yup, that makes sense. This is the problem mentioned in #264. Take a look at this group:

    group let0 {
      exp0.exponent = A_read0_0.out;
      exp0.go = !exp0.done ? 1'd1;

      div_pipe0.left = exp0.out; // ASSUMES exp0.out is done immediately
      div_pipe0.right = const1.out;
      div_pipe0.go = !div_pipe0.done ? 1'd1;

      bin_read0_0.in = div_pipe0.out;
      bin_read0_0.write_en = div_pipe0.done;

      let0[done] = bin_read0_0.done;
    }

The short term fix is to have the backend rewrite:

let x = exp(Res[0]) / 1;

into:

let _tmp = expr(Res[0]);
---
let x = _tmp / 1;

Open an issue in the Dahlia repo saying that function calls need to be stored in temporaries.

For you, the temporary fix is to manually rewrite the code to do this.

Originally posted by @rachitnigam in calyxir/calyx#284 (comment)