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 4

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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