README.md (3829B)
1 # MMSE on RISC-V 2 3 Linear Minimum Mean Squared Error (MMSE) Multiple Input Multiple Output (MIMO) detector for RISC-V with support for "V" Vector Extension based on Cholesky decomposition. Supports [ARA](https://www.github.com/pulp-platform/ara) and baremetal. Implements fixed- and floating-point solutions (LDL and LL Cholesky decompositions respectively). Vectorizes along the subcarriers dimension. 4 5 ## Key Concepts 6 7 Multiple user antennas transmit data (`x`) to a base station equiped with multiple receiving antennas. Application of a multiplexing channel `H` and noise `n` yields a received signal vector `y`. Channel and noise estimators support with the channel matrix `H` and a noise covariance matrix `R`. This program implements a detector that approximates `x` from `y`, `H` and `R`. 8 9  10 11 ### Definitions 12 13 - `NUM_RX` - number of receiving antennas. 14 - `NUM_TX` - number of transmitting antennas. 15 - `NUM_SC` - number of subcarriers. 16 - `x` - transmitted signal. 17 - `y` - received signal. 18 - `H` - multiplexing channel matrix. 19 - `n` - noise vector on the receiving antennas. 20 - `R` - noise covariance matrix. 21 22 ### Method 23 24 Find such `x` that `x = G^{-1} H^H y` where G is a Gram matrix defined as `G = (H^H H + R)` and `H^H` is a Hermittian transpose of `H`. This is done in 5 steps: 25 - `cmatgram`: Calculate `G = H^H H + R` 26 - `ccholesky`: Perform Cholesky decomposition (`G=LL^H` or `G=LDL^H`) 27 - `cmatvecmul`: Multiply `H^H` and `y` (`HHy=H^H y`) 28 - `cforwardsub`: Perform forward substitution to find such `z` that `Lz=HHy` 29 - `cbackwardsub`: Perform backward substitution to find such `x` that `z=L^H x` (or `D^{-1} z = L^H x` in case of LDL Cholesky) 30 31 The following data flow diagrams demonstrate element-wise formulas for both LL and LDL based detection: 32  33 34 ## Structure 35 36 Each of the five operations is implemented in its source file in `src`. `main.c` contains memory intialization and cycles measurments for each function. 37 38 `scripts/gen_data.py` generates `x`, `H`, `R` and `n` in `data` directory. `re` and `im` in the names mean real and imaginary parts. Then the data is loaded diectly into the program memory compile-time in `main.c` (thanks to [ChaN](https://elm-chan.org/junk/32bit/binclude.html) for sharing the macro). 39 40 ## Configuration 41 42 Compile by passing configuration parameters to make: 43 44 ``` 45 $ make help 46 47 Usage: 48 make [ARCH=<arch>] [DATA_TYPE=<type>] [PLATFORM=<platform>] [NUM_RX=<num_rx>] [NUM_TX=<num_tx>] [NUM_SC=<num_sc>] 49 50 Supported ARCH values: 51 - x86 (default) 52 - rv 53 - rvv 54 55 Supported DATA_TYPE values: 56 - float (default) 57 - fixed 58 59 Supported PLATFORM values: 60 - linux (default) 61 - ara 62 - baremetal 63 64 Supported NUM_RX values: integers > 0 (default = 4) 65 Supported NUM_TX values: integers > 0 (default = 4) 66 Supported NUM_SC values: integers > 0 (default = 1024) 67 68 Debug mode: 69 - DEBUG=0 (default, optimized with -O1) 70 - DEBUG=1 (debug mode with -g -O0) 71 ``` 72 73 - `ARCH`: 74 - `x86` - (x86-64) for testing purposes. Sequential solution, no vectorization. 75 - `rv` - RISC-V 64 (rv64) without "V" extension. Sequential solution, no vectorization. 76 - `rvv` - rv64v. Vectorized solution. 77 - `DATA_TYPE`: 78 - `float` - all the data and computation is done with `float`. Requires "F" extension. Uses LL Cholesky. 79 - `fixed` - Q31 fixed-point. Uses LDL Cholesky. 80 - `PLATFORM` - this parameter currently only affects `printf`: 81 - `linux` - `printf` from `<stdio.h>` 82 - `ara` - ARA's `printf` from `apps/common`. Assumes the repository is in the `apps` directory`. 83 - `baremental` - simple UART printf strictly to output the cycles as used in `main.c`. **NOT IMPLEMENTED YET**. 84 85 Running `make` with the given parameters will create `build` directory and an `.elf` with the parameters in its name.