jingpu / Halide-HLS

HLS branch of Halide
Other
77 stars 22 forks source link

reinterpret<>() for hls_target.cpp #27

Open kevinkim06 opened 6 years ago

kevinkim06 commented 6 years ago

Hello,

I found reinterpret<> can be used in hls_target.cpp and it causes compile errors and VivadoHLS doesn't know how to do it. In the following example, constant '1' for 'Pos & 1' is reinterpreted unnecessarily.

  Param<uint8_t> Pos;

  MyPipeline():
          input(Int(32), 2),
          hw_output("hw_output"),
          output("output")
  {
    padded = BoundaryConditions::constant_exterior(input, 0);

    Expr xOffset = Pos & 1;
    Expr yOffset = (Pos >> 1)&1;

    hw_output(x, y) = padded(x + xOffset, y + yOffset);

    output(x, y) = hw_output(x, y);

    args = {input, Pos};
  }

I think it should be dealt in CodeGen_HLS_Target::CodeGen_HLS_C rather than in CodeGen_C.