[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bluetooth] Re: Re: Re: CRC sample dataquestion??pls reply ASAP
Hi Anil Nainwal and all members,
I think that my code is correct.Let me explain here,
In my Verilog code, I declared:
uap[7:0]
crc[15:0]
data[7:0]]
I assume the Sample data (please check pg979) for "data" and "uap" are defined in
this manner:
********LSB on the right,MSB on the left******
Therefore I load uap and data_in in the way shown below:
uap[7:0] = b'01000111 //0x47
data[0]=4e=01001110 ; data_in is 1st '0',2nd '1',3rd '1', 4th '1',5th '0',and so on //0x4e
.
.
.
.
.
.
data[9] = 09 = 00001001;data_in is 1st '1',2nd '0,3rd '0', 4th '1',5th '0'.......and so on
after all the data is fed, i got crc[15:0] = b64b
but in the spec(on page 73), it stated that the bit15 should be out, then bit14...and so
on.
therefore crc = d26d
what i suspect that they swap the 1st and 2nd byte,so crc = 6dd2
Am I right?? Anyone has done the CRC?? please tell me if i'm wrong. If you would like
to check for me,i will send you the code
BTW,if i load uap = 57,and the data still remains the same,i got crc=a7ad, is it
correct??
Thank You
Best Regards
Chuan Chew
-------------------------------------------------------------
----- Original Message -----
From: "Anil Nainwal - Sofblueindia"
<anilnainwal@s... >
To: "ChuanChew Sin" <ccsin@k... >
<bluetooth@o... >, "Jamil Khatib"
<khatib@o... >
Date: Wed, 30 Apr 2003 10:29:36 +0530
Subject: [bluetooth] Re: Re: Re: CRC sample dataquestion??pls reply
ASAP
> Dear Chuan,
>
> I went through your code.
>
> The problem that I could see is:
>
> In your module crc_ccitt , You have defined output [`BITS_OUT-1:0]
> crc_out;
>
> This means that MSB is bit 15(16th bit) and LSB is bit 0.
> Fine�.
>
>
>
> Now, UAP is 47 that is (0100 0111) with LSB on the left most side
> i.e UP0(LSB) is 0 and UP7(MSB) is 1.--------(1)
>
> Now, in both test benches, you have defined reg [`BYTE-1:0] uap,
> this means if written in a format of (ABCD EFGH) , A will be MSB
> and H is LSB
>
> CASE 1: Now, when you initialize uap in test bench crc_sim you are
> initializing it as
>
> uap= `BYTE'h47; ie 0100 0111
>
> it means msb (UP7) is 0 and LSB (UP0) is 1. now compare it with
> (1) and you will find it's mismatching. So here is the problem.
>
>
>
> CASE 2: When you initialize UAP in crc_sim1, what you are doing
> is�
>
> uap= `BYTE'h2e; ie 0010 1110.
>
> This means MSB (UP7) is 0,� UP5= 1� UP1=1 and
> LSB(UP0)=0.
>
> Now compare it again with (1) and you will find all the bits are
> mismatching.
>
>
>
> I think Similar kind of problem is there while initializing others.
>
> Solution:
>
> If you have defined reg [`BYTE-1:0] uap, then initialize uap as
> (1110 0010) that comes to be E2. and not 2E.
>
> But check the same problem while initializing other parameters as
> well.
>
>
>
> Then one more solution that comes to my mind is you define reg
> [0:`BYTE-1] uap, and then initialize it as in CASE 1, ie 47 (0100
> 0111) this will make 0 as MSB and 1 as LSB. And this is same as
> (1), I havenot tried it yet but you try and then please tell me if
> it works.
>
> But do take care while initializing others, this is one basic
> problem i could see on first go, I will check it more. but till
> then you try this and also check that other initializations are
> fine.
>
> you are welcome to put your queries....
>
> If I am wrong..plz let me know.. suggestions will be appreciated.
>
> Best Regards
>
> Anil Nainwal
>
>
> ----- Original Message -----
> From: "ChuanChew Sin" <ccsin@k... >
> To: <anilnainwal@s... >
> Sent: Tuesday, April 29, 2003 7:31 AM
> Subject: Re: Re: Re: CRC sample dataquestion??pls reply ASAP
> > Hi Anil Nainwal,
> >
> > Sorry to bother you again.
> >
> > Have you checked the code I sent to you yesterday??I really
> hope that you could find out the problem that i'm facing right now.
> >
> > Best regards.
> >
> > Chuan Chew
>
>
--
To unsubscribe from bluetooth mailing list please visit http://www.opencores.org/mailinglists.shtml