module lfsr4 (clk, resetn, seed, lfsr_out);

    input logic clk, resetn;
    input logic [3:0] seed;
    output logic signed [3:0] lfsr_out;

	logic [3:0] lfsr_next;

        always @(posedge clk) begin
            if (resetn) begin
                lfsr_out <= seed;
            end
            else begin
                lfsr_out <= lfsr_next;
            end
        end

	assign lfsr_next = {lfsr_out[2:0], lfsr_out[1]^lfsr_out[3]^lfsr_out[0]};

endmodule