The "long division" implementation for the serial CRC does exactly that, so it is very straighforward.
It is easy to see that the "long division" implementation does what the CRC definition says. It works exactly like the CRC definition.How is "long division" version being straightforward compared to optimized version ?
I would say that VHDL can have race conditions. I ran across one that a colleague couldn't solve in their simulation. It turns out the problem was due to a race condition caused by a clock that was used inside a component, and was output from the component to anther block that also used the clock. There ended up being a delta cycle difference between the clock used in the component directly compared to the one used in the other component. I ended up suggesting they change the design to generate the clock and output it from the component and run the output clock back into both that component and the other one. That fixed the race condition they were seeing in the simulation.An interesting link about race conditions in verilog simulation:
I think it explains why the problem disappeared when the testbench assignments were changed to nonblocking.Simulation Race conditions (How VHDL is race free language)
What is Race in the context of HDL simulation?. Race means same HDL code exhibiting two or more possible behaviors, both of which are correct as per the language interpretation. So, a race implies …funrtl.wordpress.com
The serial implementation calculates for one input bit per clock cycle.For long division version, the simulation waveform does not really match the following hand calculation. Why ?
1101101000000 Dividend=Input message + 5 zeros
100101 Divisor=Polynomial, No subtraction
==================
00001 Intermediate result 0x01
000011 Get next input bit
100101 No subtraction
==================
00011 Intermediate result 0x03
000110 Get next input bit
100101 No subtraction
==================
00110 Intermediate result 0x06
001101 Get next input bit
100101 No subtraction
==================
01101 Intermediate result 0x0d
011011 Get next input bit
100101 No subtraction
==================
11011 Intermediate result 0x1b
110110 Get next input bit
100101 Subtract
==================
10011 Intermediate result 0x13
100111 Get next input bit
100101 Subtract
==================
00010 Intermediate result 0x02
000100 Get next input bit
100101 No subtraction
==================
00100 Intermediate result 0x04
001000 Get next input bit
100101 No subtraction
==================
01000 Intermediate result 0x08
010000 Get next input bit
100101 No subtraction
==================
10000 Intermediate result 0x10
100000 Get next input bit
100101 Subtract
==================
00101 Intermediate result 0x05
001010 Get next input bit
100101 No subtraction
==================
01010 Intermediate result 0x0a
010100 Get last input bit
100101 No subtraction
==================
10100 Final result 0x14
The big difference is that there is no ambiguity in the VHDL simulation. You can analyze the problem and fix it.I would say that VHDL can have race conditions. I ran across one that a colleague couldn't solve in their simulation. It turns out the problem was due to a race condition caused by a clock that was used inside a component, and was output from the component to anther block that also used the clock. There ended up being a delta cycle difference between the clock used in the component directly compared to the one used in the other component. I ended up suggesting they change the design to generate the clock and output it from the component and run the output clock back into both that component and the other one. That fixed the race condition they were seeing in the simulation.
1101101000000 Dividend=Input message + 5 zeros
100101 Divisor=Polynomial, No subtraction
==================
00001 Intermediate result 0x01
I now see that there is a misalignment at the beginning. 3 lines should be shifted one step to the right:In the above calculation, how do you obtain intermediate result of 0x01 ?
1101101000000 Dividend=Input message + 5 zeros
100101 Divisor=Polynomial, No subtraction
==================
00001 Intermediate result 0x01 (this is just the first input bit)
000011 Get next input bit
100101 No subtraction
==================
1 0x01
11 0x03
110 0x06
1101 0x0d
11011 0x1b
The big difference is that there is no ambiguity in the VHDL simulation. You can analyze the problem and fix it.
The VHDL delta cycle difference is the same regardless of the simulator execution order. You will always get the same result.
You can view the delta cycle difference in the simulator, and if you eliminate it (maybe by adding dummy assignments for the "early" clock), you are fine.
shared variable a : std_logic;
process
begin
a := '0';
wait;
end process;
process
begin
a := '1';
wait;
end process;
With the help of others (see the screenshot below done by others), I have understood the reasoning behind the optimized version of serial crc implementation. With optimized version, we could have just skipped stage 0 till stage 4, and jumped directly to stage 5.
Now, how do I make parallel implementation of both the "optimized" and "long division" versions of serial crc implementation ?
To generate the CRC for chunks of N input bits, you modify the inputs bits and shift register bits one at a time, and execute the serial implementation N times. You note in matrix 1 and 2 which output bits are affected by each of the "input" bits.
This has already been answered in posts #24 and #39.How exactly is modify the inputs bits and shift register bits one at a time being done ?
Mout = CRC_parallel(Nin, Min) where Nin is N input bits and Min is Mout from the previous clock cycle
The results from having a bit set in Nin go to matrix 1. One Mout result per row.
The results from having a bit set in Min go to matrix 2. One Mout result per row.
As I mentioned in post #43, you can put all rows in one matrix.Why need 2 matrices ?
one for the "real" input bits and another for the shift register bits.
Table 1 is for the Nin[] bits = the input data = the "real" input bitsIn http://outputlogic.com/my-stuff/circuit-cellar-january-2010-crc.pdf#page=4 , which table (table 1 or table 2) is for the "real" input bits ?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?