mmserv

Minimum Mean Square Error detection on RISC-V Vector Extention
git clone https://git.ea.contact/mmserv
Log | Files | Refs | README

commit d838f0bd87ace7c216a57728eab59694b9fb996a
parent 682afabb30308f125ac566eca89c1401085c0146
Author: Egor Achkasov <eaachkasov@edu.hse.ru>
Date:   Mon, 11 Nov 2024 10:44:49 +0100

Remove file input and output

Diffstat:
M.gitignore | 1+
Minclude/mmserv.h | 24------------------------
Mmain.c | 24++++++++++--------------
Msrc/mmserv.c | 43-------------------------------------------
4 files changed, 11 insertions(+), 81 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -7,3 +7,4 @@ obj *__pycache__* .gdb_history *.o +mmse diff --git a/include/mmserv.h b/include/mmserv.h @@ -5,7 +5,6 @@ #include <stdint.h> // for int16_t, int32_t #include <stddef.h> // for size_t -#include <stdio.h> // for FILE /* * Typedefs @@ -175,27 +174,4 @@ void cbackwardsub_TxTx( IN complex b[NUM_TX_ANT][NUM_SC], OUT complex result[NUM_TX_ANT][NUM_SC]); -/* - * IO - */ - -/** Load data from a binary file - * \param file path to the file - * \param size number of elements to read - * \param out output array - */ -void load_data( - IN const char *file, - IN size_t size, - OUT data_t *out); - -/** Save data to a binary file - * \param file path to the file - * \param x_mmse data to save - */ -void save_data( - IN const char* file, - IN data_t x_mmse[NUM_TX_ANT][NUM_SC][2]); - - #endif /* __MMSERV_H */ diff --git a/main.c b/main.c @@ -1,20 +1,14 @@ #include "include/mmserv.h" -int main() { - uint32_t i, j, k; +#include "printf.h" - /* Load the data */ - data_t x_raw[NUM_TX_ANT][NUM_SC][2]; /* Transmitted signal */ - data_t H_raw[NUM_RX_ANT][NUM_TX_ANT][NUM_SC][2]; /* Channel */ - data_t R_raw[NUM_TX_ANT][NUM_TX_ANT][NUM_SC][2]; /* Noise covariance matrix */ - data_t y_raw[NUM_RX_ANT][NUM_SC][2]; /* Received signal */ +extern data_t x_raw[NUM_TX_ANT][NUM_SC][2]; /* Transmitted signal */ +extern data_t H_raw[NUM_RX_ANT][NUM_TX_ANT][NUM_SC][2]; /* Channel */ +extern data_t R_raw[NUM_TX_ANT][NUM_TX_ANT][NUM_SC][2]; /* Noise covariance matrix */ +extern data_t y_raw[NUM_RX_ANT][NUM_SC][2]; /* Received signal */ -#ifndef ARA - load_data("data/x.bin", NUM_TX_ANT*NUM_SC*2, x_raw); - load_data("data/H.bin", NUM_RX_ANT*NUM_TX_ANT*NUM_SC*2, H_raw); - load_data("data/R.bin", NUM_TX_ANT*NUM_RX_ANT*NUM_SC*2, R_raw); - load_data("data/y.bin", NUM_RX_ANT*NUM_SC*2, y_raw); -#endif +int main() { + uint32_t i, j, k; /* Cast the data into complex data structures */ complex x[NUM_TX_ANT][NUM_SC]; @@ -57,5 +51,7 @@ int main() { } /* Save the result */ - save_data("out/x_mmse.bin", res); + for (i = 0; i < NUM_TX_ANT; ++i) + for (j = 0; j < NUM_SC; ++j) + printf("%f %f %f %f\n", i, j, res[i][j][0], res[i][j][1]); } diff --git a/src/mmserv.c b/src/mmserv.c @@ -1,7 +1,5 @@ #include "../include/mmserv.h" -#include <stdlib.h> // for exit - /* * Complex functions */ @@ -283,47 +281,6 @@ void cbackwardsub_TxTx( } /* - * IO - */ - -void load_data( - IN const char* file, - IN size_t size, - OUT data_t *out) -{ - FILE *fp = fopen(file, "rb"); - - if (fp == NULL) { - fprintf(stderr, "Error opening file %s.\n", file); - exit(8); - } - if ((fread(out, sizeof(data_t), size, fp)) != size) { - fprintf(stderr, "Error reading file %s.\n", file); - exit(8); - } - - fclose(fp); -} - -void save_data( - IN const char* file, - IN data_t x_mmse[NUM_TX_ANT][NUM_SC][2]) -{ - FILE *fp = fopen(file, "wb"); - - if (fp == NULL) { - fprintf(stderr, "Error opening file %s.\n", file); - exit(8); - } - if ((fwrite(x_mmse, sizeof(data_t), NUM_TX_ANT*NUM_SC*2, fp)) != NUM_TX_ANT*NUM_SC*2) { - fprintf(stderr, "Error writing file %s.\n", file); - exit(8); - } - - fclose(fp); -} - -/* * MMSE */