OpenCores
URL https://opencores.org/ocsvn/openhmc/openhmc/trunk

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [rtl/] [hmc_controller/] [rx/] [rx_descrambler.v] - Diff between revs 11 and 15

Show entire file | Details | Blame | View Log

Rev 11 Rev 15
Line 80... Line 80...
)
)
(
(
    input wire              clk,
    input wire              clk,
    input wire              res_n,
    input wire              res_n,
    input wire              bit_slip,
    input wire              bit_slip,
 
    input wire              can_lock,
    output reg              locked,
    output reg              locked,
    input wire [DWIDTH-1:0] data_in,
    input wire [DWIDTH-1:0] data_in,
    output reg [DWIDTH-1:0] data_out
    output reg [DWIDTH-1:0] data_out
 
 
);
);
Line 100... Line 101...
    end else begin
    end else begin
        assign lfsr_slipped = { lfsr_steps[DWIDTH-1][13:0], (lfsr_steps[DWIDTH-1][14] ^ lfsr_steps[DWIDTH-1][0])};
        assign lfsr_slipped = { lfsr_steps[DWIDTH-1][13:0], (lfsr_steps[DWIDTH-1][14] ^ lfsr_steps[DWIDTH-1][0])};
    end
    end
endgenerate
endgenerate
 
 
 
`ifdef SIMULATION
 
    initial begin
 
       lfsr     <= 15'h0;
 
    end
 
`endif
 
 
// SEQUENTIAL PROCESS
// SEQUENTIAL PROCESS
`ifdef ASYNC_RES
`ifdef ASYNC_RES
always @(posedge clk or negedge res_n)  begin `else
always @(posedge clk or negedge res_n)  begin `else
always @(posedge clk)  begin `endif
always @(posedge clk)  begin `endif
 
    `ifdef RESET_ALL
    if (!res_n) begin
    if (!res_n) begin
        locked   <= 1'b0;
 
        lfsr     <= 15'h0;
 
        data_out <= {DWIDTH {1'b0}};
        data_out <= {DWIDTH {1'b0}};
    end else begin
            lfsr     <= 15'h0;
 
        end else
 
    `endif
 
    begin
        data_out <= data_out_tmp;
        data_out <= data_out_tmp;
 
        if (!locked) begin
        if (!locked && |data_in) begin
 
            lfsr <= calculated_seed;
            lfsr <= calculated_seed;
            // Locked when the calculated seeds match
 
            if (calculated_seed == lfsr_steps[DWIDTH-1]) begin
 
                locked <= 1'b1;
 
            end
 
        end else begin
        end else begin
            if (bit_slip) begin
            if (bit_slip) begin
                lfsr <= lfsr_slipped;
                lfsr <= lfsr_slipped;
            end else begin
            end else begin
                lfsr <= lfsr_steps[DWIDTH-1];
                lfsr <= lfsr_steps[DWIDTH-1];
            end
            end
        end
        end
    end
    end
 
 
 
    if(!res_n) begin
 
        locked   <= 1'b0;
 
    end else begin
 
        if (!locked) begin
 
            if (calculated_seed == lfsr_steps[DWIDTH-1]) begin
 
                locked <= 1'b1;
 
            end
 
        end
 
        if(!can_lock) begin
 
            locked <= 1'b0;
 
        end
 
    end
end                 // serial shift right with left input
end                 // serial shift right with left input
 
 
// SCRAMBLE
// SCRAMBLE
 
 
genvar j;
genvar j;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.