data/full_repos/permissive/498471995/sume/felix/simple_sume_switch/test/ip_repo/std/cores/router_output_port_lookup_v1_0_0/hdl/ip_arp.v
1: b'%Warning-IMPLICIT: data/full_repos/permissive/498471995/sume/felix/simple_sume_switch/test/ip_repo/std/cores/router_output_port_lookup_v1_0_0/hdl/ip_arp.v:193: Signal definition not found, creating implicitly: \'lookup_ack\'\n   assign arp_done = lookup_ack;\n                     ^~~~~~~~~~\n                   ... Use "/* verilator lint_off IMPLICIT */" and lint_on around source to disable this message.\n%Error: data/full_repos/permissive/498471995/sume/felix/simple_sume_switch/test/ip_repo/std/cores/router_output_port_lookup_v1_0_0/hdl/ip_arp.v:113: Cannot find file containing module: \'cam\'\n   cam \n   ^~~\n        ... Looked in:\n             data/full_repos/permissive/498471995/sume/felix/simple_sume_switch/test/ip_repo/std/cores/router_output_port_lookup_v1_0_0/hdl,data/full_repos/permissive/498471995/cam\n             data/full_repos/permissive/498471995/sume/felix/simple_sume_switch/test/ip_repo/std/cores/router_output_port_lookup_v1_0_0/hdl,data/full_repos/permissive/498471995/cam.v\n             data/full_repos/permissive/498471995/sume/felix/simple_sume_switch/test/ip_repo/std/cores/router_output_port_lookup_v1_0_0/hdl,data/full_repos/permissive/498471995/cam.sv\n             cam\n             cam.v\n             cam.sv\n             obj_dir/cam\n             obj_dir/cam.v\n             obj_dir/cam.sv\n%Error: data/full_repos/permissive/498471995/sume/felix/simple_sume_switch/test/ip_repo/std/cores/router_output_port_lookup_v1_0_0/hdl/ip_arp.v:132: Cannot find file containing module: \'unencoded_cam_lut_sm\'\n   unencoded_cam_lut_sm\n   ^~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/498471995/sume/felix/simple_sume_switch/test/ip_repo/std/cores/router_output_port_lookup_v1_0_0/hdl/ip_arp.v:177: Cannot find file containing module: \'fallthrough_small_fifo\'\n   fallthrough_small_fifo #(.WIDTH(50+NUM_QUEUES), .MAX_DEPTH_BITS  (2))\n   ^~~~~~~~~~~~~~~~~~~~~~\n%Error: Exiting due to 3 error(s), 1 warning(s)\n'
module ip_arp
    #(parameter NUM_QUEUES	= 8,
      parameter LUT_DEPTH	= 32,
      parameter LUT_DEPTH_BITS	= log2(LUT_DEPTH)
      )
   (
    input	[31:0]			next_hop_ip,
    input	[NUM_QUEUES-1:0]	lpm_output_port,
    input				lpm_vld,
    input				lpm_hit,

    output				arp_done,

    output	[47:0]			next_hop_mac,
    output	[NUM_QUEUES-1:0]	output_port,
    output				arp_mac_vld,
    output				arp_lookup_hit,
    output				lpm_lookup_hit,
    input				rd_arp_result,



    input	[LUT_DEPTH_BITS-1:0]	arp_rd_addr,
    input				arp_rd_req,
    output	[47:0]			arp_rd_mac,
    output	[31:0]			arp_rd_ip,
    output				arp_rd_ack,


    input	[LUT_DEPTH_BITS-1:0]	arp_wr_addr,
    input				arp_wr_req,
    input	[47:0]			arp_wr_mac,
    input	[31:0]			arp_wr_ip,
    output				arp_wr_ack,


    input				reset,
    input				clk
   );


   function integer log2;
      input integer number;
      begin
         log2=0;
         while(2**log2<number) begin
            log2=log2+1;
         end
      end
   endfunction




   wire					cam_busy;
   wire					cam_match;
   wire	[LUT_DEPTH-1:0]			cam_match_addr;
   wire	[31:0]				cam_cmp_din, cam_cmp_data_mask;
   wire	[31:0]				cam_din, cam_data_mask;
   wire					cam_we;
   wire [LUT_DEPTH_BITS-1:0]		cam_wr_addr;

   wire [47:0]				next_hop_mac_result;

   wire					empty;

   reg [NUM_QUEUES-1:0]			output_port_latched;
   reg					lpm_hit_latched;









   cam 
	#(.C_TCAM_ADDR_WIDTH	(LUT_DEPTH_BITS),
	  .C_TCAM_DATA_WIDTH	(32),
	  .C_TCAM_ADDR_TYPE	(1),
	  .C_TCAM_MATCH_ADDR_WIDTH (LUT_DEPTH)
	)
   ip_arp_cam
     (

      .BUSY				(cam_busy),
      .MATCH				(cam_match),
      .MATCH_ADDR			(cam_match_addr),

      .CLK				(clk),
      .CMP_DIN				(cam_cmp_din),
      .DIN				(cam_din),
      .WE				(cam_we),
      .ADDR_WR				(cam_wr_addr));

   unencoded_cam_lut_sm
     #(.CMP_WIDTH(32),
       .DATA_WIDTH(48),
       .LUT_DEPTH(LUT_DEPTH)
       ) cam_lut_sm
       (
        .lookup_req         (lpm_vld),
        .lookup_cmp_data    (next_hop_ip),
        .lookup_cmp_dmask   (32'h0),
        .lookup_ack         (lookup_ack),
        .lookup_hit         (lookup_hit),
        .lookup_data        (next_hop_mac_result),



        .rd_addr            (arp_rd_addr),
        .rd_req             (arp_rd_req),
        .rd_data            (arp_rd_mac),
        .rd_cmp_data        (arp_rd_ip),
        .rd_cmp_dmask       (),
        .rd_ack             (arp_rd_ack),


        .wr_addr            (arp_wr_addr),
        .wr_req             (arp_wr_req),
        .wr_data            (arp_wr_mac),
        .wr_cmp_data        (arp_wr_ip),
        .wr_cmp_dmask       (32'h0),
        .wr_ack             (arp_wr_ack),


        .cam_busy           (cam_busy),
        .cam_match          (cam_match),
        .cam_match_addr     (cam_match_addr),
        .cam_cmp_din        (cam_cmp_din),
        .cam_din            (cam_din),
        .cam_we             (cam_we),
        .cam_wr_addr        (cam_wr_addr),
        .cam_cmp_data_mask  (cam_cmp_data_mask),
        .cam_data_mask      (cam_data_mask),


        .reset (reset),
        .clk   (clk));

   fallthrough_small_fifo #(.WIDTH(50+NUM_QUEUES), .MAX_DEPTH_BITS  (2))
      arp_fifo
        (.din           ({next_hop_mac_result, output_port_latched, lookup_hit, lpm_hit_latched}),
         .wr_en         (lookup_ack),
         .rd_en         (rd_arp_result),
         .dout          ({next_hop_mac, output_port, arp_lookup_hit, lpm_lookup_hit}),
         .full          (),
         .nearly_full   (),
         .prog_full     (),
         .empty         (empty),
         .reset         (reset),
         .clk           (clk)
         );


   assign arp_mac_vld = !empty;
   assign arp_done = lookup_ack;
   always @(posedge clk) begin
      if(reset) begin
         output_port_latched	<= 0;
         lpm_hit_latched	<= 0;
      end
      else if(lpm_vld) begin
         output_port_latched	<= lpm_output_port;
         lpm_hit_latched	<= lpm_hit;
      end
   end

endmodule
module ip_arp
    #(parameter NUM_QUEUES	= 8,
      parameter LUT_DEPTH	= 32,
      parameter LUT_DEPTH_BITS	= log2(LUT_DEPTH)
      )
   (
    input	[31:0]			next_hop_ip,
    input	[NUM_QUEUES-1:0]	lpm_output_port,
    input				lpm_vld,
    input				lpm_hit,

    output				arp_done,

    output	[47:0]			next_hop_mac,
    output	[NUM_QUEUES-1:0]	output_port,
    output				arp_mac_vld,
    output				arp_lookup_hit,
    output				lpm_lookup_hit,
    input				rd_arp_result,



    input	[LUT_DEPTH_BITS-1:0]	arp_rd_addr,
    input				arp_rd_req,
    output	[47:0]			arp_rd_mac,
    output	[31:0]			arp_rd_ip,
    output				arp_rd_ack,


    input	[LUT_DEPTH_BITS-1:0]	arp_wr_addr,
    input				arp_wr_req,
    input	[47:0]			arp_wr_mac,
    input	[31:0]			arp_wr_ip,
    output				arp_wr_ack,


    input				reset,
    input				clk
   );



   function integer log2;
      input integer number;
      begin
         log2=0;
         while(2**log2<number) begin
            log2=log2+1;
         end
      end
   endfunction




   wire					cam_busy;
   wire					cam_match;
   wire	[LUT_DEPTH-1:0]			cam_match_addr;
   wire	[31:0]				cam_cmp_din, cam_cmp_data_mask;
   wire	[31:0]				cam_din, cam_data_mask;
   wire					cam_we;
   wire [LUT_DEPTH_BITS-1:0]		cam_wr_addr;

   wire [47:0]				next_hop_mac_result;

   wire					empty;

   reg [NUM_QUEUES-1:0]			output_port_latched;
   reg					lpm_hit_latched;









   cam 
	#(.C_TCAM_ADDR_WIDTH	(LUT_DEPTH_BITS),
	  .C_TCAM_DATA_WIDTH	(32),
	  .C_TCAM_ADDR_TYPE	(1),
	  .C_TCAM_MATCH_ADDR_WIDTH (LUT_DEPTH)
	)
   ip_arp_cam
     (

      .BUSY				(cam_busy),
      .MATCH				(cam_match),
      .MATCH_ADDR			(cam_match_addr),

      .CLK				(clk),
      .CMP_DIN				(cam_cmp_din),
      .DIN				(cam_din),
      .WE				(cam_we),
      .ADDR_WR				(cam_wr_addr));

   unencoded_cam_lut_sm
     #(.CMP_WIDTH(32),
       .DATA_WIDTH(48),
       .LUT_DEPTH(LUT_DEPTH)
       ) cam_lut_sm
       (
        .lookup_req         (lpm_vld),
        .lookup_cmp_data    (next_hop_ip),
        .lookup_cmp_dmask   (32'h0),
        .lookup_ack         (lookup_ack),
        .lookup_hit         (lookup_hit),
        .lookup_data        (next_hop_mac_result),



        .rd_addr            (arp_rd_addr),
        .rd_req             (arp_rd_req),
        .rd_data            (arp_rd_mac),
        .rd_cmp_data        (arp_rd_ip),
        .rd_cmp_dmask       (),
        .rd_ack             (arp_rd_ack),


        .wr_addr            (arp_wr_addr),
        .wr_req             (arp_wr_req),
        .wr_data            (arp_wr_mac),
        .wr_cmp_data        (arp_wr_ip),
        .wr_cmp_dmask       (32'h0),
        .wr_ack             (arp_wr_ack),


        .cam_busy           (cam_busy),
        .cam_match          (cam_match),
        .cam_match_addr     (cam_match_addr),
        .cam_cmp_din        (cam_cmp_din),
        .cam_din            (cam_din),
        .cam_we             (cam_we),
        .cam_wr_addr        (cam_wr_addr),
        .cam_cmp_data_mask  (cam_cmp_data_mask),
        .cam_data_mask      (cam_data_mask),


        .reset (reset),
        .clk   (clk));

   fallthrough_small_fifo #(.WIDTH(50+NUM_QUEUES), .MAX_DEPTH_BITS  (2))
      arp_fifo
        (.din           ({next_hop_mac_result, output_port_latched, lookup_hit, lpm_hit_latched}),
         .wr_en         (lookup_ack),
         .rd_en         (rd_arp_result),
         .dout          ({next_hop_mac, output_port, arp_lookup_hit, lpm_lookup_hit}),
         .full          (),
         .nearly_full   (),
         .prog_full     (),
         .empty         (empty),
         .reset         (reset),
         .clk           (clk)
         );


   assign arp_mac_vld = !empty;
   assign arp_done = lookup_ack;
   always @(posedge clk) begin
      if(reset) begin
         output_port_latched	<= 0;
         lpm_hit_latched	<= 0;
      end
      else if(lpm_vld) begin
         output_port_latched	<= lpm_output_port;
         lpm_hit_latched	<= lpm_hit;
      end
   end

endmodule