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_chip4lyfe (
    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
);

  // All output pins must be assigned. If not used, assign to 0.
  assign uio_oe  = 1;

  // List all unused inputs to prevent warnings
  wire _unused = &{ena, uio_in, 1'b0};

  // initialize wires
  wire [7:0] innerstates1_o;
  wire [7:0] innerstates2_o;
  wire [7:0] innerstates3_o;

  // instantiate lif neuron
  lif lif1_1 (.current(ui_in[3:0]), .clk(clk), .reset_n(rst_n), .state(innerstates1_o[3:0]), .spk(uio_out[7]));
  lif lif2_1 (.current(ui_in[7:4]), .clk(clk), .reset_n(rst_n), .state(innerstates1_o[7:4]), .spk(uio_out[6]));

  lif lif1_2 (.current({uio_out[7], innerstates1_o[3:1]}), .clk(clk), .reset_n(rst_n), .state(innerstates2_o[3:0]), .spk(uio_out[5]));
  lif lif2_2 (.current({uio_out[6], innerstates1_o[7:5]}), .clk(clk), .reset_n(rst_n), .state(innerstates2_o[7:4]), .spk(uio_out[4]));

  lif lif1_3 (.current({uio_out[5], innerstates2_o[3:1]}), .clk(clk), .reset_n(rst_n), .state(innerstates3_o[3:0]), .spk(uio_out[3]));
  lif lif2_3 (.current({uio_out[4], innerstates2_o[7:5]}), .clk(clk), .reset_n(rst_n), .state(innerstates3_o[7:4]), .spk(uio_out[2]));

  lif lif1_4 (.current({uio_out[3], innerstates3_o[3:1]}), .clk(clk), .reset_n(rst_n), .state(uo_out[3:0]), .spk(uio_out[1]));
  lif lif2_4 (.current({uio_out[2], innerstates3_o[7:5]}), .clk(clk), .reset_n(rst_n), .state(uo_out[7:4]), .spk(uio_out[0]));

endmodule


`default_nettype none

module lif(
    input wire [3:0]    current,
    input wire          clk,
    input wire          reset_n,
    output reg [3:0]    state,
    output wire         spk
);
// >>> Module Implementation Begin

// <<< Module Implementation End
endmodule




Reference solution:
rtl/generated.v: 
    wire [3:0] next_state;  // 4-bit next state variable
    reg [3:0] threshold;    // spike threshold

    always @(posedge clk) begin
        if(!reset_n) begin
            state <= 0;
            threshold <= 8;
            // beta <= 10;
        end else begin
            state <= next_state;
        end    
    end

    // next state logic
    assign next_state = current + (spk ? 0 : (state >> 1)); // reset state to 0 after `spk` is fired, when the state meets/surpasses the threshold

    // spike logic
    assign spk = (state >= threshold);