crc8_tool问题
http://www.easics.com/webtools/crctool我用上面生成一个crc8(x8+x5+x4+1)的vhdl程序包,但是输入一个8位的数据,输出的crc好像是错的,想问下坛友们是怎么回事?
输入(0xdc) 输出(f9),为什么不是(79)?????
下面是自动生成的程序包
--------------------------------------------------------------------------------
-- Copyright (C) 1999-2008 Easics NV.
-- This source file may be used and distributed without restriction
-- provided that this copyright statement is not removed from the file
-- and that any derivative work contains the original copyright notice
-- and the associated disclaimer.
--
-- THIS SOURCE FILE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS
-- OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
--
-- Purpose : synthesizable CRC function
-- * polynomial: (0 4 5 8)
-- * data width: 8
--
-- Info : tools@easics.be
-- http://www.easics.com
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
package PCK_CRC8_D8 is
-- polynomial: (0 4 5 8)
-- data width: 8
-- convention: the first serial bit is D
function nextCRC8_D8
(Data: std_logic_vector(7 downto 0);
crc:std_logic_vector(7 downto 0))
return std_logic_vector;
end PCK_CRC8_D8;
package body PCK_CRC8_D8 is
-- polynomial: (0 4 5 8)
-- data width: 8
-- convention: the first serial bit is D
function nextCRC8_D8
(Data: std_logic_vector(7 downto 0);
crc:std_logic_vector(7 downto 0))
return std_logic_vector is
variable d: std_logic_vector(7 downto 0);
variable c: std_logic_vector(7 downto 0);
variable newcrc: std_logic_vector(7 downto 0);
begin
d := Data;
c := crc;
newcrc(0) := d(6) xor d(4) xor d(3) xor d(0) xor c(0) xor c(3) xor c(4) xor c(6);
newcrc(1) := d(7) xor d(5) xor d(4) xor d(1) xor c(1) xor c(4) xor c(5) xor c(7);
newcrc(2) := d(6) xor d(5) xor d(2) xor c(2) xor c(5) xor c(6);
newcrc(3) := d(7) xor d(6) xor d(3) xor c(3) xor c(6) xor c(7);
newcrc(4) := d(7) xor d(6) xor d(3) xor d(0) xor c(0) xor c(3) xor c(6) xor c(7);
newcrc(5) := d(7) xor d(6) xor d(3) xor d(1) xor d(0) xor c(0) xor c(1) xor c(3) xor c(6) xor c(7);
newcrc(6) := d(7) xor d(4) xor d(2) xor d(1) xor c(1) xor c(2) xor c(4) xor c(7);
newcrc(7) := d(5) xor d(3) xor d(2) xor c(2) xor c(3) xor c(5);
return newcrc;
end nextCRC8_D8;
end PCK_CRC8_D8; 我也遇到过,怎么改都不行。最后我自己写了一个。你也自己写吧。算法看懂了,还是好写的。我的是verilog的 清霜一梦 发表于 2015-9-18 16:25
我也遇到过,怎么改都不行。最后我自己写了一个。你也自己写吧。算法看懂了,还是好写的。我的是verilog的
我也想写啊,没有找到lfsr的编码结构,好像网上大部分都是crc16或crc32的 2013crazy 发表于 2015-9-19 08:40
我也想写啊,没有找到lfsr的编码结构,好像网上大部分都是crc16或crc32的
貌似是,我的这种编码结构,后来被简化了。写起来很方便。幸运哦。哈哈哈 清霜一梦 发表于 2015-9-24 10:18
貌似是,我的这种编码结构,后来被简化了。写起来很方便。幸运哦。哈哈哈
能否给个编码结构参考下
页:
[1]