1 Star 6 Fork 5

WangXuan95 / FPGA-SATA-HBA

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
GPL-3.0

部署

FPGA-SATA

SATA Gen2 host (HBA) ,可运行在具有 GTH 的 Xilinx FPGA 上。本库提供基于 netfpga-sume 官方开发板的示例,可实现硬盘读写。

另外,我写了一个介绍 SATA 的技术文章 SATA协议浅析:从串行信号到读写硬盘 ,帮助大家理解 SATA 协议栈的细节。

简介

SATA是硬盘最广泛使用的接口协议。图1是SATA体系结构,其中 SATA host (HBA) 是硬盘读写控制器,在电脑中往往用主板芯片组来实现,在这里是 FPGA 实现。而 SATA device 就是硬盘(机械硬盘或固态硬盘)。

SATA_ARCH
图1:SATA 协议栈

SATA 协议自下而上包含:物理层(Physical Layer, PHY)、链路层(Link Layer)、传输层(Transport Layer)、命令层(Command Layer) :

  • 物理层:下游用两对串行差分信号对连接 SATA device ,包括发送用的差分对(SATA_A+, SATA_A-) 和接收用的差分对(SATA_B+, SATA_B-) 。进行串行信号的时钟恢复、串并转换后,用并行信号与上游的链路层进行交互。
  • 链路层和传输层:从下到上分别实现:8b10b 编解码、加扰/解扰、CRC计算和检验、流控、数据缓存、FIS数据包的封装和解析。与上游的命令层使用一种叫 Frame Information Structures (FIS) 的数据包结构进行交互。
  • 命令层:接受上游的读写命令,生成和解析FIS,实现硬盘读写操作。

本库仅仅用硬件实现了从物理层到传输层的功能,原因如下:

  • 从物理层到传输层的功能虽然并不简单,但目的比较单一,仅仅是为了提供可靠的 FIS 传输机制,内部耦合度较高。而且 FIS 是统一的数据流格式,因此从传输层到命令层的数据接口较为简单,易于理解和使用。
  • 之所以不实现命令层,是因为由于历史兼容性的原因,SATA 所支持的 ATA 和 ATAPI 等命令集所规定的硬盘读写方式较多,包括 PIO 、 DMA 等,因此一个完整的命令层需要实现众多繁杂的命令的状态机。但其目的并不复杂,都是为了用各种方式来实现硬盘读写。

本库对各层的实现方法如下:

  • 虽然没有用硬件实现命令层,但我在 FPGA 内实现了一个用 UART 收发 FIS 的示例工程,提供了 UART “FIS透传” 功能:你可以用电脑中的串口软件(比如minicom, putty, hyper-terminal, 串口助手等)来发送 FIS 给 Device,并能看到 Device 发来的 FIS 。基于此,只要我们按命令层规定的 FIS 格式来发送数据,就能实现硬盘的读写。
  • 链路层和传输层用 Verilog 实现,但不包括链路层中的 8b10b 编解码,这是因为 Xilinx 的 GT 原语能实现 8b10b 编解码。
  • 物理层:用 Xilinx 的 GTH 原语实现。因此本工程支持的是具有 GTH 的 Xilinx FPGA ,比如 Virtex7 、Zynq Ultrascale+ 等。

代码文件

以下是本工程的代码文件的树形结构:

  • vivado_netfpgasume/fpga_top.xdc : 引脚约束文件,把端口约束到 netfpga-sume 的引脚上。
  • RTL/fpga_uart_sata_example/fpga_uart_sata_example_top.sv : FPGA工程顶层 (Verilog)
    • RTL/IP/clk_wiz_0 : 生成 60MHz 时钟提供给 SATA HBA core 的 CPLL_refclk (Xilinx clock wizard IP)
    • RTL/sata_hba/sata_hba_top.sv : SATA HBA 顶层,实现物理层、链路层、传输层 (Verilog)
      • RTL/sata_hba/sata_gth.sv : 实现物理层,调用了 Xilinx GTH 相关的原语 (Verilog)
      • RTL/sata_hba/sata_link_transport.sv : 实现了链路层和传输层 (Verilog)
    • RTL/fpga_uart_sata_example/uart_rx.sv : 接收 Host-PC 发来的 UART 信号,把它解析成 FIS 数据流发送给 HBA (Verilog)
    • RTL/fpga_uart_sata_example/uart_tx.sv : 接收 HBA 收到的 FIS,把它转换成人类可读的 ASCII-HEX 格式并用 UART 发送给 Host-PC (Verilog)
fpga_example
图2 : 本库的代码结构。其中 xfis 代表 FIS 发送流,rfis 代表 FIS 接收流。

SATA HBA 模块接口说明

RTL/sata_hba/sata_hba_top.sv 是 SATA HBA core 的顶层模块,具有简洁的 FIS 收发接口。如果你想实现其它 SATA 应用,比如自己编写命令层,需要充分理解 sata_hba_top.sv 的接口波形。

首先我们需要理解 FIS 数据包的结构,如下表。FIS 的长度一定是 4 byte 的倍数。其中 CRC 对模块调用者是不可见的,因为 sata_hba_top.sv 会自动插入、检查并删除。模块调用者仅需把 FIS-type 字段和 Payload 字段当成一个整体来发送和接收。在下文的语境中,我们用 FIS长度 指代 FIS-type + Payload 字段的总长度(最小 1 dword, 最大 2049 dword),而不包括 CRC 。

表:FIS 数据包结构

字段 FIS-type Payload CRC
长度 (byte) 4 0~8192 4
长度 (dword) 1 0~2048 1
发送 需要用户发送 需要用户发送 不需要用户发送 (硬件自动插入)
接收 用户可见 用户可见 用户不可见 (硬件检查并删除)

:point_right: dword 术语翻译为“双字”,代表4个字节。

以下是 sata_hba_top.sv 的接口定义,其中 rfis_ 开头的信号构成了类似 AXI-stream source 的接口,会向用户发送收到的 FIS 。 xfis_ 开头的信号构成了类似 AXI-stream sink 的接口,用户要用它来发送 FIS 。它们都与 clk 时钟信号同步。

module sata_hba_top (     // SATA gen2
    input  wire        rstn,          // 0:reset   1:work
    input  wire        cpll_refclk,   // 60MHz clock is required
    // SATA GT reference clock, connect to clock source on FPGA board
    input  wire        gt_refclkp,    // 150MHz clock is required
    input  wire        gt_refclkn,    //
    // SATA signals, connect to SATA device
    input  wire        gt_rxp,        // SATA B+
    input  wire        gt_rxn,        // SATA B-
    output wire        gt_txp,        // SATA A+
    output wire        gt_txn,        // SATA A-
    // user clock output
    output wire        clk,           // 75/150 MHZ user clock
    // =1 : link initialized
    output wire        link_initialized,
    // to Command layer : RX FIS data stream (AXI-stream liked, without tready handshake, clock domain = clk)
    //   example wave :               // |  no data  |  FIS1 (no error)  |  no data  | FIS2 (error) |   no data   |  FIS3 (no error)  |   no data   |
    output wire        rfis_tvalid,   // 000000000000111111111111111111111000000000000000000000000000000000000000011111111111111111111100000000000000     // rfis_tvalid=1 indicate rfis_tdata is valid. rfis_tvalid is always continuous (no bubble) when output a FIS
    output wire        rfis_tlast,    // 000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000100000000000000     // rfis_tlast=1  indicate this data is the last data of a FIS
    output wire [31:0] rfis_tdata,    // XXXXXXXXXXXXDDDDDDDDDDDDDDDDDDDDDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXDDDDDDDDDDDDDDDDDDDDDXXXXXXXXXXXXXX     // data, little endian : [7:0]->byte0, [15:8]->byte1, [23:16]->byte2, [31:24]->byte3
    output wire        rfis_err,      // 000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000     // indicate a error FIS is detected (CRC error or illegal length), the error FIS do not effect rfis_tvalid, rfis_tlast and rfis_tdata
    // from Command layer : TX FIS data stream (AXI-stream liked, clock domain = clk)
    //   example wave :               // | idle  | write FIS1 to buffer  |  FIS1 transfer in progress (no error) |  idle  |  write FIS2 to buffer |  FIS2 transfer in progress (error)  |  idle  |
    input  wire        xfis_tvalid,   // 000000001111101001110111101111110000000000000000000000000000000000000000000000000111111111111111111111111000000000000000000000000000000000000000000000000     // xfis_tvalid=1 indicate xfis_tdata is valid, that is, user want to write data to internal TX FIS buffer. xfis_tvalid handshake with xfis_tready (data will write successfully to TX FIS buffer only when xfis_tvalid=xfis_tready=1). xfis_tvalid allows continuous (no bubble) or discontinuous (insert bubbles)
    input  wire        xfis_tlast,    // 000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000     // xfis_tlast=1  indicate this data is the last data of a FIS. this FIS will transfer to SATA device in progress after xfis_tlast=1 (xfis_tready turn to 0)
    input  wire [31:0] xfis_tdata,    // XXXXXXXXDDDDDXDXXDDDXDDDDXDDDDDDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXDDDDDDDDDDDDDDDDDDDDDDDDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX     // data, little endian : [7:0]->byte0, [15:8]->byte1, [23:16]->byte2, [31:24]->byte3
    output wire        xfis_tready,   // 111111111111111111111111111111110000000000000000000000000000000000000000111111111111111111111111111111111000000000000000000000000000000000000001111111111     // xfis_tready=1 indicate FIS transfer is idle, user is allowed to write data to internal TX FIS buffer. while xfis_tready=0 indicate FIS transfer in progress, user is NOT allowed to write data to TX FIS buffer. xfis_tvalid handshake with xfis_tready (data will write successfully to TX FIS buffer only when xfis_tvalid=xfis_tready=1). xfis_tready will turn to 1 at the next cycle of xfis_done=1
    output wire        xfis_done,     // 000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000010000000000     // xfis_done=1 when FIS transfer progress ending, xfis_done=1. and xfis_tready will turn to 1 at the next cycle.
    output wire        xfis_err       // 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000     // when xfis_done=1, xfis_err=1 indicates FIS transfer error (the SATA device feedback R_ERR).
);

关于接口波形,请看以上接口代码的注释。

rfis_ 开头的各信号(接收 FIS 的通道)说明如下:

  • rfis_tvalid : rfis_tvalid=1 表示 rfis_tdata 有效。 rfis_tvalid 在输出 FIS 时始终是连续的(也即无气泡,例如 device 发来一个长度是 257 dword 的 FIS,则连续 257 个时钟周期内保持 rfis_tvalid=1)。
  • rfis_tlast : 当 rfis_tvalid 和 rfis_tlast 同时=1 时,表示这个数据是一个 FIS 的最后一个 dword 。该信号用于界定 FIS 的边界。
  • rfis_tdata : 当 rfis_tvalid=1 时,rfis_tdata 上出现一个 dword 的有效的FIS数据。rfis_tdata 是小端序,rfis_tdata[7:0] 是最低字节,rfis_tdata[31:24] 是最高字节。
  • rfis_err : 当 rfis_err=1 时,说明 HBA 收到了一个错误的 FIS (CRC错误或长度不合法)。错误的 FIS 仅仅会引起 rfis_err=1 ,而不会影响 rfis_tvalid, rfis_tlast , rfis_tdata 信号,这是因为本模块内有缓存丢弃机制,错误的 FIS 并不会在 rfis_tdata 上传输。

xfis_ 开头的各信号(接收 FIS 的通道)说明如下:

  • xfis_tvalid : xfis_tvalid=1 表示 xfis_tdata 有效,即用户想将数据写入 HBA 内部 TX FIS 缓冲区。 xfis_tvalid 与 xfis_tready 握手(只有当 xfis_tvalid=xfis_tready=1 时,数据才会成功写入 TX FIS 缓冲区)。 xfis_tvalid 允许连续(无气泡)或不连续(插入气泡)
  • xfis_tlast : xfis_tlast=1 表示用户当前发送的数据是 TX FIS 的最后一个数据。该信号用于界定 FIS 的边界。 在 xfis_tlast=1 之后,HBA内部进入发送状态,xfis_tready变为0,不再接收用户发来的新数据,直到该FIS被HBA发送给device为止,xfis_tready恢复1。
  • xfis_tdata : 当 xfis_tvalid=1 时,xfis_tdata 上需要出现一个 dword 的有效的FIS数据。xfis_tdata 是小端序,xfis_tdata[7:0] 是最低字节,xfis_tdata[31:24] 是最高字节。
  • xfis_tready : xfis_tready=1 表示 HBA 内部不处于发送状态,此时用户可以写入FIS数据。xfis_tready=0 表示 HBA 正在发送数据给device ,此时用户即使令 xfis_tvalid=1 也会被忽略。xfis_tready 只有在两种情况下会从 1 变成 0 :要么因为 xfis_tlast=1 而开始发送数据给device ,要么因为检测到link断开(比如SATA电缆被拔下)。
  • xfis_done : 当HBA向device传输FIS数据的进度结束时,出现一个时钟周期的 xfis_done=1 。 并且 xfis_tready 将在下一个时钟周期变为 1。
  • xfis_err : 当 xfis_done=1 时,xfis_err=1 表示 FIS 传输出错(是因为在发送完 FIS 后检测到 device 反馈了 R_ERR ,说明 device 检测到了 CRC 错误)。

运行示例工程

本节介绍用本示例工程通过 FPGA 读写硬盘的全过程。

硬件准备

  • netfpga-sume 开发板
  • SATA 接口的固态硬盘或机械硬盘(我成功地测过了 SV300S37A 固态硬盘 和 WD1600JS 机械硬盘)
  • 一个台式机机箱,仅仅用于给 netfpga-sume 和 硬盘供电。因此需要有 8-pin PCIe 扩展卡电源接口和 SATA 电源接口。
  • SATA 数据线一根(从台式机机箱里拆一根下来即可)
  • 一台装有 vivado 的电脑:用 USB 连接 netfpga-sume ,用于工程编译、下载、以及通过 USB 接口与 netfpga-sume 进行 UART 通信。

硬件连接

硬件连接如图3~图5

c1
图3:硬件连接
c2
图4:netfpga-sume 开发板的供电
c3
图5:netfpga-sume 开发板的 SATA 接口

编译和烧录程序

用 vivado 打开 vivado_netfpgasume/sata_netfpgasume.xpr 工程文件,编译并烧录。(我用的是 vivado 2019.1,如果你因为版本不兼容而无法打开工程,请重新建立工程,并手动添加工程相关的文件,注意 FPGA 的型号应该选 xc7vx690tffg1761-3

烧录程序后,netfpga-sume 上的 LD0 亮说明 clk_wiz_0 正常工作。 LD1 亮说明 SATA 连接建立。本工程支持热插拔,如果拔下硬盘,LD1 会熄灭。重新插入后又会点亮。(虽然支持,但不建议对硬盘进行热插拔)

如果你插入硬盘后 LD1 始终不亮,可以按下 netfpga-sume 上的 BTN0 对系统进行复位。

用 UART 收发 FIS 来读写硬盘

本例中的 uart_rx.sv 模块会把用户发送的 ASCII-HEX (人类可读)格式的 UART 数据转成 SATA HBA 模块所接受的 AXI-stream 格式;uart_tx.sv 模块会把 SATA HBA 发送的 AXI-stream 转成 ASCII-HEX 的 UART 格式。因此支持使用串口调试软件 (比如minicom, putty, hyper-terminal, 串口助手)进行 “FIS透传”。在此基础上我们需要按命令层规定的 FIS 格式来发送FIS,即可完成读写。

UART 收发 FIS 的格式

设一个 FIS 有 5个 dword,如下(十六进制),其中第一个 dword 是 FIS type ,后4个 dword 是 payload ,这也是 xfis_tdata 和 rfis_tdata 信号上依次出现的数据:

0058605F E0000000 00000000 50000001 00000200

我们需要先把它表示成逐个 byte 的格式,注意 dword 是小端序,因此低位 byte 在前,高位 byte 在后:

5F 60 58 00 00 00 00 E0 00 00 00 00 01 00 00 50 00 02 00 00

如果这个 FIS 是 device 发给 HBA 的,则 UART 会收到如下的字符串。其中每个字符以 ASCII 码对应的字节在 UART 上进行传输 , ‘\n’ 是换行符,也即ASCII码的 0x0A ; '5' 是 ASCII 码的 0x35 , 'F' 是 ASCII 码的 0x46

5F605800000000E0000000000100005000020000\n

如果这个 FIS 是 HBA 发给 device 的,则 UART 格式类似,如下,用户只需要用 UART 发送如下字符串即可。注意 '\n' 必须要发送,FPGA会用它来判断一个 FIS 的结尾。

5F605800000000E0000000000100005000020000\n

并且还支持更自由的格式,可以在各个字符见任意插入空格,还可以在结尾加入 '#' 号来添加注释,FPGA会筛选掉这些空格和注释。

比如你也可以发送如下字符串,与上面的是等效的(但是始终注意一个FIS的结尾要加 '\n') :

5F605800 0000 00E0 00000000 01 000050 00020000   #example TX FIS \n

进行硬盘 identify

在读写前,我们要向硬盘发起 identify 请求 FIS ,该 FIS 包含 5 个 dword :

00EC8027 00000000 00000000 00000000 00000000

因此需要用UART发送如下字符串:

27 80 EC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n

命令层的规定,硬盘会响应两个 FIS ,长度分别为 5 个 dword 和 129 个 dword 。关于这两个 FIS 的含义,请看参考资料[1],这里不做赘述。

串口助手软件为例,需要按如图6来操作 。

uart1
图6 : 用串口助手软件来查看 device signiture ,并进行 identify 。

用DMA方式进行硬盘读

命令层规定的读写方式很多,包括 PIO 和 DMA 等。其中 DMA 读写以扇区(sector) 为单位,每个扇区 512 byte (128 dword) 。用 48-bit LBA (logic block address, 逻辑块地址) 对扇区进行寻址,例如 LBA=0x000001234567 就代表第 0x1234567 个扇区。一次可以指定连续读写扇区的数量。

要进行DMA读,HBA 要发送 5 dword 长度的 DMA 读请求 FIS ,其格式如下 (详见参考资料[1] ):

00258027 E0XXXXXX 00YYYYYY 000000ZZ 00000000

以上FIS中,XXXXXX 是 LBA[23:0] ,YYYYYY 是 LBA[47:24] 。ZZ 是读扇区的数量,一次可以读一个或多个扇区。

例如我们要对 LBA=0x000000023456 (也就是第 0x23456 个扇区)进行读,连续读 4 个扇区,则应该发送命令 FIS :

00258027 E0023456 00000000 00000004 00000000

发送该命令后,硬盘会响应两个 FIS 给 HBA :

  • 第一个是读出的扇区数据 FIS ,长度为 1 dword 的 FIS type + 要读的数据长度 (比如以上命令读了4个扇区,则要读的数据长度是 2048 byte = 512 dword )。注意数据 FIS 的 FIS type 字段是 00000046 。
  • 第二个 FIS 是 5 个 dword 的状态响应 FIS 。

用串口助手进行该读操作,如图7

uart2
图7 : 用串口助手软件来读硬盘(LBA=0x000000023456 , 扇区数量=4)

用DMA方式进行硬盘写

:point_right: 注意!!如果你用电脑上拔下来的硬盘,就尽量不要写,这样会破坏数据,搞不好你的电脑都不能启动了!!请用废旧硬盘进行写操作!!

要进行DMA写,HBA 要发送 5 dword 长度的 DMA 写请求 FIS ,其格式如下:

00358027 E0XXXXXX 00YYYYYY 000000ZZ 00000000

以上FIS中,XXXXXX 是 LBA[23:0] ,YYYYYY 是 LBA[47:24] 。ZZ 是写扇区的数量,一次可以写一个或多个扇区。

例如我们要对 LBA=0x000000000001 进行写,只写 1 个扇区,则 HBA 应该发送命令 FIS :

00358027 E0000001 00000000 00000001 00000000

然后按照命令层的规定,硬盘会响应 1 个 dword 的 DMA active FIS (它只有 FIS type 字段,且固定是 00000039 ,没有 payload ):

00000039

然后 HBA 要发送写数据 FIS 给硬盘,是 1 dword 的 FIS type (00000046) + 1 个扇区(128 dword) 的数据。比如我们想把前三个字节分别写为 AB CD EF ,其余字节写为0,则该 FIS 应为:

00000046 00EFCDAB 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

写数据成功后,磁盘会发送 5 个 dword 的状态响应 FIS 给 HBA 。

用串口助手进行写操作,如图8 。注意数据 FIS 的长度不能多也不能少,否则会被 device 视为错误的 FIS 。

uart3
图8 : 用串口助手软件来读硬盘(LBA=0x000000000001 , 扇区数量=1)

写之后,可以读出来看看写是否成功,这里不再赘述。

关于更多的读写命令,请参考[1] 。

参考资料

[1] SATA Storage Technology : https://www.mindshare.com/Books/Titles/SATA_Storage_Technology

[2] Serial ATA: High Speed Serialized AT Attachment : https://www.seagate.com/support/disc/manuals/sata/sata_im.pdf

[3] Nikola Zlatanov : design of an open-source sata core : https://www.researchgate.net/publication/295010956_Design_of_an_Open-Source_SATA_Core

[4] Louis Woods et al. : Groundhog - A Serial ATA Host Bus Adapter (HBA) for FPGAs : https://ieeexplore.ieee.org/abstract/document/6239818/

[5] 【技术干货】SATA协议浅析:从串行信号到读写硬盘 : https://zhuanlan.zhihu.com/p/554251608?

GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/licenses/why-not-lgpl.html>.

简介

A SATA host (HBA) core based on Xilinx FPGA with GTH. Easy to read/write hard disk. 一个基于Xilinx FPGA中的GTH的SATA host控制器,用来读写硬盘。 展开 收起
Verilog 等 3 种语言
GPL-3.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Verilog
1
https://gitee.com/wangxuan95/FPGA-SATA-HBA.git
git@gitee.com:wangxuan95/FPGA-SATA-HBA.git
wangxuan95
FPGA-SATA-HBA
FPGA-SATA-HBA
main

搜索帮助