Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some questions about the code. #112

Closed
showna opened this issue Aug 22, 2024 · 6 comments
Closed

Some questions about the code. #112

showna opened this issue Aug 22, 2024 · 6 comments

Comments

@showna
Copy link

showna commented Aug 22, 2024

  1. Could you send email to [email protected] to introduce your self?
    I did not introduce myself via email.

  2. Our image is used directly or you build your own image?
    Not used directly; just for learning.

  3. What is your own modification?
    Just for learning.

  4. Versions: OS, Vivado, openwifi/openwifi-hw repo branch and commit revision
    OS:ubuntu 1604, Vivado 2021.1,openwifi-hw/master.

  5. Board/hardware type
    NONE

  6. WiFi channel number
    NONE

  7. Steps to reproduce the issue, and the related error message, screenshot, etc
    NONE

  8. Describe your debug efforts by Linux native tools, such as tcpdump and "cat /proc/interrupts"
    NONE

  9. Describe your debug efforts by: https://github.com/open-sdr/openwifi/blob/master/doc/README.md#Debug-methods
    NONE

  10. Any other thing we need to know for helping you better?

      if(fifo_turn == PKT_FIFO) begin
         if(pkt_iq_sent[5:0] == 6'b111111 && |pkt_iq_sent[15:8] == 1)
             fifo_turn <= CP_FIFO;
         pkt_iq_sent   <= pkt_iq_sent + 1;
     end else if(fifo_turn == CP_FIFO) begin
         if((pkt_iq_sent < 640 && CP_iq_sent[3:0] == 4'b1111) || (S_GI == 0 && CP_iq_sent[3:0] == 4'b1111) || (S_GI == 1 && pkt_iq_sent >= 640 && CP_iq_sent[2:0] == 3'b111))
             fifo_turn <= PKT_FIFO;
         CP_iq_sent    <= CP_iq_sent + 1;
     end
    

According to the logic of this code segment: within the range of 128 to 32767, insert 16 CPs every 64 data sampling points. I would like to know the origin of this logic. Why does it start from "128"? What do "32767" and "640" refer to? Thank you for providing answers.

@mmehari
Copy link
Member

mmehari commented Aug 22, 2024

I don't fully understand your question, but the code segment you posted is used to sequentially count the number of IQ samples that are used both for packet and cyclic prefix (CP).

Furthermore, the values 128 and 32767 are not indicated in the code segment but the value 640 refers to the number of data IQ samples (excluding CP) up to the first data OFDM symbol of an 802.11n packet (L-STF + L-LTF + L-SIG + HT-SIG + HT-STF + HT-LTF) (160 + 160 + 64 + 128 + 64 + 64)

@showna
Copy link
Author

showna commented Aug 23, 2024

I don't fully understand your question, but the code segment you posted is used to sequentially count the number of IQ samples that are used both for packet and cyclic prefix (CP).

Furthermore, the values 128 and 32767 are not indicated in the code segment but the value 640 refers to the number of data IQ samples (excluding CP) up to the first data OFDM symbol of an 802.11n packet (L-STF + L-LTF + L-SIG + HT-SIG + HT-STF + HT-LTF) (160 + 160 + 64 + 128 + 64 + 64)

My apologies for the confusion, it should be the values 256 and 65536.
When the condition |pkt_iq_sent[15:8] == 1 is met, the value range of pkt_iq_sent is from 256 to 65535.
What do 256 and 65535 refer to?

As for your additional question:

    if(PKT_TYPE == HT) begin
        if(nof_iq2send == 480)
            nof_iq2send <= nof_iq2send + 240;
        else if(nof_iq2send < 480 || S_GI == 0)
            nof_iq2send <= nof_iq2send + 80;
        else
            nof_iq2send <= nof_iq2send + 72;
    end else begin
        nof_iq2send <= nof_iq2send + 80;
    end

In the code segment, what do the values 480 and 240 respectively refer to?

@mmehari
Copy link
Member

mmehari commented Aug 23, 2024

My apologies for the confusion, it should be the values 256 and 65536.
When the condition |pkt_iq_sent[15:8] == 1 is met, the value range of pkt_iq_sent is from 256 to 65535.
What do 256 and 65535 refer to?

You have to consider the entire line if(pkt_iq_sent[5:0] == 6'b111111 && |pkt_iq_sent[15:8] == 1) and instead of 256, the value becomes 64+256 = 320, which is the start of the first CP IQ sample residing inside L-SIG field. And the search runs until the end of a packet of maximum size 65535.

In the code segment, what do the values 480 and 240 respectively refer to?

The numbers 240 and 480 are specific to 802.11n packets such that 480 refers to the number of IQ samples present until mid-point HT-SIG and 240 is the number of IQ samples past 480 to reach the first OFDM symbol.

As a side note, if you are curious to understand dot11_tx, the best approach will be simulating it inside Vivado using the provided test vectors.

@showna
Copy link
Author

showna commented Aug 24, 2024

Here's my suggestion: Could you consider adding comments or using macros to replace these constant numbers where they are critical? This would enhance the code readability.

@mmehari
Copy link
Member

mmehari commented Aug 24, 2024

Indeed that will enhance code readability but unfortunately I am not active on the project and I can't say what I can't do.

@showna showna closed this as completed Oct 11, 2024
@ll550
Copy link

ll550 commented Oct 15, 2024

thx for discussion,quite insightful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants