Lawrence
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    11
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    AMBA AXI Protocol === ## AXI Architecture AXI 是 burst-based 的 protocol 其中有五個 channels - Write Address Channel - Write Data Channel - Write Response Channel - Read Address Channel - Read Data Channel ## Read and Write Transactions ### Handshake Process 每個 channel 都有自己的 handshake 機制,handshake 都是用 VALID/READY 來完成一次的傳輸。 要傳輸資訊的一端不必等目的地是否有拉起 READY 就可以發送 VALID,但一旦發送 VALID 就必須等到目的地回 READY 才能結束 VALID。 VALID/READY handshake 機制可以有兩種做法: - 等有來源發送 VALID 後目的地若可以接收才回 READY。如下圖所示,T1 發送 VALID,T2 收到 VALID 後才回 READY,T3 完成此次的傳輸 ![](https://i.imgur.com/FguEzKw.png) - 只要目的地可以接收資訊就一直拉著 READY。如下圖所示,T1 目的地可以接收資訊,T2 來源發送 VALID,T3 完成此次的傳輸 ![](https://i.imgur.com/xjq12yA.png) 一般推薦用第二種方法,這樣可以在來源發送 VALID 的下一 cycle 就完成傳輸。 ### 各 Channel Handshake Process 的訊號名稱 ![](https://i.imgur.com/1fTuT4U.png) ### Channel 間的關係 - Write response 必須要在最後一筆 write data 傳輸後才能回 - Read data 必須要有 read address 傳輸後才能回 - channel handshake 必須遵守下面的關係,其中單箭頭代表後者跟前著的關係沒有誰先誰後,雙箭頭代表前者一定要先發生後者才能發生 ![](https://i.imgur.com/5z7nEWK.png) 上圖代表 read address channel 可以是 VALID 先拉起或 READY 先拉起,但 read address channel handshake 的訊號都必須要在 read data channel VALID 拉起前先拉起 (這其實也就是要傳輸 read data 前一定要先完成 read address 的傳輸),而 read data channel 的 VALID 跟 READY 誰先拉起都可以。這邊並沒有要求 read data channel 的 READY 跟 read address channel 的 handshake 訊號的關係。 ![](https://i.imgur.com/UugSWWs.png) 上圖代表 write address channel 跟 write data channel 的 VALID 跟 READY 誰先拉起都可以,但這些訊號都必須在 write response channel 的 VALID 拉起前先拉起過 (這表示要有 write response 必須先完成 write address 跟 write data 的傳輸才行),write response channel 的 VALID 跟 READY 誰先拉起都可以。 write data channel 另外需要注意的是 VALID 要看的是最後一筆 data 的 VALID。 另外,AXI3 的時候並沒有要求 write response channel 的 VALID 必須要在 write address channel handshake 完成之後,因為當時並沒有預期會有可能有 write response channel 拉起 VALID 但還沒有完成 write address 傳輸的情況。 ## Transaction Structure 一次的 Transaction 包含三個部分: address、data read/write、response ### Address Structure AXI 是 burst-based 的 protocol,傳送 address 時也會傳送 burst 相關的控制資訊,而接收端就需要去根據這些控制資訊來處理 address。 :::info Write address channel 跟 read address channel 除了傳 address 也包含 burst 的控制資訊。 ::: #### Burst 的控制資訊 - ARLEN[7:0] / AWLEN[7:0]: read address 跟 write address 的 burst 長度。 我們下面舉 read 的例子,write 也可依此類推 ARLEN = 0 代表這次發送的 read address 只會回傳一筆 data ARLEN = 2 代表這次發送的 read address 會回傳三筆 data - ARSIZE[2:0] / AWSIZE[2:0]: 每一筆 read / write 傳輸的 data size ![](https://i.imgur.com/9IMD5Zm.png) - ARBURST[1:0] / AWBURST[1:0]: burst type,有三種 FIXED、INCR、WRAP - FIXED - burst 的每一筆傳輸都是相同的 address - 雖然 burst 的每一筆傳輸都是相同的 address,但 write 時可以指定不同的 write byte (WSTRB) - FIXED type 適合用重複在存取相同 address 的時候,例如存取 FIFO - INCR - burst 的每一筆傳輸的 address 都是前一筆 address 的累加,累加的值取決於 burst size - WRAP - WRAP 跟 INCR 類似,差別在當 address 超過上限會繞回較低的 address - 當 address 的到達 wrapper boundary + burst size x burst length 就會繞回 wrapper boundary,wrapper boundary = int(start address / (burst size x burst length)) x burst size x burst length,int() 會無條件捨去小數位 - WRAP burst 的 start address 必須要 align burst size - WRAP burst 只能是 2, 4, 8, 16 ![](https://i.imgur.com/oFEoZQO.png) Burst 的規則: - Burst address 不能夠跨 4KB address boundary - Burst 長度限制從 1 - 256 - AXI3 只有 1 - 128 - AXI4 只有 INCR type 才能是 1 - 256,其餘仍是 1 - 128 - WRAP type 的 burst 長度只能夠是 2, 4, 8, 16 - 一旦給了 burst 長度就一定要發完,不能提前結束 ### Data Read and Write Structure #### Write Strobes write data channel 的 data bus 可以分成一條條的 byte lane,每條由 WSTRB (write strobes) 控制,若 data bus 為 n bytes 那 WSTRB 就需要 n bits,每個 bit 對應 data bus 第 n 個 byte 是否是 valid data。 WSTRB 在 WVALID 沒有拉起前是任何值都無所謂。 #### Narrow Transfers write data channel 可以接受較大的 data bus 但指傳輸較小的 data size,要達到如此我們需知道 address 跟一些控制訊號,像是 burst size 之類來控制 WSTRB 來決定哪些 byte lane 需要使用。 以下圖為例,下圖為 data bus 為 32-bit,burst size 為 0 (也就是每次傳輸 8-bit data),burst length 為 4 (也就是會傳輸 5 筆 data),burst type 為 0 (也就是 INCR type) 的 data 傳輸範例 ![](https://i.imgur.com/mI7WqDo.png) #### Byte Invariance AXI 使用的是 byte-invariant endianness,如此可以比較容易的處理 mixed-endian。byte-invariant endianness 不管 data 是 big-endian 或 little-endian 都是按照對應 address 的 byte 去存取。 #### Unaligned Transfers AXI 支援沒有對齊的傳輸,舉例來說,有個 data packet 為 4-byte 但它的 start address 為 0x0002 並沒有對其 4-byte。 要做到 unaligned transfers 可以搭配 WSTRB 把不要存取的 byte 擋掉就行了。 以下圖為例,下圖為一個 data bus 為 64-bit 從 0x07 address 開始的 data size 為 32-bit 的傳輸。灰色部分為用 WRSTB 遮掉的部分,白色為每次 transfer valid 的 data。 ![](https://i.imgur.com/A1qaSDW.png) ### Read and Write Response Structure AXI 在 read 跟 write 的 transactions 都有 response 訊號。Read transaction 的 response 訊號是在 read data channel (RRESP[1:0]),write transaction 的 response 訊號是在 write response channel (BRESP[1:0])。 有四種 response: ![](https://i.imgur.com/rnpc2N7.png) - OKAY: normal access 成功時使用 - EXOKAY: exclusive access 成功時使用 - SLVERR: master 到 slaver 的傳輸成功,但 slaver 想要對 master 回覆錯誤時使用 - DECERR: master 要傳輸的 slaver 不存在時使用 對於 write transaction,一次 response 訊號回應所有 burst 的傳輸。而對於 read transaction,一次 response 訊號回應 burst 裡單一筆傳輸。 前面有提到 burst 傳輸無論如何都要把傳輸傳完,response 也是如此,即使其中有 error response 也要把剩餘的傳輸完成。

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully