asyncvlsi / dflowmap

Convert ACT dataflow to simulatable ACT CHP
GNU General Public License v2.0
1 stars 1 forks source link

Explicit Buffers #4

Closed fhuemer closed 1 year ago

fhuemer commented 1 year ago

The specification of the dataflow sublanguage at (https://avlsi.csl.yale.edu/act/doku.php?id=language:langs:dflow) states that if the number of buffer stages in brackets is not specified the default value is 1.

From that I would conclude that test1 and test2 should be semantically equivalent:

defproc test1(chan?(int<1>) a; chan!(int<1>) b)
{
    dataflow {
        a -> b
    }
}

defproc test2(chan?(int<1>) a; chan!(int<1>) b)
{
    dataflow {
        a -> [1] b
    }
}

However, when converted to CHP there is a difference. test1 looks fine with func_0W1W1 containing the buffer.

defproc func_0W1W1(chan?(int<1>)in0; chan!(int<1>) out0) {
  int<1> x0;
  int<1> res0; /* out */
  chp {
    *[
      in0?x0;
      log("receive (", x0, ")");
      res0 := x0;
      out0!res0;
      log("send (", res0, ",", ")")
    ]
  }
}

defproc test1 (chan(int<1>)? a; chan(int<1>)! b)
{
func_0W1W1 b_inst(a, b);
}

However, test2 gets two buffers. One in func_0W1W1 and another one in the actual test2 process.

defproc test2 (chan(int<1>)? a; chan(int<1>)! b)
{
chan(int<1>) b_bufIn;
func_0W1W1 b_bufIn_inst(a, b_bufIn);
lib::onebuf<1> b_inst(b_bufIn, b);
}

Did I misunderstand the documentation or is this actually a bug? If its bot a bug, I think, it would be a good idea to clarify the difference in the documentation.

rmanohar commented 1 year ago

Thank you for catching this! I've updated dflowmap; if this is still an issue, please let me know.

fhuemer commented 1 year ago

Thank you for the quick fix! It seems to work now.