data/full_repos/permissive/447976230/fpga/usrp3/top/x400/ipass_present_controller.v
1: b'%Error: data/full_repos/permissive/447976230/fpga/usrp3/top/x400/ipass_present_controller.v:42: Cannot find include file: regmap/pl_cpld_regmap_utils.vh\n`include "regmap/pl_cpld_regmap_utils.vh" \n         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/447976230/fpga/usrp3/top/x400,data/full_repos/permissive/447976230/regmap/pl_cpld_regmap_utils.vh\n             data/full_repos/permissive/447976230/fpga/usrp3/top/x400,data/full_repos/permissive/447976230/regmap/pl_cpld_regmap_utils.vh.v\n             data/full_repos/permissive/447976230/fpga/usrp3/top/x400,data/full_repos/permissive/447976230/regmap/pl_cpld_regmap_utils.vh.sv\n             regmap/pl_cpld_regmap_utils.vh\n             regmap/pl_cpld_regmap_utils.vh.v\n             regmap/pl_cpld_regmap_utils.vh.sv\n             obj_dir/regmap/pl_cpld_regmap_utils.vh\n             obj_dir/regmap/pl_cpld_regmap_utils.vh.v\n             obj_dir/regmap/pl_cpld_regmap_utils.vh.sv\n%Error: data/full_repos/permissive/447976230/fpga/usrp3/top/x400/ipass_present_controller.v:43: Cannot find include file: cpld/regmap/mb_cpld_pl_regmap_utils.vh\n`include "cpld/regmap/mb_cpld_pl_regmap_utils.vh" \n         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/447976230/fpga/usrp3/top/x400/ipass_present_controller.v:44: Cannot find include file: cpld/regmap/pl_cpld_base_regmap_utils.vh\n`include "cpld/regmap/pl_cpld_base_regmap_utils.vh" \n         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/447976230/fpga/usrp3/top/x400/ipass_present_controller.v:45: Cannot find include file: ../../lib/rfnoc/core/ctrlport.vh\n`include "../../lib/rfnoc/core/ctrlport.vh" \n         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n%Error: Exiting due to 4 error(s)\n'
module ipass_present_controller (

  input wire ctrlport_clk,
  input wire ctrlport_rst,


  output  reg        m_ctrlport_req_wr,
  output wire        m_ctrlport_req_rd,
  output wire [19:0] m_ctrlport_req_addr,
  output wire [31:0] m_ctrlport_req_data,
  output wire [ 3:0] m_ctrlport_req_byte_en,


  input  wire        m_ctrlport_resp_ack,
  input  wire [ 1:0] m_ctrlport_resp_status,
  input  wire [31:0] m_ctrlport_resp_data,


  input  wire        enable,


  input  wire [ 1:0] ipass_present_n
);

`include "regmap/pl_cpld_regmap_utils.vh"
`include "cpld/regmap/mb_cpld_pl_regmap_utils.vh"
`include "cpld/regmap/pl_cpld_base_regmap_utils.vh"
`include "../../lib/rfnoc/core/ctrlport.vh"





wire [1:0] ipass_present;
wire [1:0] ipass_present_lcl;

assign ipass_present = ~ipass_present_n;

synchronizer #(
  .WIDTH            (2),
  .STAGES           (2),
  .INITIAL_VAL      (0),
  .FALSE_PATH_TO_IN (1)
) synchronizer_i (
  .clk (ctrlport_clk),
  .rst (ctrlport_rst),
  .in  (ipass_present),
  .out (ipass_present_lcl)
); 





reg transfer_in_progress  = 1'b0;
reg error_occurred        = 1'b0;
reg enable_delayed        = 1'b0;
reg [1:0] ipass_present_cached = 2'b0;


wire activated;
assign activated = enable & ~enable_delayed;

always @(posedge ctrlport_clk) begin
  if (ctrlport_rst) begin
    m_ctrlport_req_wr    <= 1'b0;
    transfer_in_progress <= 1'b0;
    enable_delayed       <= 1'b0;
    error_occurred       <= 1'b0;
    ipass_present_cached <= 2'b0;
  end else begin

    m_ctrlport_req_wr <= 1'b0;
    enable_delayed    <= enable;


    if (((ipass_present_lcl != ipass_present_cached) || error_occurred || activated)
      && ~transfer_in_progress && enable) begin
      transfer_in_progress <= 1'b1;
      m_ctrlport_req_wr    <= 1'b1;
      ipass_present_cached <= ipass_present_lcl;
    end


    if (m_ctrlport_resp_ack) begin
      transfer_in_progress <= 1'b0;
      error_occurred       <= m_ctrlport_resp_status != CTRL_STS_OKAY;
    end
  end
end





assign m_ctrlport_req_rd      = 1'b0;
assign m_ctrlport_req_byte_en = 4'b1111;
assign m_ctrlport_req_addr    = MB_CPLD + PL_REGISTERS + CABLE_PRESENT_REG;
assign m_ctrlport_req_data    = 32'b0 |
                                (ipass_present_cached[0] << IPASS0_CABLE_PRESENT) |
                                (ipass_present_cached[1] << IPASS1_CABLE_PRESENT);

endmodule
module ipass_present_controller (

  input wire ctrlport_clk,
  input wire ctrlport_rst,


  output  reg        m_ctrlport_req_wr,
  output wire        m_ctrlport_req_rd,
  output wire [19:0] m_ctrlport_req_addr,
  output wire [31:0] m_ctrlport_req_data,
  output wire [ 3:0] m_ctrlport_req_byte_en,


  input  wire        m_ctrlport_resp_ack,
  input  wire [ 1:0] m_ctrlport_resp_status,
  input  wire [31:0] m_ctrlport_resp_data,


  input  wire        enable,


  input  wire [ 1:0] ipass_present_n
);


`include "regmap/pl_cpld_regmap_utils.vh"
`include "cpld/regmap/mb_cpld_pl_regmap_utils.vh"
`include "cpld/regmap/pl_cpld_base_regmap_utils.vh"
`include "../../lib/rfnoc/core/ctrlport.vh"





wire [1:0] ipass_present;
wire [1:0] ipass_present_lcl;

assign ipass_present = ~ipass_present_n;

synchronizer #(
  .WIDTH            (2),
  .STAGES           (2),
  .INITIAL_VAL      (0),
  .FALSE_PATH_TO_IN (1)
) synchronizer_i (
  .clk (ctrlport_clk),
  .rst (ctrlport_rst),
  .in  (ipass_present),
  .out (ipass_present_lcl)
); 





reg transfer_in_progress  = 1'b0;
reg error_occurred        = 1'b0;
reg enable_delayed        = 1'b0;
reg [1:0] ipass_present_cached = 2'b0;


wire activated;
assign activated = enable & ~enable_delayed;

always @(posedge ctrlport_clk) begin
  if (ctrlport_rst) begin
    m_ctrlport_req_wr    <= 1'b0;
    transfer_in_progress <= 1'b0;
    enable_delayed       <= 1'b0;
    error_occurred       <= 1'b0;
    ipass_present_cached <= 2'b0;
  end else begin

    m_ctrlport_req_wr <= 1'b0;
    enable_delayed    <= enable;


    if (((ipass_present_lcl != ipass_present_cached) || error_occurred || activated)
      && ~transfer_in_progress && enable) begin
      transfer_in_progress <= 1'b1;
      m_ctrlport_req_wr    <= 1'b1;
      ipass_present_cached <= ipass_present_lcl;
    end


    if (m_ctrlport_resp_ack) begin
      transfer_in_progress <= 1'b0;
      error_occurred       <= m_ctrlport_resp_status != CTRL_STS_OKAY;
    end
  end
end





assign m_ctrlport_req_rd      = 1'b0;
assign m_ctrlport_req_byte_en = 4'b1111;
assign m_ctrlport_req_addr    = MB_CPLD + PL_REGISTERS + CABLE_PRESENT_REG;
assign m_ctrlport_req_data    = 32'b0 |
                                (ipass_present_cached[0] << IPASS0_CABLE_PRESENT) |
                                (ipass_present_cached[1] << IPASS1_CABLE_PRESENT);

endmodule