当前位置:首页 > FPGA > 正文内容

AD4134 24bit数据模式 CRC校验

chanra1n7个月前 (11-30)FPGA1373

校验代码如下:

// CRC polynomial: x^6 + x^5 + x^2 + x + 1 (binary: 1100111)
// Function to calculate CRC
function [0:0] calculate_crc;
input [31:0] data;  // 32-bit input data
localparam POLY = 7'b1100111;  // Polynomial
localparam SEED_VALUE = 6'b100101;  // Fixed seed value

// Intermediate variables
    reg [32:0] temp_data;  // 33-bit temporary data for CRC calculation
    reg [6:0] remainder;  // 7-bit remainder
    integer i;

// Step 1: XOR the high 6 bits with SEED_VALUE
temp_data[32:26] = data[31:26] ^ 6'b100101;  // XOR operation
temp_data[25:0] = data[25:0];  // Lower 26 bits remain unchanged

// Step 2: Initialize remainder
remainder = 7'b0;

// Step 3: Perform polynomial division
for (i = 32; i >= 0; i = i - 1) begin
// Shift the remainder and bring in the next bit
remainder = {remainder[5:0], temp_data[i]};  // Shift left, bring in next bit

// If the leading bit is 1, perform polynomial division
if (remainder[6]) begin
remainder = remainder ^ POLY;  // XOR with POLY
end
end

// Step 4: Check if remainder is zero
if (remainder == 7'b0000000) begin
calculate_crc = 0;  // Valid
end else begin
calculate_crc = 1;  // Invalid
end
endfunction


扫描二维码推送至手机访问。

版权声明:本文由我的FPGA发布,如需转载请注明出处。

本文链接:https://world.myfpga.cn/index.php/post/433.html

分享给朋友:

“AD4134 24bit数据模式 CRC校验 ” 的相关文章

ALGO C4MB V11引脚参照表(持续更新)

ALGO C4MB V11引脚参照表(持续更新)

功能:常用引脚CLKPIN_E1LED0PIN_G15LED1PIN_F16LED2PIN_F15LED3PIN_D16KEY1PIN_E15KEY2PIN_E16KEY3PIN_M15KEY4PIN_M16RXDPIN_M2TXDPIN_G1功能:VGA引脚VGA_BLUE[0]PIN_C15VG...

基础实验十三,DS18B20温度传感器

基础实验十三,DS18B20温度传感器

//==========================================================================// Author     : ChanRa1n// Description: Training for Intel FPGA/...

Xilinx FIFO和ILA学习

Xilinx FIFO和ILA学习

`timescale 1ns / 1ps//-------------------------------------------------------//Filename       ﹕ FIFO_TOP.v//Author      ...

点亮LED灯实验

点亮LED灯实验

设计流程:设计规划 -> 波形绘制 -> 代码编写 -> 代码编译 -> 逻辑仿真 -> 波形对比 -> 绑定管脚 -> 分析综合布局布线 -> 上板验证新建项目文件夹(led):Doc:放置文档资料(数据手册、波形图、文档、项目日志)Pri:放置工程...

3-8译码器

3-8译码器

译码:译码是编码的逆过程,在编码时,每一种二进制的代码,都赋予了特殊的含义,即都表示了一个确定的信号或者对象。把代码状态的特定含义翻译出来的过程叫做译码,实现译码操作的电路称为译码器。译码器:一类多输入多输出的组合逻辑电路器件,其可以分为:变量译码和显示译码两类3-8译码器 模块框图:输出信号定义为...