Blame doc/src/fpga_tools/fpgadiag/README.md

Packit 534379
# fpgadiag #
Packit 534379

Packit 534379
## SYNOPSIS ##
Packit 534379
```console
Packit 534379
fpgadiag [-m | --mode=] <mode> [-t | --target=] <target> [options]
Packit 534379
```
Packit 534379

Packit 534379

Packit 534379
## DESCRIPTION ##
Packit 534379
Includes several tests to diagnose, test, and report on the FPGA hardware.
Packit 534379

Packit 534379
```<mode>``` chooses which test to run. 
Packit 534379
```<target>``` specifies the platform that runs the test.
Packit 534379
```<target>``` can be either ```fpga``` or ```ase``` where ```ase```. 
Packit 534379
```<ase>``` is the abbreviation for Accelerator Simulation Environment.
Packit 534379

Packit 534379
The ```<mode>``` selects from the  following tests:
Packit 534379

Packit 534379
**lpbk1**
Packit 534379

Packit 534379
This test runs a loopback test on the number of cachelines specified with 
Packit 534379
the ```BEGIN``` option. ```fpgadiag``` sets up source and  destination buffers in 
Packit 534379
main memory. The FPGA then performs a ```memcpy``` from a source buffer to the 
Packit 534379
destination buffer, one cacheline at a time. 
Packit 534379

Packit 534379
A cacheline is 64 bytes. When `BEGIN = END`, the test performs one iteration. When 
Packit 534379
`BEGIN = END + x`, the test performs `x` iterations. The first iteration consists 
Packit 534379
of copying `BEGIN` cachelines; the second iteration consists of copying 
Packit 534379
`BEGIN+1` cache lines. The third iteration consists of copying `BEGIN+2` 
Packit 534379
cache lines, and so on. 
Packit 534379
    
Packit 534379
The latency is shown as the number of clock cycles. 
Packit 534379
    
Packit 534379
When you specify `MULTI-CL`, you copy `MULTI-CL` cache lines at a time.
Packit 534379
The WR-FENCE chooses on which virtual channel the WrFence occurs.
Packit 534379
     
Packit 534379
    
Packit 534379
If you specify continuous mode with `--cont`, the program iterates
Packit 534379
until the timeout specified in `TIMEOUT` completes.
Packit 534379

Packit 534379

Packit 534379
**read**
Packit 534379

Packit 534379
This test performs reads. Use this test to measure read bandwidth. 
Packit 534379
    
Packit 534379

Packit 534379

Packit 534379
**write** 
Packit 534379

Packit 534379
This test performs writes. Use it to measure write bandwidth. 
Packit 534379

Packit 534379

Packit 534379
**trput**
Packit 534379

Packit 534379
This test measures both read and write bandwidth by performing 50% read and 
Packit 534379
50% write tests.
Packit 534379

Packit 534379

Packit 534379
**sw**
Packit 534379

Packit 534379
This is a send-and-respond (ping-pong) test. One side sends data and 
Packit 534379
waits for response.
Packit 534379

Packit 534379
Each test requires a particular AF. Before running a test,
Packit 534379
make sure the required AF is properly configured
Packit 534379
on the platform. 
Packit 534379

Packit 534379
* The lpbk1 test requires the nlb mode 0 AF.
Packit 534379
* The trput test requires the nlb mode 3 AF. 
Packit 534379
* The sw test requires the nlb mode 7 AF. This AF is only available for the integrated FPGA platform.
Packit 534379
     You cannot run it on the PCIe accelerator card (PAC).
Packit 534379

Packit 534379

Packit 534379
**fpgalpbk**
Packit 534379

Packit 534379
This enable/disable FPGA loopback.
Packit 534379

Packit 534379

Packit 534379
**fpgastats**
Packit 534379

Packit 534379
This get fpga mac statistics.
Packit 534379

Packit 534379

Packit 534379
**mactest**
Packit 534379

Packit 534379
This compare mac addresses that read from MAC ROM with mac addresses read from Host side.
Packit 534379

Packit 534379

Packit 534379
## OPTIONS ##
Packit 534379
### Common options ###
Packit 534379
`--help, -h`
Packit 534379

Packit 534379
    Print help information and exit.
Packit 534379

Packit 534379
`--target=, -t`
Packit 534379

Packit 534379
    This switch specifies fpga (hardware) or ase (simulation). The default=fpga.
Packit 534379

Packit 534379
`--mode=, -m`
Packit 534379

Packit 534379
    The test to run. The valid values are `lpbk1`, `read`,
Packit 534379
    `write`, `trput`, and `sw`.
Packit 534379

Packit 534379
`--config=, -c`
Packit 534379

Packit 534379
    A configuration file in the JSON format that specifies options for a test.
Packit 534379
    If an option is specified both in the configuration file and on the command 
Packit 534379
    line, the value in the configuration file takes precedence.
Packit 534379

Packit 534379
`--dsm-timeout-usec`
Packit 534379

Packit 534379
    Timeout in microseconds for test completion. The test fails if not completed by 
Packit 534379
    specified timeout. The default=1000000.
Packit 534379

Packit 534379
`--socket-id=, -s`
Packit 534379

Packit 534379
    Socket ID encoded in FPGA Interface Manager (FIM). The default=0. 
Packit 534379

Packit 534379
`--bus=, -B`
Packit 534379

Packit 534379
    Bus number of the PCIe device. The default=0. 
Packit 534379

Packit 534379
`--device=, -D`
Packit 534379

Packit 534379
    Device number of the PCIe device. The default=0. 
Packit 534379

Packit 534379
`--function=, -F`
Packit 534379

Packit 534379
    Function number of the PCIe device. The default=0. 
Packit 534379

Packit 534379
`--freq=, -T`
Packit 534379

Packit 534379
    Clock frequency (in Hz) used for bandwidth calculation. The default=400000000 Hz (400 MHz). 
Packit 534379
```eval_rst
Packit 534379
.. note::
Packit 534379
    This frequency is used only when the software cannot infer the frequency from the accelerator.
Packit 534379
```
Packit 534379

Packit 534379
`--suppress-hdr, -S`
Packit 534379

Packit 534379
    Suppress column headers for text output. The default=off.
Packit 534379

Packit 534379
`--csv, -V`
Packit 534379

Packit 534379
    Comma separated value format. The default=off. 
Packit 534379

Packit 534379
`--suppress-stats`
Packit 534379

Packit 534379
    Suppress statistics output at the end of test. The default=off.
Packit 534379

Packit 534379
### **lpbk1** test options ###
Packit 534379
`--guid=, -g`
Packit 534379

Packit 534379
    AFU ID to enumerate. The default=D8424DC4-A4A3-C413-F89E-433683F9040B. 
Packit 534379

Packit 534379
`--begin=B, -b`
Packit 534379

Packit 534379
    1 <= B <= 65535. The default=1, B = number of cache lines. 
Packit 534379

Packit 534379
`--end=E, -e`
Packit 534379

Packit 534379
    1 <= E <= 65535. The default=B, B and E designate number of cache lines. 
Packit 534379

Packit 534379
`--multi-cl=M, -u`
Packit 534379

Packit 534379
    M can equal 1, 2, or 4. The default=1. 
Packit 534379

Packit 534379
`--cont, -L`
Packit 534379

Packit 534379
    Continuous mode. The default=off. 
Packit 534379

Packit 534379
`--timeout-usec=, --timeout-msec=, --timeout-sec=, --timeout-min=, --timeout-hour=`
Packit 534379

Packit 534379
    timeout for --cont mode. The default for all options is 0. 
Packit 534379

Packit 534379
`--cache-policy=, -p`
Packit 534379

Packit 534379
    Can be wrline-I, wrline-M, or wrpush-I The default=wrline-M.
Packit 534379

Packit 534379
`--cache-hint=, -i`
Packit 534379

Packit 534379
    Can be rdline-I or rdline-S. The default=rdline-I.
Packit 534379

Packit 534379
`--read-vc=, -r`
Packit 534379

Packit 534379
    Can be auto, vl0, vh0, vh1, random. The default=auto. 
Packit 534379

Packit 534379
`--write-vc=, -w`
Packit 534379

Packit 534379
    Can be auto, vl0, vh0, vh1, random. The default=auto. 
Packit 534379

Packit 534379
`--wrfence-vc=, -f`
Packit 534379

Packit 534379
    Can be auto, vl0, vh0, vh1. The default=auto. 
Packit 534379

Packit 534379

Packit 534379
### **read** test options ###
Packit 534379
`--guid=, -g`
Packit 534379

Packit 534379
    AFU ID to enumerate. The default=F7DF405C-BD7A-CF72-22F1-44B0B93ACD18. 
Packit 534379

Packit 534379
`--begin=B, -b`
Packit 534379

Packit 534379
    1 <= B <= 65535. The default=1, B = number of cache lines. 
Packit 534379

Packit 534379
`--end=E, -e`
Packit 534379

Packit 534379
    1 <= E <= 65535. The default=B, B and E designate number of cache lines. 
Packit 534379

Packit 534379
`--multi-cl=M, -u`
Packit 534379

Packit 534379
    M can equal 1, 2, or 4. The default=1. 
Packit 534379

Packit 534379
`--strided-access=S, -a`
Packit 534379

Packit 534379
    1<= S <= 64. The default=1. 
Packit 534379

Packit 534379
`--cont, -L`
Packit 534379

Packit 534379
    Continuous mode. The default=off. 
Packit 534379

Packit 534379
`--timeout-usec=, --timeout-msec=, --timeout-sec=, --timeout-min=, --timeout-hour=`
Packit 534379

Packit 534379
    timeout for --cont mode. The default for all options is 0.
Packit 534379

Packit 534379
`--cache-hint=, -i`
Packit 534379

Packit 534379
    Can be rdline-I or rdline-S. The default=rdline-I. 
Packit 534379

Packit 534379
`--warm-fpga-cache -H; --cool-fpga-cache -M`
Packit 534379

Packit 534379
    Try to prime the cache with hits. The default=off. Try to prime the 
Packit 534379
    cache with misses. The default=off.
Packit 534379

Packit 534379
`--cool-cpu-cache, -C`
Packit 534379

Packit 534379
    Try to prime the cpu cache with misses. The default=off. 
Packit 534379

Packit 534379
`--read-vc=, -r`
Packit 534379

Packit 534379
    Can be auto, vl0, vh0, vh1, random. The default=auto 
Packit 534379

Packit 534379

Packit 534379
### **write** test options ###
Packit 534379
`--guid=, -g`
Packit 534379

Packit 534379
    AFU ID to enumerate. The default=F7DF405C-BD7A-CF72-22F1-44B0B93ACD18 
Packit 534379

Packit 534379
`--begin=B, -b`
Packit 534379

Packit 534379
    1 <= E <= 65535. The default=B, B and E designate number of cache lines. 
Packit 534379

Packit 534379
`--multi-cl=M, -u`
Packit 534379

Packit 534379
    M can equal 1, 2, or 4. The default=1.
Packit 534379

Packit 534379
`--strided-access=S, -a`
Packit 534379

Packit 534379
    1<= S <= 64. The default=1.
Packit 534379

Packit 534379
`--cont, -L`
Packit 534379

Packit 534379
    Continuous mode. The default=off.
Packit 534379

Packit 534379
`--timeout-usec=, --timeout-msec=, --timeout-sec=, --timeout-min=, --timeout-hour=`
Packit 534379

Packit 534379
    timeout for --cont mode. The default for all options is 0.
Packit 534379

Packit 534379
`--cache-policy=, -p`
Packit 534379

Packit 534379
    Can be wrline-I, wrline-M, or wrpush-I The default=wrline-M 
Packit 534379

Packit 534379
`--warm-fpga-cache -H; --cool-fpga-cache -M`
Packit 534379

Packit 534379
    Try to prime the cache with hits. The default=off. Try to prime the 
Packit 534379
    cache with misses. The default=off. 
Packit 534379

Packit 534379
`--cool-cpu-cache, -C`
Packit 534379

Packit 534379
    Try to prime the cpu cache with misses. The default=off. 
Packit 534379

Packit 534379
`--write-vc=, -w`
Packit 534379

Packit 534379
    Can be auto, vl0, vh0, vh1, random. The default=auto. 
Packit 534379

Packit 534379
`--wrfence-vc=, -f`
Packit 534379

Packit 534379
    Can be auto, vl0, vh0, vh1, random. The default=`WRITE-VC`.
Packit 534379

Packit 534379
`--alt-wr-pattern, -l`
Packit 534379

Packit 534379
    Alternate Write Pattern. The default=off. 
Packit 534379

Packit 534379

Packit 534379
### **trput** test options ###
Packit 534379
`--guid=, -g`
Packit 534379

Packit 534379
    AFU ID to enumerate. The default=F7DF405C-BD7A-CF72-22F1-44B0B93ACD18.
Packit 534379

Packit 534379
`--begin=B, -b`
Packit 534379

Packit 534379
    1 <= B <= 65535. The default=1, B = number of cache lines. 
Packit 534379

Packit 534379
`--end=E, -e`
Packit 534379

Packit 534379
    1 <= E <= 65535. The default=B, B and E designate number of cache lines. 
Packit 534379

Packit 534379
`--multi-cl=M, -u`
Packit 534379

Packit 534379
    M can equal 1, 2, or 4. The default=1. 
Packit 534379

Packit 534379
`--strided-access=S, -a`
Packit 534379

Packit 534379
    1<= S <= 64. The default=1 
Packit 534379

Packit 534379
`--cont, -L`
Packit 534379

Packit 534379
    Continuous mode. The default=off. 
Packit 534379

Packit 534379
`--timeout-usec=, --timeout-msec=, --timeout-sec=, --timeout-min=, --timeout-hour=`
Packit 534379

Packit 534379
    timeout for --cont mode. The default for all options is 0.
Packit 534379

Packit 534379
`--cache-policy=, -p`
Packit 534379

Packit 534379
    Can be wrline-I, wrline-M, or wrpush-I The default=wrline-M. 
Packit 534379

Packit 534379
`--cache-hint=, -i`
Packit 534379

Packit 534379
    Can be rdline-I or rdline-S. The default=rdline-I. 
Packit 534379

Packit 534379
`--read-vc=, -r`
Packit 534379

Packit 534379
    Can be auto, vl0, vh0, vh1, random. The default=auto. 
Packit 534379

Packit 534379
`--write-vc=, -w`
Packit 534379

Packit 534379
    Can be auto, vl0, vh0, vh1, random. The default=auto. 
Packit 534379

Packit 534379
`--wrfence-vc=, -f`
Packit 534379

Packit 534379
    Can be  auto, vl0, vh0, vh1. The default=`WRITE-VC`.
Packit 534379

Packit 534379

Packit 534379
### **sw** test options ###
Packit 534379
`--guid=, -g`
Packit 534379

Packit 534379
    AFU ID to enumerate. The default=7BAF4DEA-A57C-E91E-168A-455D9BDA88A3. 
Packit 534379

Packit 534379
`--begin=B, -b`
Packit 534379

Packit 534379
    1 <= B <= 65535. The default=1, B = number of cache lines. 
Packit 534379

Packit 534379
`--end=E, -e`
Packit 534379

Packit 534379
    1 <= E <= 65535. The default=B, B and E designate number of cache lines. 
Packit 534379

Packit 534379
`--cache-policy=, -p`
Packit 534379

Packit 534379
    Can be wrline-I, wrline-M, or wrpush-I. The default=wrline-M. 
Packit 534379

Packit 534379
`--cache-hint= -i`
Packit 534379

Packit 534379
    Can be rdline-I or rdline-S. The default=rdline-I. 
Packit 534379

Packit 534379
`--read-vc=, -r`
Packit 534379

Packit 534379
    Can be auto, vl0, vh0, vh1, random The default=auto. 
Packit 534379

Packit 534379
`--write-vc=, -w`
Packit 534379

Packit 534379
    Can be auto, vl0, vh0, vh1, random The default=auto.
Packit 534379

Packit 534379
`--wrfence-vc=, -f`
Packit 534379

Packit 534379
    Can be auto, vl0, vh0, vh1. The default=`WRITE-VC`.
Packit 534379

Packit 534379
`--notice=, -N`
Packit 534379

Packit 534379
    Can be poll or csr-write. The default=poll. 
Packit 534379

Packit 534379

Packit 534379
### **fpgalpbk** test options ###
Packit 534379
`--enable`
Packit 534379

Packit 534379
    Enable fpga phy loopback.
Packit 534379

Packit 534379
`--disable`
Packit 534379

Packit 534379
    Disable fpga phy loopback.
Packit 534379

Packit 534379
`--direction`
Packit 534379

Packit 534379
    Can be local, remote.
Packit 534379

Packit 534379
`--type`
Packit 534379

Packit 534379
    Can be serial, precdr, postcdr.
Packit 534379

Packit 534379
`--side`
Packit 534379

Packit 534379
    Can be line, host.
Packit 534379

Packit 534379
`--port`
Packit 534379

Packit 534379
    0 <= port <= 7, the default is all.
Packit 534379

Packit 534379

Packit 534379
### **mactest** test options ###
Packit 534379
`--offset`
Packit 534379

Packit 534379
    Read mac addresses from an offset, The default=0.
Packit 534379

Packit 534379

Packit 534379
## EXAMPLES ##
Packit 534379
This command starts a `lpbk1` test for the FPGA on bus `0x5e`. The test 
Packit 534379
copies 57535, 57536, 57537 ... up to 65535 cache lines, one line at a time.
Packit 534379
The test prints output in the comma separated values (CSV) format with the
Packit 534379
header suppressed.
Packit 534379
```console
Packit 534379
./fpgadiag --mode=lpbk1 --target=fpga -V --bus=0x5e --begin=57535
Packit 534379
--end=65535 --cache-hint=rdline-I --cache-policy=wrpush-I --multi-cl=1
Packit 534379
--write-vc=vl0 --read-vc=vh1 --wrfence-vc=auto
Packit 534379
```
Packit 534379

Packit 534379
This command starts a `read` test on the FPGA located on bus `0xbe`. The test
Packit 534379
reads 2045 cache lines in the continuous mode with a 15-second timeout period. 
Packit 534379
The reads use a strided pattern with a 10-byte stride length.
Packit 534379
```console
Packit 534379
./fpgadiag --mode=read --target=fpga -V --bus=0xbe --begin=2045 --cont
Packit 534379
--timeout-sec=15 --cache-hint=rdline-I --multi-cl=1 -a=10 
Packit 534379
--read-vc=auto --wrfence-vc=auto
Packit 534379
```
Packit 534379

Packit 534379
This command starts a `sw` test on the FPGA located on bus `0xbe`. The test
Packit 534379
signals completion using a CSR write.
Packit 534379
```console
Packit 534379
./fpgadiag --mode=sw --target=fpga -V --bus=0xbe --begin=4 --end=8192
Packit 534379
--cache-hint=rdline-I --cache-policy=wrline-I --notice=csr-write --write-vc=vl0
Packit 534379
--wrfence-vc=auto --read-vc=random 
Packit 534379
```
Packit 534379

Packit 534379

Packit 534379
This command enable a `fpgalpbk` on the FPGA located on bus `0xbe`.
Packit 534379
```console
Packit 534379
./fpgadiag -m fpgalpbk --bus 0xbe --enable --direction local --type postcdr
Packit 534379
--side host
Packit 534379
```
Packit 534379

Packit 534379

Packit 534379
This command show `fpgastats` on the FPGA located on bus `0xbe`.
Packit 534379
```console
Packit 534379
./fpgadiag -m fpgastats --bus 0xbe
Packit 534379
```
Packit 534379

Packit 534379

Packit 534379
## TROUBLESHOOTING ##
Packit 534379
When a test fails to run or gives errors, check the following:
Packit 534379

Packit 534379
* Is the Intel FPGA driver properly installed? 
Packit 534379
See [Installation Guide](/fpga-doc/docs/install_guide/installation_guide.html) 
Packit 534379
for driver installation instructions.
Packit 534379
* Are FPGA port permissions set properly? Check the permission bits of the
Packit 534379
port, for example, `/dev/intel-fpga-port-0`. You need READ and WRITE
Packit 534379
permissions to run `fpgadiag` tests.
Packit 534379
* Is hugepage properly configured on the system? 
Packit 534379
See [Installation Guide](/fpga-doc/docs/install_guide/installation_guide.html)
Packit 534379
for hugepage configuration steps. In particular, `fpgadiag` requires a few 1 GB
Packit 534379
pages. 
Packit 534379
* Is the required AFU loaded? See [DESCRIPTION](#description) for
Packit 534379
information about what AFU the test requires.
Packit 534379
* Are `--begin` and `--end` values set properly? `--end` must be larger
Packit 534379
than the `--begin`. Also, `--begin` must be a multiple of the
Packit 534379
`--multi-cl` value.
Packit 534379
* The `--warm-fpga-cache` and `--cool-fpga-cache` options in the `read`
Packit 534379
and `write` tests are mutually exclusive.
Packit 534379
* The timeout options are only meaningful for the continuous mode 
Packit 534379
(with the `--cont` option).
Packit 534379

Packit 534379
## Revision History ##
Packit 534379

Packit 534379
| Date | Intel Acceleration Stack Version | Changes Made |
Packit 534379
|:------|----------------------------|:--------------|
Packit 534379
|2018.05.21| DCP 1.1 Beta (works with Quartus Prime Pro 17.1.1) | fpgadiag now reports the correct values for bandwidth. |