module HLS_cdp_icvt (
   cfg_alu_in_rsc_z //|< i
  ,cfg_mul_in_rsc_z //|< i
  ,cfg_truncate_rsc_z //|< i
  ,chn_data_in_rsc_vz //|< i
  ,chn_data_in_rsc_z //|< i
  ,chn_data_out_rsc_vz //|< i
  ,nvdla_core_clk //|< i
  ,nvdla_core_rstn //|< i
  ,chn_data_in_rsc_lz //|> o
  ,chn_data_out_rsc_lz //|> o
  ,chn_data_out_rsc_z //|> o
  );
input [7:0] cfg_alu_in_rsc_z;
input [15:0] cfg_mul_in_rsc_z;
input [4:0] cfg_truncate_rsc_z;
input chn_data_in_rsc_vz;
input [7:0] chn_data_in_rsc_z;
input chn_data_out_rsc_vz;
input nvdla_core_clk;
input nvdla_core_rstn;
output chn_data_in_rsc_lz;
output chn_data_out_rsc_lz;
output [8:0] chn_data_out_rsc_z;
wire [8:0] cfg_alu_ext;
wire [7:0] cfg_alu_in;
wire [15:0] cfg_mul_in;
wire [4:0] cfg_truncate;
wire [8:0] chn_data_ext;
wire [7:0] chn_data_in;
wire [8:0] chn_data_out;
wire chn_in_prdy;
wire chn_in_pvld;
wire chn_out_prdy;
wire chn_out_pvld;
wire mon_sub_c;
wire [24:0] mul_data_out;
wire [24:0] mul_dout;
wire mul_out_prdy;
wire mul_out_pvld;
wire [8:0] sub_data_out;
wire [8:0] sub_dout;
wire sub_out_prdy;
wire sub_out_pvld;
wire [8:0] tru_dout;
// synoff nets
// monitor nets
// debug nets
// tie high nets
// tie low nets
// no connect nets
// not all bits used nets
// todo nets
assign chn_in_pvld = chn_data_in_rsc_vz;
assign chn_out_prdy = chn_data_out_rsc_vz;
assign chn_data_in[7:0] = chn_data_in_rsc_z[7:0];
assign cfg_alu_in[7:0] = cfg_alu_in_rsc_z[7:0];
assign cfg_mul_in[15:0] = cfg_mul_in_rsc_z[15:0];
assign cfg_truncate[4:0] = cfg_truncate_rsc_z[4:0];
assign chn_data_in_rsc_lz = chn_in_prdy;
assign chn_data_out_rsc_lz = chn_out_pvld;
assign chn_data_out_rsc_z[8:0] = chn_data_out[8:0];
//cvt
assign chn_data_ext[8:0] = {{1{chn_data_in[7]}}, chn_data_in[7:0]};
assign cfg_alu_ext[8:0] = {{1{cfg_alu_in[7]}}, cfg_alu_in[7:0]};
//sub
assign {mon_sub_c,sub_dout[8:0]} = $signed(chn_data_ext[8:0]) -$signed(cfg_alu_ext[8:0]);
HLS_cdp_ICVT_pipe_p1 pipe_p1 (
   .nvdla_core_clk (nvdla_core_clk) //|< i
  ,.nvdla_core_rstn (nvdla_core_rstn) //|< i
  ,.chn_in_pvld (chn_in_pvld) //|< w
  ,.sub_dout (sub_dout[8:0]) //|< w
  ,.sub_out_prdy (sub_out_prdy) //|< w
  ,.chn_in_prdy (chn_in_prdy) //|> w
  ,.sub_data_out (sub_data_out[8:0]) //|> w
  ,.sub_out_pvld (sub_out_pvld) //|> w
  );
//mul
assign mul_dout[24:0] = $signed(sub_data_out[8:0]) * $signed(cfg_mul_in[15:0]);
HLS_cdp_ICVT_pipe_p2 pipe_p2 (
   .nvdla_core_clk (nvdla_core_clk) //|< i
  ,.nvdla_core_rstn (nvdla_core_rstn) //|< i
  ,.mul_dout (mul_dout[24:0]) //|< w
  ,.mul_out_prdy (mul_out_prdy) //|< w
  ,.sub_out_pvld (sub_out_pvld) //|< w
  ,.mul_data_out (mul_data_out[24:0]) //|> w
  ,.mul_out_pvld (mul_out_pvld) //|> w
  ,.sub_out_prdy (sub_out_prdy) //|> w
  );
//truncate
NV_NVDLA_HLS_shiftrightsu #(.IN_WIDTH(16 + 9 ),.OUT_WIDTH(9 ),.SHIFT_WIDTH(5 )) shiftright_su (
   .data_in (mul_data_out[24:0]) //|< w
  ,.shift_num (cfg_truncate[4:0]) //|< w
  ,.data_out (tru_dout[8:0]) //|> w
  );
//signed
//unsigned
HLS_cdp_ICVT_pipe_p3 pipe_p3 (
   .nvdla_core_clk (nvdla_core_clk) //|< i
  ,.nvdla_core_rstn (nvdla_core_rstn) //|< i
  ,.chn_out_prdy (chn_out_prdy) //|< w
  ,.mul_out_pvld (mul_out_pvld) //|< w
  ,.tru_dout (tru_dout[8:0]) //|< w
  ,.chn_data_out (chn_data_out[8:0]) //|> w
  ,.chn_out_pvld (chn_out_pvld) //|> w
  ,.mul_out_prdy (mul_out_prdy) //|> w
  );
endmodule // HLS_cdp_icvt