pck_crc7_d1.vhd

来自「实现了SD的SPI模式,通过了所有的仿真及测试,支持数据的读和写.对SD卡的SP」· VHDL 代码 · 共 73 行

VHD
73
字号
------------------------------------------------------------------------- File:  PCK_CRC7_D1.vhd                              -- Date:  Thu May 22 06:55:50 2008                                                      --                                                                     -- Copyright (C) 1999-2003 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: VHDL package containing a synthesizable CRC function--   * polynomial: (0 3 7)--   * data width: 1--                                                                     -- Info: tools@easics.be--       http://www.easics.com                                  -----------------------------------------------------------------------library IEEE;use IEEE.std_logic_1164.all;package PCK_CRC7_D1 is  -- polynomial: (0 3 7)  -- data width: 1  function nextCRC7_D1    ( Data:  std_logic;      CRC:   std_logic_vector(6 downto 0) )    return std_logic_vector;end PCK_CRC7_D1;library IEEE;use IEEE.std_logic_1164.all;package body PCK_CRC7_D1 is  -- polynomial: (0 3 7)  -- data width: 1  function nextCRC7_D1     ( Data:  std_logic;      CRC:   std_logic_vector(6 downto 0) )    return std_logic_vector is    variable D: std_logic_vector(0 downto 0);    variable C: std_logic_vector(6 downto 0);    variable NewCRC: std_logic_vector(6 downto 0);  begin    D(0) := Data;    C := CRC;    NewCRC(0) := D(0) xor C(6);    NewCRC(1) := C(0);    NewCRC(2) := C(1);    NewCRC(3) := D(0) xor C(2) xor C(6);    NewCRC(4) := C(3);    NewCRC(5) := C(4);    NewCRC(6) := C(5);    return NewCRC;  end nextCRC7_D1;end PCK_CRC7_D1;

⌨️ 快捷键说明

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