Commit ca207808 authored by yilmazt's avatar yilmazt

Debug changes5

parent b31a0b42
......@@ -133,6 +133,14 @@ int main(int argc, char *argv[]) {
nr_polar_init(&nrPolar_params, 1, 21, 1);
nr_polar_init(&nrPolar_params, polarMessageType, testLength, aggregation_level);
nr_polar_print_polarParams(nrPolar_params);
uint32_t in[4];
in[0]=0x01189400;
in[1]=0xffffff0f;
uint8_t *out = malloc(sizeof(uint8_t) * 41);
nr_bit2byte(in, 41, out);
for (int i=0;i<41;i++)
printf("out[%d]=%d\n",i,out[i]);
return (0);
#endif
......
......@@ -21,29 +21,21 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
void nr_byte2bit_uint8(uint8_t *array, uint8_t arraySize, uint8_t *bitArray) {
//First 2 parameters are in bytes.
for (int i = 0; i < arraySize; i++) {
bitArray[(7 + (i * 8))] = (array[i] >> 0 & 0x01);
bitArray[(6 + (i * 8))] = (array[i] >> 1 & 0x01);
bitArray[(5 + (i * 8))] = (array[i] >> 2 & 0x01);
bitArray[(4 + (i * 8))] = (array[i] >> 3 & 0x01);
bitArray[(3 + (i * 8))] = (array[i] >> 4 & 0x01);
bitArray[(2 + (i * 8))] = (array[i] >> 5 & 0x01);
bitArray[(1 + (i * 8))] = (array[i] >> 6 & 0x01);
bitArray[(i * 8)] = (array[i] >> 7 & 0x01);
}
}
void nr_bit2byte(uint32_t *in, uint16_t arraySize, uint8_t *out) {
for (int i = 0; i < arraySize; i++) {
out[i] = ((*in) >> i) & 1;
void nr_bit2byte_uint32_8_t(uint32_t *in, uint16_t arraySize, uint8_t *out) {
uint8_t arrayInd = ceil(arraySize / 32.0);
for (int i = 0; i < arrayInd; i++) {
for (int j = 0; j < 32; j++) {
out[j+(i*32)] = (in[i] >> j) & 1;
}
}
}
void nr_byte2bit(uint8_t *in, uint16_t arraySize, uint32_t *out) {
for (int i = 0; i < arraySize; i++) {
*out = (*out) << i | in[i];
void nr_byte2bit_uint8_32_t(uint8_t *in, uint16_t arraySize, uint32_t *out) {
uint8_t arrayInd = ceil(arraySize / 32.0);
for (int i = 0; i < arrayInd; i++) {
for (int j = 0; j < 32; j++) {
out[i]|=in[j+(i*32)];
out[i]<<=1;
}
}
}
......@@ -113,9 +113,8 @@ void nr_polar_info_bit_pattern(uint8_t *ibp, int16_t *Q_I_N, int16_t *Q_F_N,
void nr_polar_info_bit_extraction(uint8_t *input, uint8_t *output,
uint8_t *pattern, uint16_t size);
void nr_byte2bit(uint8_t *in, uint16_t arraySize, uint32_t *out);
void nr_byte2bit_uint8(uint8_t *array, uint8_t arraySize, uint8_t *bitArray);
void nr_bit2byte(uint32_t *in, uint16_t arraySize, uint8_t *out);
void nr_bit2byte_uint32_8_t(uint32_t *in, uint16_t arraySize, uint8_t *out);
void nr_byte2bit_uint8_32_t(uint8_t *in, uint16_t arraySize, uint32_t *out);
void nr_polar_bit_insertion(uint8_t *input, uint8_t *output, uint16_t N,
uint16_t K, int16_t *Q_I_N, int16_t *Q_PC_N, uint8_t n_PC);
......
......@@ -204,15 +204,15 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
/// DCI payload processing
//channel coding
#ifdef DEBUG_POLAR_PARAMS
dci_alloc.dci_pdu[1]=10;
dci_alloc.dci_pdu[1]=0xffffffff;
uint8_t *encoderInput = malloc(sizeof(uint8_t) * dci_alloc.size);
printf("\n[TY]DCI PDU: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n",
printf("[TY]DCI PDU: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n",
dci_alloc.dci_pdu[0], dci_alloc.dci_pdu[1], dci_alloc.dci_pdu[2], dci_alloc.dci_pdu[3]);
nr_bit2byte(dci_alloc.dci_pdu, dci_alloc.size, encoderInput);
for (int i=0;i<dci_alloc.size;i++)
printf("encoderInput[%d]=%d\n",i,encoderInput[i]);
nr_byte2bit(encoderInput,dci_alloc.size,dci_alloc.dci_pdu);
printf("\n[TY]DCI PDU: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n",
printf("[TY]DCI PDU: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n",
dci_alloc.dci_pdu[0], dci_alloc.dci_pdu[1], dci_alloc.dci_pdu[2], dci_alloc.dci_pdu[3]);
return (0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment