Sign in

username:

password:



Not a member?

Search Comp.Arch.FPGA



Search tips

fpga by Keywords

Altera | ASIC | CPLD | Cyclone | DCM | DDR | DSP | Ethernet | ISE | JTAG | Linux | LVDS | Microblaze | ML310 | Modelsim | NIOS | OPB | PCI | Quartus | RocketIO | SDRAM | Spartan | Spartan3 | SRAM | Stratix | Verilog | VHDL | Virtex | Virtex-4 | Virtex-II | Xilinx | XST

Ads

See Also

DSPEmbedded SystemsElectronics

Comp.Arch.FPGA | crc16 with 16 bit inputs

There are 11 messages in this thread.

You are currently looking at messages 0 to 10.

crc16 with 16 bit inputs - bdurr - 2010-05-26 07:55:00

Hello,

I am trying to implement several crc generator/checkers in vhdl in an fpga. The crc32 seems to work ok, a byte at a time.

Can I do crc16 16 bits at a time, rather than a byte at a time?
Thanks.

Bill

	   
					
---------------------------------------		
Posted through http://www.FPGARelated.com



Re: crc16 with 16 bit inputs - Stef - 2010-05-26 08:18:00

In comp.arch.fpga,
bdurr <bdurr.ch@n_o_s_p_a_m.verizon.net> wrote:
> Hello,
>
> I am trying to implement several crc generator/checkers in vhdl in an fpga.
>  The crc32 seems to work ok, a byte at a time.
>
> Can I do crc16 16 bits at a time, rather than a byte at a time?

Yes, but...
Doing CRC16 8 bit at the time requires a 256 entry 16-bit lookup table.
For 16 bit at the time you require a 64k entry 16-bit LUT.

Easiest implementation is 1 bit at the time, requires no LUT at all. Why
do you require 16-bit at the time? Speed? If so, how many clocks do you
have for the calculation?

-- 
Stef    (remove caps, dashes and .invalid from e-mail address to reply by mail)

It looks like blind screaming hedonism won out.
______________________________
Join the blogging team on FPGARelated.com and earn rewards! Details Here.

Re: crc16 with 16 bit inputs - Jon Beniston - 2010-05-26 08:36:00

On 26 May, 13:18, Stef
<stef...@yahooI-N-V-A-L-I-D.com.invalid> wrote:
> In comp.arch.fpga,
>
> bdurr <bdurr.ch@n_o_s_p_a_m.verizon.net> wrote:
> > Hello,
>
> > I am trying to implement several crc generator/checkers in vhdl in an f=
pga.
> > =A0The crc32 seems to work ok, a byte at a time.
>
> > Can I do crc16 16 bits at a time, rather than a byte at a time?
>
> Yes, but...
> Doing CRC16 8 bit at the time requires a 256 entry 16-bit lookup table.
> For 16 bit at the time you require a 64k entry 16-bit LUT.

Surely better just to implement directly as logic rather than a LUT?

Jon

Re: crc16 with 16 bit inputs - wojtek - 2010-05-26 09:10:00

On May 26, 2:36=A0pm, Jon Beniston
<j...@beniston.com> wrote:
> On 26 May, 13:18, Stef <stef...@yahooI-N-V-A-L-I-D.com.invalid> wrote:
>
> > In comp.arch.fpga,
>
> > bdurr <bdurr.ch@n_o_s_p_a_m.verizon.net> wrote:
> > > Hello,
>
> > > I am trying to implement several crc generator/checkers in vhdl in an=
 fpga.
> > > =A0The crc32 seems to work ok, a byte at a time.
>
> > > Can I do crc16 16 bits at a time, rather than a byte at a time?
>
> > Yes, but...
> > Doing CRC16 8 bit at the time requires a 256 entry 16-bit lookup table.
> > For 16 bit at the time you require a 64k entry 16-bit LUT.
>
> Surely better just to implement directly as logic rather than a LUT?
>
> Jon

CRC calculation can be easily implemented with combinational logic and
no LUT's. Simply google 'VHDL crc generator' (or HDL/Verilog) and use
the code you will get from your custom settings. In some cases you
will need to check bit ordering, but this way you will be able to
perform crc calculations with as many bits in the input as you wish.

wojtek

Re: crc16 with 16 bit inputs - Stef - 2010-05-26 10:10:00

In comp.arch.fpga,
wojtek <w...@gmail.com> wrote:
> On May 26, 2:36 pm, Jon Beniston <j...@beniston.com> wrote:
>> On 26 May, 13:18, Stef <stef...@yahooI-N-V-A-L-I-D.com.invalid> wrote:
>>
>> > In comp.arch.fpga,
>>
>> > bdurr <bdurr.ch@n_o_s_p_a_m.verizon.net> wrote:
>> > > Hello,
>>
>> > > I am trying to implement several crc generator/checkers in vhdl in an
fpga.
>> > >  The crc32 seems to work ok, a byte at a time.
>>
>> > > Can I do crc16 16 bits at a time, rather than a byte at a time?
>>
>> > Yes, but...
>> > Doing CRC16 8 bit at the time requires a 256 entry 16-bit lookup table.
>> > For 16 bit at the time you require a 64k entry 16-bit LUT.
>>
>> Surely better just to implement directly as logic rather than a LUT?
>
> CRC calculation can be easily implemented with combinational logic and
> no LUT's. Simply google 'VHDL crc generator' (or HDL/Verilog) and use
> the code you will get from your custom settings. In some cases you
> will need to check bit ordering, but this way you will be able to
> perform crc calculations with as many bits in the input as you wish.

Whoeps, I was thinking too much in the software direction, did the LUT
thing there. In VHDL, I only did 1-bit serial direct approach. Sorry
and thanks for the search term, the first hit is e really wonderful page!

-- 
Stef    (remove caps, dashes and .invalid from e-mail address to reply by mail)

You never have to change anything you got up in the middle of the night
to write.
		-- Saul Bellow

Re: crc16 with 16 bit inputs - Eric Smith - 2010-05-26 21:18:00

On May 26, 5:36=A0am, Jon Beniston
<j...@beniston.com> wrote:
> On 26 May, 13:18, Stef <stef...@yahooI-N-V-A-L-I-D.com.invalid> wrote:
>
> > In comp.arch.fpga,
>
> > bdurr <bdurr.ch@n_o_s_p_a_m.verizon.net> wrote:
> > > Hello,
>
> > > I am trying to implement several crc generator/checkers in vhdl in an=
 fpga.
> > > =A0The crc32 seems to work ok, a byte at a time.
>
> > > Can I do crc16 16 bits at a time, rather than a byte at a time?
>
> > Yes, but...
> > Doing CRC16 8 bit at the time requires a 256 entry 16-bit lookup table.
> > For 16 bit at the time you require a 64k entry 16-bit LUT.
>
> Surely better just to implement directly as logic rather than a LUT?
>
> Jon

Implementing a parallel CRC with random logic rather than LUT RAM is
probably going to take more LUTs than the LUT RAM would!  The tables
for parallel CRC are large, and the content doesn't have a simple
pattern that can be significantly reduced by logic minimization.  (If
it did, the CRC function wouldn't be as useful.)

Eric

______________________________
Join the blogging team on FPGARelated.com and earn rewards! Details Here.

Re: crc16 with 16 bit inputs - 2010-05-27 02:46:00

Eric Smith <s...@gmail.com> writes:

> Implementing a parallel CRC with random logic rather than LUT RAM is
> probably going to take more LUTs than the LUT RAM would!  The tables

If you have 65536x16 = 1Mb of sufficiently fast RAM to spare in your
FPGA you can do the CRC by simply looking up your 16-bit input word
into the RAM, and to a single 16-bit xor and you're done. Something
like this, but in HDL:

http://groups.google.no/group/comp.lang.lisp/msg/8a475821a85b331c?hl=no

Petter

-- 
.sig removed by request. 
______________________________
Join the blogging team on FPGARelated.com and earn rewards! Details Here.

Re: crc16 with 16 bit inputs - Florian - 2010-05-27 04:17:00

On May 26, 1:55=A0pm, "bdurr"
<bdurr.ch@n_o_s_p_a_m.verizon.net> wrote:
> Can I do crc16 16 bits at a time, rather than a byte at a time?
> Thanks.
>
> Bill


Hi Bill,

a time ago I need a CRC16 with 16 bit input data in one clock cycle.
I developed this with public informations like Google and Wikipedia
and so on.
But my comments are not very extensive.

Here is the VHDL source:

  VidCrcGen: for i in VID_CRC_H'range generate
  begin
    process(VID_CLK, RESET)
      variable crc_temp: std_logic_vector(15 downto 0);
    begin
      if (RESET =3D '1') then
        VID_CRC_C(i)        <=3D (others =3D> '0');
        VID_CRC_H(i)        <=3D (others =3D> '0');
      elsif (rising_edge(VID_CLK)) then
        if (VID_CRC_Ctrl(i)(2) =3D '1') then          -- Valid
          if (VID_CRC_Ctrl(i)(1) =3D '1') then        -- Stop
            if (VID_CRC_Ctrl(i)(0) =3D '1') then      -- Start
              -- End of Image
              VID_CRC_H(i)        <=3D VID_CRC_C(i);
            end if;
            VID_CRC_C(i)        <=3D (others =3D> '0');
          else
            -- STOP =3D 0
            crc_temp :=3D VID_CRC_C(i);
            for j in 15 downto 0 loop
              if (VID_CRC_Data(i)(j) /=3D crc_temp(15)) then
                crc_temp :=3D (crc_temp(14 downto 0) & '0') xor x"1021";
              else
                crc_temp :=3D crc_temp(14 downto 0) & '0';
              end if;
            end loop;
            VID_CRC_C(i)        <=3D crc_temp;
          end if;
        end if;   -- if (VID_CRC_Ctrl(i)(2) =3D '1') then         --
Valid

      end if;   -- elsif (rising_edge(VID_CLK)) then
    end process;
  end generate VidCrcGen;


The _C is the calculation register, _H is a hold register which holds
the data for an asynchronous transfer to a microcontroller.
You can ignore the (i) parameter, there are 2 independent data pathes.
The control sognals are commented.
I think the CRC calculation is CCITT (x"1021"), you can verify it at
Wikipedia.
On a Spartan-3A it runs with 80 MHz, maybe 100 is also possible.

Maybe that helps.
Have fun
Florian

______________________________
Join the blogging team on FPGARelated.com and earn rewards! Details Here.

Re: crc16 with 16 bit inputs - Stef - 2010-05-27 05:14:00

In comp.arch.fpga,
Eric Smith <s...@gmail.com> wrote:
> On May 26, 5:36 am, Jon Beniston <j...@beniston.com> wrote:
>> On 26 May, 13:18, Stef <stef...@yahooI-N-V-A-L-I-D.com.invalid> wrote:
>>
>> > Yes, but...
>> > Doing CRC16 8 bit at the time requires a 256 entry 16-bit lookup table.
>> > For 16 bit at the time you require a 64k entry 16-bit LUT.
>>
>> Surely better just to implement directly as logic rather than a LUT?
>
> Implementing a parallel CRC with random logic rather than LUT RAM is
> probably going to take more LUTs than the LUT RAM would!  The tables
> for parallel CRC are large, and the content doesn't have a simple
> pattern that can be significantly reduced by logic minimization.  (If
> it did, the CRC function wouldn't be as useful.)

That was my initial thought as well, but try the generator that the
before mentioned search turned up:
http://www.electronicdesignworks.com/utilities/crc_generator/crc_generator.htm

Set data bus width to 16, select CRC-16-CCITT polynomial (or any other if
you wish), leave others at default and press the generate VDL button. View
the generated VHDL and ...


-- 
Stef    (remove caps, dashes and .invalid from e-mail address to reply by mail)

Hear about the Californian terrorist that tried to blow up a bus?
Burned his lips on the exhaust pipe.
______________________________
Join the blogging team on FPGARelated.com and earn rewards! Details Here.

Re: crc16 with 16 bit inputs - Fredxx - 2010-05-27 08:56:00

"bdurr" <bdurr.ch@n_o_s_p_a_m.verizon.net> wrote in message 
news:w...@giganews.com...
> Hello,
>
> I am trying to implement several crc generator/checkers in vhdl in an 
> fpga.
> The crc32 seems to work ok, a byte at a time.
>
> Can I do crc16 16 bits at a time, rather than a byte at a time?
> Thanks.
>

I'm surprised no one has mentioned this web tool.  I've used it a few times 
and happy with the results.
http://www.easics.com/webtools/crctool


______________________________
Join the blogging team on FPGARelated.com and earn rewards! Details Here.

| 1 | 2 | next