ys82
Newbie level 6
i meet a issue of bluetooth sync word calculate, can anybody help me ? thank you very much !!
the bloouth spec about sync word calculate as bellow:
1. Generate information sequence;
2. XOR this with the “information covering” part of the PN overlay
sequence;
3. Generate the codeword;
4. XOR the codeword with all 64 bits of the PN overlay sequence
I write a verilog behavioral mode to help understand, as bellow
=================================================
assign p_rand=64'h83848d96bbcc54fc; // PN sequence in spec
assign gd=35'o260534236651; //g(d) in spec
//Generate information sequence
assign xd= lap[23] ? {6'b010011,lap} : {6'b101100,lap};
//XOR this with the “information covering” part of the PN overlay sequence
assign xd_ = xd^p_rand[63:34];
//generate codeword as spec description" D34X(D) mod g(D)"
assign xd_shift = {xd_, 34'b0};
assign cd_ = xd_shift%gd;
assign codeword = {xd_,cd_[33:0]};
//XOR the codeword with all 64 bits of the PN overlay sequence
assign syncword = codeword^p_rand
=================================================
I use bellow sample data in spec to verification my behavioral mode,
Bit transmit order on air
--------------------------------->
LAP: | Preamble:| Sync word: | Trailer: |
--------------------------------------------------
000000 | 5 | 7e7041e3 4000000d | 5 |
But my code generate wrong sync word: 1629ddd38000000d(reverse syncword)
so where is wrong of my verliog code ?
the bloouth spec about sync word calculate as bellow:
1. Generate information sequence;
2. XOR this with the “information covering” part of the PN overlay
sequence;
3. Generate the codeword;
4. XOR the codeword with all 64 bits of the PN overlay sequence
I write a verilog behavioral mode to help understand, as bellow
=================================================
assign p_rand=64'h83848d96bbcc54fc; // PN sequence in spec
assign gd=35'o260534236651; //g(d) in spec
//Generate information sequence
assign xd= lap[23] ? {6'b010011,lap} : {6'b101100,lap};
//XOR this with the “information covering” part of the PN overlay sequence
assign xd_ = xd^p_rand[63:34];
//generate codeword as spec description" D34X(D) mod g(D)"
assign xd_shift = {xd_, 34'b0};
assign cd_ = xd_shift%gd;
assign codeword = {xd_,cd_[33:0]};
//XOR the codeword with all 64 bits of the PN overlay sequence
assign syncword = codeword^p_rand
=================================================
I use bellow sample data in spec to verification my behavioral mode,
Bit transmit order on air
--------------------------------->
LAP: | Preamble:| Sync word: | Trailer: |
--------------------------------------------------
000000 | 5 | 7e7041e3 4000000d | 5 |
But my code generate wrong sync word: 1629ddd38000000d(reverse syncword)
so where is wrong of my verliog code ?