Hi,
I am trying to design in VHDL a CRC8. I am looking for a circuit
or pointer to some literature to implement it byte wise rather than
the traditional bit wise implementation.
Any help is appreciated.
Sam
+-----------------------------------------------------------------+
| Sam Bishai |
| IC Development |
| |
| email: bis...@nortel.ca NORTEL (Northern Telecom) |
| phone: (613) 763-6646 Dept. 5S31, CRK 040 |
| fax : (613) 763-3970 P.O. Box 3511 Staton C, |
| Ottawa, Ontario, CANADA K1Y 4H7 |
+-----------------------------------------------------------------+
We have a program to generate any CRC function you like,
implementing multiple CRC calculation (incremental if you
like) or in a single shot. Please find below the code
for both functions. ps: byte is just unsigned(7 downto 0)
of the Synopsys std_logic_arith package. The polynomial
used is 1+x+x^2+x^8.
-- Multiple CRC8 with message length 8 bits
function MultipleCRC8_D8 (D: byte;
CRC: byte) return byte;
-- Multiple CRC8 with message length 8 bits
function MultipleCRC8_D8 (D: byte;
CRC: byte) return byte is
variable NewCRC: byte;
begin
NewCRC(0) := CRC(0) xor CRC(7) xor D(7) xor CRC(6) xor D(6)
xor D(0);
NewCRC(1) := CRC(1) xor D(1) xor CRC(0) xor CRC(6) xor D(6)
xor D(0);
NewCRC(2) := CRC(2) xor D(2) xor CRC(1) xor D(1) xor CRC(0)
xor CRC(6) xor D(6) xor D(0);
NewCRC(3) := CRC(3) xor D(3) xor CRC(2) xor D(2) xor CRC(1)
xor CRC(7) xor D(7) xor D(1);
NewCRC(4) := CRC(4) xor D(4) xor CRC(3) xor D(3) xor CRC(2)
xor D(2);
NewCRC(5) := CRC(5) xor D(5) xor CRC(4) xor D(4) xor CRC(3)
xor D(3);
NewCRC(6) := CRC(6) xor D(6) xor CRC(5) xor D(5) xor CRC(4)
xor D(4);
NewCRC(7) := CRC(7) xor D(7) xor CRC(6) xor D(6) xor CRC(5)
xor D(5);
return NewCRC;
end MultipleCRC8_D8;
-- Single CRC8 with message length 8 bits
function SingleCRC8_D8 (D: byte)
return byte;
-- Single CRC8 with message length 8 bits
function SingleCRC8_D8 (D: byte)
return byte is
variable NewCRC: byte;
begin
NewCRC(0) := D(7) xor D(6) xor D(0);
NewCRC(1) := D(1) xor D(6) xor D(0);
NewCRC(2) := D(2) xor D(1) xor D(6) xor D(0);
NewCRC(3) := D(3) xor D(2) xor D(7) xor D(1);
NewCRC(4) := D(4) xor D(3) xor D(2);
NewCRC(5) := D(5) xor D(4) xor D(3);
NewCRC(6) := D(6) xor D(5) xor D(4);
NewCRC(7) := D(7) xor D(6) xor D(5);
return NewCRC;
end SingleCRC8_D8;
Kind regards,
Jan
PS: If the polynomial you use is different you can just send
me your polynomial and I'll run it through to give you the
correct functions.
--
===================================================================
Jan Zegers === Easics ===
General Manager === VHDL-based ASIC design services ===
mailto:ja...@easics.be ===================================
Tel: +32-16-298 401 Kapeldreef 60, B-3001 Leuven, BELGIUM
Fax: +32-16-298 319 http://www.easics.com