data/full_repos/permissive/194652065/.drl_src_code/filt_ppd/rtl/commutator.v
1: b"%Error: data/full_repos/permissive/194652065/.drl_src_code/filt_ppd/rtl/commutator.v:170: Cannot find file containing module: 'dff'\n            dff #(\n            ^~~\n        ... Looked in:\n             data/full_repos/permissive/194652065/.drl_src_code/filt_ppd/rtl,data/full_repos/permissive/194652065/dff\n             data/full_repos/permissive/194652065/.drl_src_code/filt_ppd/rtl,data/full_repos/permissive/194652065/dff.v\n             data/full_repos/permissive/194652065/.drl_src_code/filt_ppd/rtl,data/full_repos/permissive/194652065/dff.sv\n             dff\n             dff.v\n             dff.sv\n             obj_dir/dff\n             obj_dir/dff.v\n             obj_dir/dff.sv\n%Error: data/full_repos/permissive/194652065/.drl_src_code/filt_ppd/rtl/commutator.v:185: Cannot find file containing module: 'dff'\n                dff #(\n                ^~~\n%Error: Exiting due to 2 error(s)\n"
module commutator #(
  parameter gp_ccw               = 1,
  parameter gp_idata_width       = 8,
  parameter gp_decimation_factor = 4,
  parameter gp_reg_oup           = 1,
  parameter gp_phase             = 0
  )                              
(
  input  wire                                                  i_rst_an,
  input  wire                                                  i_ena,
  input  wire                                                  i_clk,
  input  wire signed [gp_idata_width-1:0]                      i_data,
  output wire signed [gp_decimation_factor*gp_idata_width-1:0] o_data,
  output wire                                                  o_clk
);


  localparam c_cnt_width = gp_decimation_factor;

  reg  [c_cnt_width-1:0]                         r_ring_cnt;
  reg                                            r_done;    

  wire [c_cnt_width-1:0]                         w_phase_to_idx;  
  wire [gp_decimation_factor*gp_idata_width-1:0] w_data; 
  wire                                           w_ena; 
  wire                                           w_done;
  wire signed [gp_idata_width-1:0]               d_data;
  genvar x;

  generate



    if (!gp_ccw)
      begin: g_commutator_cw

        always @(posedge i_clk or negedge i_rst_an)
          begin: p_ring_counter_cw
            if (!i_rst_an)
              begin
                r_ring_cnt <= 'd0;
		r_done     <= 1'b0;
              end
            else if (i_ena)
              begin
                if (r_ring_cnt == 'd0)
                  begin
                    r_ring_cnt[c_cnt_width-1] <= 1'b1;
                  end
                else
                  begin
                    r_ring_cnt[c_cnt_width-1]   <= r_ring_cnt[0];
                    r_ring_cnt[c_cnt_width-2:0] <= r_ring_cnt[c_cnt_width-1:1];  
                  end
		  
		r_done <= w_done;
              end
          end
	  
	if (gp_phase==0)
	  begin: SR_PHASE_EQ_0
	    assign d_data = i_data;
	  end
	else	  
	  begin: g_phase_alignment
            shift_register #(
	      .gp_data_width (gp_idata_width),
	      .gp_nr_stages  (gp_phase)
	    ) SR_PHASE_LT_0 (
	      .i_rst_an (i_rst_an),
	      .i_ena    (i_ena),  
	      .i_clk    (i_clk),  
	      .i_data   (i_data), 
	      .o_data   (d_data),
	      .o_shift_done (w_ena)  
	    );
	  end
	  	  	            

        for (x=gp_decimation_factor; x>0; x=x-1)
          begin: g_reg_comm_inp
            dff #(
              .gp_data_width (gp_idata_width)
              ) REG_COMMUTATOR_INP_DATA  (
              .i_rst_an (i_rst_an),
              .i_ena    (i_ena),
              .i_clk    (r_ring_cnt[x-1]),
              .i_data   (d_data),
              .o_data   (w_data[x*gp_idata_width-1 -: gp_idata_width])
            );
          end

	if (gp_reg_oup)
	  begin: g_reg_comm_oup
            for (x=gp_decimation_factor; x>0; x=x-1)
              begin: g_dff
                dff #(
                  .gp_data_width (gp_idata_width)
                  ) REG_COMMUTATOR_OUP_DATA  (
                  .i_rst_an (i_rst_an),
                  .i_ena    (i_ena),
                  .i_clk    (r_done),
                  .i_data   (w_data[x*gp_idata_width-1 -: gp_idata_width]),
                  .o_data   (o_data[x*gp_idata_width-1 -: gp_idata_width])
                );
              end	  
	  end

	else
	  begin
	    assign o_data = w_data;
	  end
	  
        assign w_done = (r_ring_cnt[0]) ? 1'b1 : 1'b0;
      end



    else
      begin: g_commutator_ccw
        always @(posedge i_clk or negedge i_rst_an)
          begin: p_ring_counter_ccw
            if (!i_rst_an)
              begin
                r_ring_cnt <= 'd0;
		r_done     <= 1'b0;
              end
            else if (i_ena)
              begin
                if (r_ring_cnt == 'd0)
                  begin
                    r_ring_cnt[0] <= 1'b1;
                  end
                else
                  begin
                    r_ring_cnt[0]               <= r_ring_cnt[c_cnt_width-1];
                    r_ring_cnt[c_cnt_width-1:1] <= r_ring_cnt[c_cnt_width-2:0];
                  end
		  
		r_done     <= w_done;
              end
          end

	if (gp_phase==0)
	  begin: SR_PHASE_EQ_0
	    assign d_data = i_data;
	  end
	else	  
	  begin: g_phase_alignment
            shift_register #(
	      .gp_data_width (gp_idata_width),
	      .gp_nr_stages  (gp_phase)
	    ) SR_PHASE_LT_0 (
	      .i_rst_an (i_rst_an),
	      .i_ena    (i_ena),  
	      .i_clk    (i_clk),  
	      .i_data   (i_data), 
	      .o_data   (d_data),
	      .o_shift_done (w_ena)  
	    );
	  end
	    
        for (x=0; x<gp_decimation_factor; x=x+1)
          begin: g_reg_comm_inp
            dff #(
              .gp_data_width (gp_idata_width)
              ) REG_COMMUTATOR_INP_DATA  (
              .i_rst_an (i_rst_an),
              .i_ena    (i_ena),
              .i_clk    (r_ring_cnt[x]),
              .i_data   (d_data),
              .o_data   (w_data[(x+1)*gp_idata_width-1:x*gp_idata_width])
            );
          end

	if (gp_reg_oup)
	  begin: g_reg_comm_oup
            for (x=0; x<gp_decimation_factor; x=x+1)
              begin: g_dff
                dff #(
                  .gp_data_width (gp_idata_width)
                  ) REG_COMMUTATOR_OUP_DATA  (
                  .i_rst_an (i_rst_an),
                  .i_ena    (i_ena),
                  .i_clk    (r_done),
                  .i_data   (w_data[(x+1)*gp_idata_width-1:x*gp_idata_width]),
                  .o_data   (o_data[(x+1)*gp_idata_width-1:x*gp_idata_width])
                );
              end	  
	  end
	else
	  begin
	    assign o_data = w_data;
	  end
	         
        assign w_done = (r_ring_cnt[c_cnt_width-1]) ? 1'b1 : 1'b0;
      end
  endgenerate

assign o_clk  = r_done;
    
endmodule
module commutator #(
  parameter gp_ccw               = 1,
  parameter gp_idata_width       = 8,
  parameter gp_decimation_factor = 4,
  parameter gp_reg_oup           = 1,
  parameter gp_phase             = 0
  )                              
(
  input  wire                                                  i_rst_an,
  input  wire                                                  i_ena,
  input  wire                                                  i_clk,
  input  wire signed [gp_idata_width-1:0]                      i_data,
  output wire signed [gp_decimation_factor*gp_idata_width-1:0] o_data,
  output wire                                                  o_clk
);



  localparam c_cnt_width = gp_decimation_factor;

  reg  [c_cnt_width-1:0]                         r_ring_cnt;
  reg                                            r_done;    

  wire [c_cnt_width-1:0]                         w_phase_to_idx;  
  wire [gp_decimation_factor*gp_idata_width-1:0] w_data; 
  wire                                           w_ena; 
  wire                                           w_done;
  wire signed [gp_idata_width-1:0]               d_data;
  genvar x;

  generate



    if (!gp_ccw)
      begin: g_commutator_cw

        always @(posedge i_clk or negedge i_rst_an)
          begin: p_ring_counter_cw
            if (!i_rst_an)
              begin
                r_ring_cnt <= 'd0;
		r_done     <= 1'b0;
              end
            else if (i_ena)
              begin
                if (r_ring_cnt == 'd0)
                  begin
                    r_ring_cnt[c_cnt_width-1] <= 1'b1;
                  end
                else
                  begin
                    r_ring_cnt[c_cnt_width-1]   <= r_ring_cnt[0];
                    r_ring_cnt[c_cnt_width-2:0] <= r_ring_cnt[c_cnt_width-1:1];  
                  end
		  
		r_done <= w_done;
              end
          end
	  
	if (gp_phase==0)
	  begin: SR_PHASE_EQ_0
	    assign d_data = i_data;
	  end
	else	  
	  begin: g_phase_alignment
            shift_register #(
	      .gp_data_width (gp_idata_width),
	      .gp_nr_stages  (gp_phase)
	    ) SR_PHASE_LT_0 (
	      .i_rst_an (i_rst_an),
	      .i_ena    (i_ena),  
	      .i_clk    (i_clk),  
	      .i_data   (i_data), 
	      .o_data   (d_data),
	      .o_shift_done (w_ena)  
	    );
	  end
	  	  	            

        for (x=gp_decimation_factor; x>0; x=x-1)
          begin: g_reg_comm_inp
            dff #(
              .gp_data_width (gp_idata_width)
              ) REG_COMMUTATOR_INP_DATA  (
              .i_rst_an (i_rst_an),
              .i_ena    (i_ena),
              .i_clk    (r_ring_cnt[x-1]),
              .i_data   (d_data),
              .o_data   (w_data[x*gp_idata_width-1 -: gp_idata_width])
            );
          end

	if (gp_reg_oup)
	  begin: g_reg_comm_oup
            for (x=gp_decimation_factor; x>0; x=x-1)
              begin: g_dff
                dff #(
                  .gp_data_width (gp_idata_width)
                  ) REG_COMMUTATOR_OUP_DATA  (
                  .i_rst_an (i_rst_an),
                  .i_ena    (i_ena),
                  .i_clk    (r_done),
                  .i_data   (w_data[x*gp_idata_width-1 -: gp_idata_width]),
                  .o_data   (o_data[x*gp_idata_width-1 -: gp_idata_width])
                );
              end	  
	  end

	else
	  begin
	    assign o_data = w_data;
	  end
	  
        assign w_done = (r_ring_cnt[0]) ? 1'b1 : 1'b0;
      end



    else
      begin: g_commutator_ccw
        always @(posedge i_clk or negedge i_rst_an)
          begin: p_ring_counter_ccw
            if (!i_rst_an)
              begin
                r_ring_cnt <= 'd0;
		r_done     <= 1'b0;
              end
            else if (i_ena)
              begin
                if (r_ring_cnt == 'd0)
                  begin
                    r_ring_cnt[0] <= 1'b1;
                  end
                else
                  begin
                    r_ring_cnt[0]               <= r_ring_cnt[c_cnt_width-1];
                    r_ring_cnt[c_cnt_width-1:1] <= r_ring_cnt[c_cnt_width-2:0];
                  end
		  
		r_done     <= w_done;
              end
          end

	if (gp_phase==0)
	  begin: SR_PHASE_EQ_0
	    assign d_data = i_data;
	  end
	else	  
	  begin: g_phase_alignment
            shift_register #(
	      .gp_data_width (gp_idata_width),
	      .gp_nr_stages  (gp_phase)
	    ) SR_PHASE_LT_0 (
	      .i_rst_an (i_rst_an),
	      .i_ena    (i_ena),  
	      .i_clk    (i_clk),  
	      .i_data   (i_data), 
	      .o_data   (d_data),
	      .o_shift_done (w_ena)  
	    );
	  end
	    
        for (x=0; x<gp_decimation_factor; x=x+1)
          begin: g_reg_comm_inp
            dff #(
              .gp_data_width (gp_idata_width)
              ) REG_COMMUTATOR_INP_DATA  (
              .i_rst_an (i_rst_an),
              .i_ena    (i_ena),
              .i_clk    (r_ring_cnt[x]),
              .i_data   (d_data),
              .o_data   (w_data[(x+1)*gp_idata_width-1:x*gp_idata_width])
            );
          end

	if (gp_reg_oup)
	  begin: g_reg_comm_oup
            for (x=0; x<gp_decimation_factor; x=x+1)
              begin: g_dff
                dff #(
                  .gp_data_width (gp_idata_width)
                  ) REG_COMMUTATOR_OUP_DATA  (
                  .i_rst_an (i_rst_an),
                  .i_ena    (i_ena),
                  .i_clk    (r_done),
                  .i_data   (w_data[(x+1)*gp_idata_width-1:x*gp_idata_width]),
                  .o_data   (o_data[(x+1)*gp_idata_width-1:x*gp_idata_width])
                );
              end	  
	  end
	else
	  begin
	    assign o_data = w_data;
	  end
	         
        assign w_done = (r_ring_cnt[c_cnt_width-1]) ? 1'b1 : 1'b0;
      end
  endgenerate

assign o_clk  = r_done;
    
endmodule