Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me find errors in CRC for USB code in VHDL

Status
Not open for further replies.

rjin

Newbie level 2
Joined
Jul 4, 2004
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
21
+crc in usb

Hi, i'm new to VHDL and currently working on designing a USB SIE controller but i'm stuck on the CRC part. I've tried generating it using the bit serial approach but didnt quite get the results ( i used examples from the "CRC in USB" whitepaper).Could anyone pls point out my errors, thanks.

Code:
library ieee;
use ieee.std_logic_1164.all;

entity crc5 is 
port( clk: in std_logic;
      rst: in std_logic;
      stuffed_data: in std_logic;
      out_crc5: out std_logic_vector(4 downto 0));
end crc5;

architecture crc5 of crc5 is
      signal crc5_state : std_logic_vector(4 downto 0);
begin
  process 
     variable shift_register : std_logic_vector(4 downto 0);
	
begin

WAIT UNTIL clk'EVENT AND clk = '1';

crc5_state <= shift_register;
out_crc5 <= NOT crc5_state;

     if rst = '1' then
		
	shift_register := "11111";
	out_crc5 <= "11111"; 
		
     ELSE
	
           crc5_state(4) <= crc5_state(3);
           crc5_state(3) <= crc5_state(2);
           crc5_state(2) <= crc5_state(1)xor stuffed_data xor crc5_state(4); 
           crc5_state(1) <= crc5_state(0);
           crc5_state(0) <= stuffed_data xor crc5_state(4);
           shift_register := crc5_state;
						
           end if;
		
        end process;

end crc5;

Btw there's another parallel approach which is usually used for hardware acceleration, could anyone pls enlighten me on how it functions? Thanks
 

generating crc5 for usb

I recommend you to search in Xilinx site. There is an application note and a perl script that generates automatically the vhdl code.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top