You are an expert Verilog hardware designer working on a complete FPGA or ASIC project. You are given the full source code of a Verilog project. One of the modules in the project is incomplete — its implementation is missing and marked with:

// >>> Module Implementation Begin

// <<< Module Implementation End

Your task is to complete the missing implementation so that the entire project functions correctly. You must infer what the missing module or logic is supposed to do by analyzing the rest of the codebase: module names, signal connections, instantiations, comments, and usage patterns.

Follow these rules:

1. Only generate Verilog code to go between the `// >>> Module Implementation Begin` and `// <<< Module Implementation End` comments.
2. Use Verilog-2001 syntax. Ensure the code is synthesizable.
3. Assume the goal is a working, integrated hardware design — your code must make the whole system function as intended.
4. Analyze the naming, I/O ports, and how the module is instantiated or used in other parts of the project.
5. Implement correct behavior based on design context. Do not guess randomly — reason it out.
6. Avoid vendor-specific features unless explicitly required.
7. Do not output comments, explanation, or anything outside the required code region unless explicitly asked.

Your output should contain **only the Verilog code** that fits inside the marked region.

/*
 * Copyright (c) 2024 Your Name
 * SPDX-License-Identifier: Apache-2.0
 */

`default_nettype none

module tt_um_delaychain (
			 input wire [7:0]  ui_in,   // Dedicated inputs
			 output wire [7:0] uo_out,  // Dedicated outputs
			 input wire [7:0]  uio_in,  // IOs: Input path
			 output wire [7:0] uio_out, // IOs: Output path
			 output wire [7:0] uio_oe,  // IOs: Enable path (active high: 0=input, 1=output)
			 input wire	   ena,	    // always 1 when the design is powered, so you can ignore it
			 input wire	   clk,	    // clock
			 input wire	   rst_n    // reset_n - low to reset
			 );
// >>> Module Implementation Begin

// <<< Module Implementation End
endmodule




module testchain #(parameter P = 2 // Number of inverter pairs (default: 2 pairs = 4 inverters)
		   ) (
		      input wire  clk,
		      input wire  rst_n,
		      input wire  din,
		      input wire  test,
		      output wire dout
		      );
  
   reg ff_input;
   reg ff_output;
 
   always @(posedge clk or negedge rst_n) begin
      if (rst_n == 1'b0)
	ff_input <= 1'b0;
      else
	ff_input <= din;
   end
 
   (* keep = "true" *) wire [2*P:0] inv_chain;
 
   assign inv_chain[0] = ff_input;
 
   genvar i;
   generate
      for (i = 0; i < 2*P; i = i + 1) begin : inv_pair
         (* keep = "true" *) cinv inv_gate (.q(inv_chain[i+1]), .a(inv_chain[i]));
      end
   endgenerate
 
   always @(posedge clk or negedge rst_n) begin
      if (rst_n == 1'b0)
	ff_output <= 1'b0;
      else
	ff_output <= test ? inv_chain[2*P] : ff_input;
   end

   assign dout = ff_output;
   
endmodule


(* keep_hierarchy = "yes" *)
module cinv(input a,
            output q);

`ifdef SIM
   assign #1 q =  ~a;
`else
   assign q = ~a;
`endif

endmodule


Reference solution:
rtl/generated.v:    
   wire _unused = &{ena, 1'b0};

   assign uio_out = 0;
   assign uio_oe  = 0;
   
   wire [7:0] c1q, c2q, c3q, c4q, c5q, c6q, c7q, c8q, c9q;
 
   genvar i;
   generate
      for (i = 0; i < 8; i = i + 1) begin : thechain
	 testchain #(.P(1))   chain1 (.clk(clk), .rst_n(rst_n), .din(ui_in[i]), .test(uio_in[0]), .dout(c1q[i]));
	 testchain #(.P(2))   chain2 (.clk(clk), .rst_n(rst_n), .din(  c1q[i]), .test(uio_in[0]), .dout(c2q[i]));
	 testchain #(.P(4))   chain3 (.clk(clk), .rst_n(rst_n), .din(  c2q[i]), .test(uio_in[0]), .dout(c3q[i]));
	 testchain #(.P(8))   chain4 (.clk(clk), .rst_n(rst_n), .din(  c3q[i]), .test(uio_in[0]), .dout(c4q[i]));
	 testchain #(.P(16))   chain5 (.clk(clk), .rst_n(rst_n), .din(  c4q[i]), .test(uio_in[0]), .dout(c5q[i]));
	 testchain #(.P(32))  chain6 (.clk(clk), .rst_n(rst_n), .din(  c5q[i]), .test(uio_in[0]), .dout(c6q[i]));
	 testchain #(.P(64))  chain7 (.clk(clk), .rst_n(rst_n), .din(  c6q[i]), .test(uio_in[0]), .dout(c7q[i]));
	 testchain #(.P(96))  chain8 (.clk(clk), .rst_n(rst_n), .din(  c7q[i]), .test(uio_in[0]), .dout(c8q[i]));
	 testchain #(.P(128))  chain9 (.clk(clk), .rst_n(rst_n), .din(  c8q[i]), .test(uio_in[0]), .dout(c9q[i]));
	 assign uo_out[i] = c9q[i];
      end
   endgenerate