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

Subversion Repositories configurable_crc_core

[/] [configurable_crc_core/] [trunk/] [tb/] [crc_7.v] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 yanzixuan
module crc_7(
2
    input    clk, rst,
3
    input    crc_en,
4
    input    sda_i,
5
    output   reg [ 6: 0] crc_o
6
    );
7
 
8
    wire  inv = sda_i ^ crc_o[6];
9
    //CRC-7     = x7 + x3 + 1 
10
    always @(posedge clk or posedge rst)  begin
11
        if (rst) begin
12
            crc_o <= 0;
13
        end
14
        else begin
15
            if (crc_en == 1)  begin
16
                crc_o[6] <= crc_o[5];
17
                crc_o[5] <= crc_o[4];
18
                crc_o[4] <= crc_o[3];
19
                crc_o[3] <= crc_o[2] ^ inv;
20
                crc_o[2] <= crc_o[1];
21
                crc_o[1] <= crc_o[0];
22
                crc_o[0] <= inv;
23
            end
24
        end
25
     end
26
 
27
endmodule
28
 

powered by: WebSVN 2.1.0

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