crc32_dat48.v

来自「本電子檔為 verilog cookbook,包含了通訊,影像,DSP等重要常用」· Verilog 代码 · 共 630 行 · 第 1/3 页

V
630
字号

    assign x30 = d35 ^ c19 ^ d10 ^ c16 ^ c29 ^ d46 ^ c11 ^ d45 ^ d4 ^ 
        c10 ^ d43 ^ c12 ^ d22 ^ d8 ^ d29 ^ c6 ^ d32 ^ d30 ^ c30 ^ 
        d14 ^ d24 ^ d27 ^ d23 ^ d7 ^ c13 ^ c27 ^ d28 ^ c26 ^ c14 ^ 
        c7 ^ d26 ^ c8 ^ d42;  // 33 ins 1 outs

    assign x29 = d47 ^ d34 ^ c28 ^ c10 ^ d42 ^ d23 ^ d7 ^ d22 ^ c25 ^ 
        c6 ^ d27 ^ d25 ^ c15 ^ d9 ^ d21 ^ c5 ^ c31 ^ d31 ^ d26 ^ 
        d29 ^ d41 ^ c18 ^ c29 ^ c11 ^ c26 ^ c13 ^ d13 ^ d44 ^ c9 ^ 
        d6 ^ c12 ^ d3 ^ d45 ^ d28 ^ c7;  // 35 ins 1 outs

    assign x28 = d33 ^ d21 ^ c14 ^ c30 ^ d25 ^ c17 ^ d46 ^ c12 ^ d6 ^ 
        d22 ^ c5 ^ c28 ^ c6 ^ c10 ^ d40 ^ d2 ^ d20 ^ c4 ^ d5 ^ 
        c9 ^ d12 ^ d41 ^ c11 ^ c25 ^ d26 ^ c8 ^ d27 ^ d8 ^ d44 ^ 
        c27 ^ d43 ^ d30 ^ d28 ^ d24 ^ c24;  // 35 ins 1 outs

    assign x27 = d24 ^ d27 ^ c29 ^ c10 ^ d23 ^ d5 ^ d1 ^ c24 ^ c9 ^ 
        d20 ^ d39 ^ d19 ^ c3 ^ d45 ^ d25 ^ d26 ^ d29 ^ c4 ^ c8 ^ 
        d4 ^ d42 ^ c13 ^ c27 ^ c16 ^ c7 ^ d43 ^ d32 ^ d7 ^ d11 ^ 
        d21 ^ c11 ^ d40 ^ c23 ^ c5 ^ c26;  // 35 ins 1 outs

    assign x26 = d26 ^ d0 ^ d19 ^ d3 ^ c31 ^ d44 ^ d24 ^ d10 ^ c10 ^ 
        d22 ^ d23 ^ c28 ^ c8 ^ c7 ^ d18 ^ c12 ^ c3 ^ c2 ^ c9 ^ 
        d42 ^ c15 ^ d4 ^ c23 ^ d6 ^ d25 ^ d31 ^ d28 ^ d47 ^ d41 ^ 
        d39 ^ c4 ^ c26 ^ c6 ^ d38 ^ c25 ^ d20 ^ c22;  // 37 ins 1 outs

    assign x25 = d33 ^ c3 ^ c24 ^ c21 ^ c28 ^ d44 ^ d38 ^ d29 ^ c22 ^ 
        d17 ^ d2 ^ c2 ^ d18 ^ c1 ^ d28 ^ c6 ^ d22 ^ c17 ^ c25 ^ 
        d21 ^ d11 ^ d41 ^ d40 ^ c12 ^ d36 ^ d31 ^ d15 ^ c5 ^ d8 ^ 
        c20 ^ c13 ^ d37 ^ d3 ^ d19 ^ c15;  // 35 ins 1 outs

    assign x24 = d27 ^ d17 ^ c12 ^ c31 ^ d18 ^ c27 ^ c14 ^ d39 ^ d21 ^ 
        d40 ^ d16 ^ d30 ^ c23 ^ c16 ^ c2 ^ c11 ^ c0 ^ d37 ^ c5 ^ 
        d32 ^ d7 ^ d28 ^ c20 ^ c21 ^ d20 ^ c4 ^ c19 ^ d36 ^ c24 ^ 
        d43 ^ d35 ^ d14 ^ d1 ^ c1 ^ d47 ^ d10 ^ d2;  // 37 ins 1 outs

    assign x23 = c31 ^ d46 ^ d13 ^ d31 ^ d42 ^ d35 ^ d16 ^ d34 ^ d15 ^ 
        c15 ^ d9 ^ c23 ^ d0 ^ c3 ^ d17 ^ c0 ^ d6 ^ d29 ^ c26 ^ 
        d20 ^ d36 ^ c10 ^ d47 ^ d38 ^ d39 ^ c4 ^ c18 ^ c1 ^ d1 ^ 
        d19 ^ c20 ^ d26 ^ d27 ^ c22 ^ c19 ^ c13 ^ c30 ^ c11;  // 38 ins 1 outs

    assign x22 = c28 ^ d26 ^ c18 ^ d47 ^ c10 ^ d0 ^ d18 ^ c22 ^ c13 ^ 
        c0 ^ d38 ^ d41 ^ d9 ^ d23 ^ d11 ^ c15 ^ d16 ^ c27 ^ c7 ^ 
        c3 ^ d37 ^ d14 ^ d44 ^ c2 ^ c19 ^ c20 ^ d43 ^ d29 ^ d35 ^ 
        d36 ^ d45 ^ d31 ^ c11 ^ d27 ^ d24 ^ d34 ^ c29 ^ c21 ^ c31 ^ 
        d19 ^ c25 ^ c8 ^ d12;  // 43 ins 1 outs

    assign x21 = c1 ^ d27 ^ c10 ^ c2 ^ c13 ^ d26 ^ d40 ^ c21 ^ c8 ^ 
        d34 ^ d42 ^ d9 ^ d18 ^ c26 ^ d10 ^ c18 ^ c24 ^ c19 ^ d17 ^ 
        d37 ^ d31 ^ c6 ^ c15 ^ d35 ^ d29 ^ d5 ^ c11 ^ d22 ^ d24 ^ 
        d13;  // 30 ins 1 outs

    assign x20 = d16 ^ d26 ^ d34 ^ c23 ^ c18 ^ d33 ^ d28 ^ d9 ^ c1 ^ 
        c10 ^ d21 ^ c17 ^ c14 ^ d25 ^ d8 ^ c12 ^ d23 ^ c7 ^ c5 ^ 
        d17 ^ c0 ^ d12 ^ d39 ^ d4 ^ d41 ^ c9 ^ c25 ^ d36 ^ c20 ^ 
        d30;  // 30 ins 1 outs

    assign x19 = d8 ^ c8 ^ c22 ^ c17 ^ d22 ^ d7 ^ d3 ^ d38 ^ d16 ^ 
        c6 ^ d11 ^ c31 ^ d25 ^ d24 ^ c11 ^ c16 ^ d32 ^ c0 ^ d20 ^ 
        c19 ^ d29 ^ d33 ^ c24 ^ c9 ^ d40 ^ d27 ^ c4 ^ d15 ^ d47 ^ 
        c13 ^ d35;  // 31 ins 1 outs

    assign x18 = c10 ^ c15 ^ c18 ^ d37 ^ c3 ^ c16 ^ d46 ^ d7 ^ d6 ^ 
        d28 ^ c23 ^ d32 ^ d15 ^ c21 ^ d26 ^ d39 ^ c12 ^ d19 ^ c30 ^ 
        d34 ^ d14 ^ c8 ^ d2 ^ d24 ^ d21 ^ d31 ^ d23 ^ c7 ^ c5 ^ 
        d10;  // 30 ins 1 outs

    assign x17 = d30 ^ c6 ^ d6 ^ d47 ^ d14 ^ c20 ^ d23 ^ c11 ^ d25 ^ 
        c14 ^ c31 ^ c29 ^ d27 ^ d13 ^ d38 ^ d45 ^ d5 ^ c17 ^ d18 ^ 
        c15 ^ c9 ^ d20 ^ c2 ^ d22 ^ d1 ^ c7 ^ d31 ^ c4 ^ d33 ^ 
        c22 ^ d9 ^ d36;  // 32 ins 1 outs

    assign x16 = d26 ^ c19 ^ c6 ^ d22 ^ c5 ^ d30 ^ d24 ^ d13 ^ c13 ^ 
        c21 ^ d35 ^ d17 ^ c28 ^ c31 ^ d5 ^ d32 ^ d29 ^ d8 ^ d37 ^ 
        d44 ^ d4 ^ c30 ^ d19 ^ c16 ^ c8 ^ d12 ^ d46 ^ d0 ^ c10 ^ 
        c1 ^ d47 ^ c14 ^ c3 ^ d21;  // 34 ins 1 outs

endmodule

////////////////////////////////////////////////////////////////
// Depth optimal factored version
////////////////////////////////////////////////////////////////

module crc32_dat48_factor (crc_in,dat_in,crc_out);
input [31:0] crc_in;
input [47:0] dat_in;
output [31:0] crc_out;

wire [31:0] crc_out;

wire x251, x250, x249, x248, x247, x246, x245, 
       x244, x243, x242, x241, x240, x239, x238, x237, 
       x236, x235, x234, x233, x232, x231, x230, x229, 
       x228, x227, x226, x225, x224, x223, x222, x221, 
       x220, x219, x218, x217, x216, x215, x214, x213, 
       x212, x211, x210, x209, x208, x207, x206, x205, 
       x204, x203, x202, x201, x200, x199, x198, x197, 
       x196, x195, x194, x193, x192, x191, x190, x189, 
       x188, x187, x186, x185, x184, x183, x182, x181, 
       x180, x179, x178, x177, x176, x175, x174, x173, 
       x172, x171, x170, x169, x168, x167, x166, x165, 
       x164, x163, x162, x161, x160, x159, x158, x157, 
       x156, x155, x154, x153, x152, x151, x150, x149, 
       x148, x147, x146, x145, x144, x143, x142, x141, 
       x15, x14, x13, x12, x11, x10, x9, x8, 
       x7, x6, x5, x4, x3, x2, x1, x0, 
       x31, x30, x29, x28, x27, x26, x25, x24, 
       x23, x22, x21, x20, x19, x18, x17, x16;

assign crc_out = {x31,x30,x29,x28,x27,x26,x25,x24,x23,x22,x21,x20,x19,x18,x17,
        x16,x15,x14,x13,x12,x11,x10,x9,x8,x7,x6,x5,x4,x3,x2,x1,
        x0};

wire d0,d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,
    d15,d16,d17,d18,d19,d20,d21,d22,d23,d24,d25,d26,d27,d28,d29,d30,
    d31,d32,d33,d34,d35,d36,d37,d38,d39,d40,d41,d42,d43,d44,d45,d46,
    d47;

assign { d47,d46,d45,d44,d43,d42,d41,d40,d39,d38,d37,d36,d35,d34,d33,
        d32,d31,d30,d29,d28,d27,d26,d25,d24,d23,d22,d21,d20,d19,d18,d17,
        d16,d15,d14,d13,d12,d11,d10,d9,d8,d7,d6,d5,d4,d3,d2,d1,
        d0} = dat_in [47:0];

wire c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,
    c15,c16,c17,c18,c19,c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,c30,
    c31;

assign { c31,c30,c29,c28,c27,c26,c25,c24,c23,c22,c21,c20,c19,c18,c17,
        c16,c15,c14,c13,c12,c11,c10,c9,c8,c7,c6,c5,c4,c3,c2,c1,
        c0} = crc_in [31:0];

    xor6 x251i (.out(x251),.a(c20),.b(d22),.c(1'b0),.d(1'b0),.e(1'b0),.f(1'b0));  // 2 ins 1 outs

    xor6 x250i (.out(x250),.a(x158),.b(d41),.c(c27),.d(d43),.e(1'b0),.f(1'b0));  // 4 ins 1 outs

    xor6 x249i (.out(x249),.a(d22),.b(x219),.c(x199),.d(x195),.e(1'b0),.f(1'b0));  // 4 ins 1 outs

    xor6 x248i (.out(x248),.a(x149),.b(d39),.c(c5),.d(d21),.e(1'b0),.f(1'b0));  // 4 ins 1 outs

    xor6 x247i (.out(x247),.a(x150),.b(d22),.c(c6),.d(c5),.e(1'b0),.f(1'b0));  // 4 ins 1 outs

    xor6 x246i (.out(x246),.a(c31),.b(d9),.c(c11),.d(d47),.e(1'b0),.f(1'b0));  // 4 ins 1 outs

    xor6 x245i (.out(x245),.a(x151),.b(d11),.c(d45),.d(1'b0),.e(1'b0),.f(1'b0));  // 3 ins 1 outs

    xor6 x244i (.out(x244),.a(x186),.b(x141),.c(d5),.d(1'b0),.e(1'b0),.f(1'b0));  // 3 ins 1 outs

    xor6 x243i (.out(x243),.a(x156),.b(d6),.c(d29),.d(1'b0),.e(1'b0),.f(1'b0));  // 3 ins 1 outs

    xor6 x242i (.out(x242),.a(x157),.b(c13),.c(c14),.d(1'b0),.e(1'b0),.f(1'b0));  // 3 ins 1 outs

    xor6 x241i (.out(x241),.a(c3),.b(c20),.c(d19),.d(d36),.e(1'b0),.f(1'b0));  // 4 ins 1 outs

    xor6 x240i (.out(x240),.a(x148),.b(x213),.c(x174),.d(x155),.e(1'b0),.f(1'b0));  // 4 ins 1 outs

    xor6 x239i (.out(x239),.a(x151),.b(x167),.c(c22),.d(d2),.e(1'b0),.f(1'b0));  // 4 ins 1 outs

    xor6 x238i (.out(x238),.a(x149),.b(x175),.c(d11),.d(c18),.e(1'b0),.f(1'b0));  // 4 ins 1 outs

    xor6 x237i (.out(x237),.a(x144),.b(d4),.c(d14),.d(d44),.e(1'b0),.f(1'b0));  // 4 ins 1 outs

    xor6 x236i (.out(x236),.a(x150),.b(c2),.c(d45),.d(c29),.e(1'b0),.f(1'b0));  // 4 ins 1 outs

    xor6 x235i (.out(x235),.a(x141),.b(d10),.c(x157),.d(d32),.e(d8),.f(1'b0));  // 5 ins 1 outs

    xor6 x234i (.out(x234),.a(d9),.b(d10),.c(c3),.d(d7),.e(x166),.f(1'b0));  // 5 ins 1 outs

    xor6 x233i (.out(x233),.a(c29),.b(d45),.c(x206),.d(x158),.e(x151),.f(1'b0));  // 5 ins 1 outs

    xor6 x232i (.out(x232),.a(d13),.b(d12),.c(d6),.d(x163),.e(x175),.f(1'b0));  // 5 ins 1 outs

    xor6 x231i (.out(x231),.a(c5),.b(d14),.c(d15),.d(x163),.e(x148),.f(1'b0));  // 5 ins 1 outs

    xor6 x230i (.out(x230),.a(d9),.b(x156),.c(d12),.d(c14),.e(d23),.f(1'b0));  // 5 ins 1 outs

    xor6 x229i (.out(x229),.a(x193),.b(d40),.c(c24),.d(d24),.e(c21),.f(1'b0));  // 5 ins 1 outs

    xor6 x228i (.out(x228),.a(d33),.b(d47),.c(c30),.d(c31),.e(d0),.f(1'b0));  // 5 ins 1 outs

    xor6 x227i (.out(x227),.a(x201),.b(d29),.c(x154),.d(x150),.e(x147),.f(1'b0));  // 5 ins 1 outs

    xor6 x226i (.out(x226),.a(c20),.b(x151),.c(x152),.d(d5),.e(d8),.f(1'b0));  // 5 ins 1 outs

    xor6 x225i (.out(x225),.a(x158),.b(d6),.c(x167),.d(x147),.e(x149),.f(1'b0));  // 5 ins 1 outs

    xor6 x224i (.out(x224),.a(x199),.b(c19),.c(d7),.d(c6),.e(d35),.f(1'b0));  // 5 ins 1 outs

    xor6 x223i (.out(x223),.a(d31),.b(d3),.c(d10),.d(c17),.e(x174),.f(1'b0));  // 5 ins 1 outs

    xor6 x222i (.out(x222),.a(x150),.b(x199),.c(x193),.d(d4),.e(d8),.f(1'b0));  // 5 ins 1 outs

    xor6 x221i (.out(x221),.a(d16),.b(d6),.c(c7),.d(d30),.e(c9),.f(1'b0));  // 5 ins 1 outs

    xor6 x220i (.out(x220),.a(d16),.b(c1),.c(c21),.d(x154),.e(c0),.f(1'b0));  // 5 ins 1 outs

    xor6 x219i (.out(x219),.a(d36),.b(d14),.c(d25),.d(d1),.e(c6),.f(1'b0));  // 5 ins 1 outs

    xor6 x218i (.out(x218),.a(c30),.b(d46),.c(x159),.d(d40),.e(c14),.f(1'b0));  // 5 ins 1 outs

    xor6 x217i (.out(x217),.a(c14),.b(d3),.c(d30),.d(x144),.e(x166),.f(1'b0));  // 5 ins 1 outs

    xor6 x216i (.out(x216),.a(c16),.b(d32),.c(x159),.d(x163),.e(d8),.f(1'b0));  // 5 ins 1 outs

    xor6 x215i (.out(x215),.a(x159),.b(d17),.c(d35),.d(x182),.e(d1),.f(1'b0));  // 5 ins 1 outs

    xor6 x214i (.out(x214),.a(x142),.b(c28),.c(d44),.d(d40),.e(d7),.f(1'b0));  // 5 ins 1 outs

    xor6 x213i (.out(x213),.a(d13),.b(c3),.c(d19),.d(d0),.e(c13),.f(1'b0));  // 5 ins 1 outs

    xor6 x212i (.out(x212),.a(x163),.b(d45),.c(c0),.d(c25),.e(x148),.f(1'b0));  // 5 ins 1 outs

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?