Compare commits

...

11 Commits

Author SHA1 Message Date
Jaroslava Fiedlerova
62319631aa Interleaving: unify logic for multiple Qm cases 2024-12-16 15:55:57 +01:00
Jaroslava Fiedlerova
fd0cc8210f Use pointers in scrambling function 2024-12-12 22:42:39 +01:00
Jaroslava Fiedlerova
8f4298a9ff Cleanup and minor modif of nr_segmentation
for testing
2024-12-12 22:25:49 +01:00
Jaroslava Fiedlerova
d3e1672da5 T2: one more simde optim for T2 encoder 2024-12-12 14:04:54 +01:00
Jaroslava Fiedlerova
6931857700 T2: try uint32_t output of interleaving
This commit speeds up processing of CPU encoder, however slows down processing of T2 output.
2024-12-12 10:30:44 +01:00
Jaroslava Fiedlerova
5d106ad6a8 T2: try encoder with simde 2024-12-12 10:30:44 +01:00
Jaroslava Fiedlerova
aac022cc0d T2: encoder offset correction 2024-12-12 10:30:44 +01:00
Jaroslava Fiedlerova
ea304f0994 Fix misalignment issue reported by undefined behavior sanitizer
/home/eurecom/jaroslava/develop.testben550/openair1/PHY/CODING/nrPolar_tools/nr_polar_init.c:103:21: runtime error: store to misaligned address 0x557b0ec188f0 for type 'struct t_nrPolar_params', which requires 32 byte alignment
0x557b0ec188f0: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
2024-12-12 10:30:44 +01:00
Jaroslava Fiedlerova
f4177c5596 Fix misalignment issue reported by undefined behavior sanitizer
/home/eurecom/jaroslava/develop.testben550/openair1/SIMULATION/NR_PHY/dlsim.c:997:37: runtime error: member access within misaligned address 0x7fbbd0df8010 for type 'struct NR_Sched_Rsp_t', which requires 32 byte alignment
0x7fbbd0df8010: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
2024-12-12 10:30:44 +01:00
Jaroslava Fiedlerova
eaf8a99e55 Harmonize T2 and CPU encoding
There are several changes introduced in this commit:
- rework interleaving function to provide 8b packed output
- modify scrambling function to process packed input
- flip an endian of the output buffer in retrieve_ldpc_enc_op() of T2 - this allows
  us to use same scrambling function for both CPU and T2 encoder
2024-12-12 10:30:44 +01:00
Jaroslava Fiedlerova
0c7e6b4059 Use packed output of the T2 encoder
Modify retrieve_ldpc_enc_op() to store packed results in the encoder output
buffer. Add new scrambling function for processing packed input.

Works only with T2, initial commit, for testing purpose.
2024-12-12 10:30:44 +01:00
19 changed files with 172 additions and 383 deletions

View File

@@ -467,7 +467,7 @@ int32_t nr_segmentation(unsigned char *input_buffer,
unsigned int *F,
uint8_t BG);
void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f);
void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint32_t *f, int start_idx);
void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f);

View File

@@ -122,6 +122,7 @@ struct thread_params {
struct nrLDPCoffload_params *p_offloadParams;
uint8_t iter_count;
uint8_t *p_out;
uint32_t *p_out_enc;
uint8_t ulsch_id;
rte_atomic16_t nb_dequeued;
rte_atomic16_t processing_status;
@@ -593,29 +594,51 @@ static int retrieve_ldpc_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
return 0;
}
static int retrieve_ldpc_enc_op(struct rte_bbdev_enc_op **ops, const uint16_t n, uint8_t *p_out, nrLDPC_params_per_cb_t *perCB)
static int retrieve_ldpc_enc_op(struct rte_bbdev_enc_op **ops, const uint16_t n, uint32_t *p_out, nrLDPC_params_per_cb_t *perCB)
{
int offset = 0;
int bit_offset = 0;
size_t simd_width = 16;
uint8_t p_out_tmp[n * 32768];
for (int i = 0; i < n; ++i) {
struct rte_bbdev_op_data *output = &ops[i]->ldpc_enc.output;
struct rte_mbuf *m = output->data;
uint16_t data_len = rte_pktmbuf_data_len(m) - output->offset;
uint8_t *out = &p_out[offset];
const char *data = m->buf_addr + m->data_off;
const char *end = data + data_len;
while (data < end) {
uint8_t byte = *data++; // get the current byte
for (int bit = 7; bit >= 0; --bit) {
*out++ = (byte >> bit) & 1; // extract each bit
uint8_t *data = m->buf_addr + m->data_off;
if (bit_offset == 0) {
for (size_t i = 0; i <= data_len; i += simd_width) {
simde__m128i current = simde_mm_loadu_si128((simde__m128i*)(&data[i]));
simde_mm_storeu_si128((simde__m128i*)(&p_out_tmp[(offset + i)]), current);
}
} else {
p_out_tmp[offset - 1] |= data[0] >> bit_offset;
for (size_t i = 0; i <= data_len; i += simd_width) {
simde__m128i current = simde_mm_loadu_si128((simde__m128i*)(&data[i]));
simde__m128i next = simde_mm_loadu_si128((simde__m128i*)(&data[i + 1]));
simde__m128i right_shifted = simde_mm_srli_epi16(next, bit_offset);
simde__m128i left_shifted = simde_mm_slli_epi16(current, 8 - bit_offset);
simde__m128i combined = simde_mm_or_si128(
simde_mm_and_si128(right_shifted, simde_mm_set1_epi8(0xFF >> (bit_offset))),
simde_mm_and_si128(left_shifted, simde_mm_set1_epi8(0xFF << (8 - bit_offset)))
);
simde_mm_storeu_si128((simde__m128i*)(&p_out_tmp[(offset + i)]), combined);
}
}
offset += perCB[i].E_cb;
bit_offset = (perCB[i].E_cb - 8 + bit_offset) % 8;
offset += (perCB[i].E_cb + bit_offset) / 8;
rte_pktmbuf_free(m);
rte_pktmbuf_free(ops[i]->ldpc_enc.input.data);
}
reverse_bits_u8(p_out_tmp, offset, p_out_tmp);
const int roundedSz = (offset + 3) / 4;
for (int i = 0; i < roundedSz; i += simd_width / sizeof(uint32_t)) {
simde__m128i data = simde_mm_loadu_si128((simde__m128i*)&p_out_tmp[i * 4]);
simde_mm_storeu_si128((simde__m128i*)&p_out[i], data);
}
return 0;
}
// based on DPDK BBDEV init_test_op_params
static int init_test_op_params(struct test_op_params *op_params,
enum rte_bbdev_op_type op_type,
@@ -717,7 +740,7 @@ static int pmd_lcore_ldpc_enc(void *arg)
int ret;
struct data_buffers *bufs = NULL;
uint16_t num_to_enq;
uint8_t *p_out = tp->p_out;
uint32_t *p_out = tp->p_out_enc;
t_nrLDPCoffload_params *p_offloadParams = tp->p_offloadParams;
AssertFatal((num_segments < MAX_BURST), "BURST_SIZE should be <= %u", MAX_BURST);
@@ -805,7 +828,7 @@ int start_pmd_dec(struct active_device *ad,
int32_t start_pmd_enc(struct active_device *ad,
struct test_op_params *op_params,
t_nrLDPCoffload_params *p_offloadParams,
uint8_t *p_out)
uint32_t *p_out)
{
unsigned int lcore_id, used_cores = 0;
uint16_t num_lcores;
@@ -818,7 +841,7 @@ int32_t start_pmd_enc(struct active_device *ad,
t_params[0].op_params = op_params;
t_params[0].queue_id = ad->enc_queue;
t_params[0].iter_count = 0;
t_params[0].p_out = p_out;
t_params[0].p_out_enc = p_out;
t_params[0].p_offloadParams = p_offloadParams;
used_cores++;
// For now, we never enter here, we don't use the DPDK thread pool
@@ -998,6 +1021,7 @@ int32_t LDPCencoder(unsigned char **input, unsigned char **output, encoder_imple
.F = impp->F,
.Qm = impp->Qm,
.C = impp->n_segments,
.p_out = impp->output,
.Kr = (impp->K - impp->F + 7) / 8};
for (int r = 0; r < impp->n_segments; r++) {
offloadParams.perCB[r].E_cb = impp->perCB[r].E_cb;
@@ -1035,7 +1059,7 @@ int32_t LDPCencoder(unsigned char **input, unsigned char **output, encoder_imple
info.drv.min_alignment);
AssertFatal(ret == 0, "Couldn't init rte_bbdev_op_data structs");
}
ret = start_pmd_enc(ad, op_params, &offloadParams, *output);
ret = start_pmd_enc(ad, op_params, &offloadParams, offloadParams.p_out);
pthread_mutex_unlock(&encode_mutex);
return ret;
}

View File

@@ -120,6 +120,7 @@ typedef struct nrLDPCoffload_params {
uint8_t C;
uint8_t numMaxIter;
uint8_t setCombIn;
uint32_t* p_out;
nrLDPC_params_per_cb_t perCB[NR_LDPC_MAX_NUM_CB];
} t_nrLDPCoffload_params;

View File

@@ -52,7 +52,7 @@ typedef struct {
/// Encoder BG
uint8_t BG;
/// Interleaver outputs
unsigned char *output;
uint32_t *output;
/// Number of bits in "small" code segments
uint32_t K;
/// Number of "Filler" bits

View File

@@ -97,7 +97,7 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui
// printf("currentPtr %p (polarParams %p)\n",currentPtr,polarParams);
// Else, initialize and add node to the end of the linked list.
t_nrPolar_params *newPolarInitNode = malloc(sizeof(t_nrPolar_params));
t_nrPolar_params *newPolarInitNode = aligned_alloc(32, sizeof(t_nrPolar_params));
AssertFatal(newPolarInitNode, "[nr_polar_init] New t_nrPolar_params * could not be created");
*newPolarInitNode = (t_nrPolar_params){.busy = true, .nextPtr = PolarList, .tree_linearization.is_initialized = false};

View File

@@ -33,280 +33,67 @@
static const uint8_t index_k0[2][4] = {{0, 17, 33, 56}, {0, 13, 25, 43}};
void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f)
{
uint32_t EQm;
void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e, uint32_t *f, int start_idx) {
uint32_t EQm = (E + Qm - 1) / Qm;
uint32_t byte_idx = start_idx / 32;
uint8_t bit_idx = start_idx % 32;
uint32_t *fp = &f[byte_idx];
EQm = E/Qm;
memset(f,0,E*sizeof(uint8_t));
uint8_t *e0,*e1,*e2,*e3,*e4,*e5,*e6,*e7;
uint8_t *fp;
#if 0 //def __WASAVX2__
simde__m256i tmp0,tmp1,tmp2,tmp0b,tmp1b,tmp3,tmp4,tmp5;
simde__m256i *e0_256,*e1_256,*e2_256,*e3_256,*e4_256,*e5_256,*e6_256,*e7_256;
simde__m256i *f_256=(simde__m256i *)f;
uint8_t *fp2;
switch(Qm) {
case 2:
e0=e;
e1=e0+EQm;
e0_256=(simde__m256i *)e0;
e1_256=(simde__m256i *)e1;
for (int k=0,j=0;j<EQm>>5;j++,k+=2) {
f_256[k] = simde_mm256_unpacklo_epi8(e0_256[j],e1_256[j]);
f_256[k+1] = simde_mm256_unpackhi_epi8(e0_256[j],e1_256[j]);
}
break;
case 4:
e0=e;
e1=e0+EQm;
e2=e1+EQm;
e3=e2+EQm;
e0_256=(simde__m256i *)e0;
e1_256=(simde__m256i *)e1;
e2_256=(simde__m256i *)e2;
e3_256=(simde__m256i *)e3;
for (int k=0,j=0;j<EQm>>5;j++,k+=4) {
tmp0 = simde_mm256_unpacklo_epi8(e0_256[j],e1_256[j]); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+15) e1(i+15)
tmp1 = simde_mm256_unpacklo_epi8(e2_256[j],e3_256[j]); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+15) e3(i+15)
f_256[k] = simde_mm256_unpacklo_epi8(tmp0,tmp1); // e0(i) e1(i) e2(i) e3(i) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
f_256[k+1] = simde_mm256_unpackhi_epi8(tmp0,tmp1); // e0(i+8) e1(i+8) e2(i+8) e3(i+8) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15)
tmp0 = simde_mm256_unpackhi_epi8(e0_256[j],e1_256[j]); // e0(i+16) e1(i+16) e0(i+17) e1(i+17) .... e0(i+31) e1(i+31)
tmp1 = simde_mm256_unpackhi_epi8(e2_256[j],e3_256[j]); // e2(i+16) e3(i+16) e2(i+17) e3(i+17) .... e2(i+31) e3(i+31)
f_256[k+2] = simde_mm256_unpacklo_epi8(tmp0,tmp1);
f_256[k+3] = simde_mm256_unpackhi_epi8(tmp0,tmp1);
case 8:
uint32_t i = 0;
if (bit_idx > 0) {
for (; i < EQm && bit_idx< 32; i++) {
for (uint8_t j = 0; j < Qm; j++, bit_idx++) {
uint32_t extracted_bit = e[j * EQm + i] & 0x01;
*fp |= (extracted_bit << bit_idx);
}
}
fp++;
bit_idx = 0;
}
for (; i < EQm; i += 16) {
simde__m128i combined = simde_mm_setzero_si128();
for (uint8_t k = 0; k < Qm; k++) {
simde__m128i load = simde_mm_loadu_si128((simde__m128i*)(&e[k * EQm + i]));
simde__m128i shifted = simde_mm_slli_epi16(load, k);
combined = simde_mm_or_si128(shifted, combined);
}
for (uint8_t k = 0; k < 16; ++k) {
uint32_t extracted_bits = simde_mm_extract_epi8(combined, k);
*fp |= (extracted_bits << (bit_idx));
bit_idx += Qm;
if (bit_idx >= 32) {
bit_idx = 0;
fp++;
}
}
}
break;
case 6:
e0=e;
e1=e0+EQm;
e2=e1+EQm;
e3=e2+EQm;
e4=e3+EQm;
e5=e4+EQm;
e0_256=(simde__m256i *)e0;
e1_256=(simde__m256i *)e1;
e2_256=(simde__m256i *)e2;
e3_256=(simde__m256i *)e3;
e4_256=(simde__m256i *)e4;
e5_256=(simde__m256i *)e5;
for (int j=0,k=0;j<EQm>>5;j++,k+=192) {
fp = f+k;
fp2 = fp+96;
tmp0 = simde_mm256_unpacklo_epi8(e0_256[j],e1_256[j]); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+15) e1(i+15)
tmp1 = simde_mm256_unpacklo_epi8(e2_256[j],e3_256[j]); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+15) e3(i+15)
tmp0b = simde_mm256_unpacklo_epi16(tmp0,tmp1); // e0(i) e1(i) e2(i) e3(i) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
tmp1b = simde_mm256_unpackhi_epi16(tmp0,tmp1); // e0(i+8) e1(i+8) e2(i+8) e3(i+8) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15)
tmp0 = simde_mm256_unpacklo_epi8(e4_256[j],e5_256[j]); // e4(i) e5(i) e4(i+1) e5(i+1) .... e4(i+15) e5(i+15)
*((uint32_t*)fp) = simde_mm256_extract_epi32(tmp0b,0);
*((uint16_t*)(fp+4)) = simde_mm256_extract_epi16(tmp0,0);
*((uint32_t*)(fp+6)) = simde_mm256_extract_epi32(tmp0b,1);
*((uint16_t*)(fp+10)) = simde_mm256_extract_epi16(tmp0,1);
*((uint32_t*)(fp+12)) = simde_mm256_extract_epi32(tmp0b,2);
*((uint16_t*)(fp+16)) = simde_mm256_extract_epi16(tmp0,2);
*((uint32_t*)(fp+18)) = simde_mm256_extract_epi32(tmp0b,3);
*((uint16_t*)(fp+22)) = simde_mm256_extract_epi16(tmp0,3);
*((uint32_t*)(fp+24)) = simde_mm256_extract_epi32(tmp0b,4);
*((uint16_t*)(fp+26)) = simde_mm256_extract_epi16(tmp0,4);
*((uint32_t*)(fp+30)) = simde_mm256_extract_epi32(tmp0b,5);
*((uint16_t*)(fp+34)) = simde_mm256_extract_epi16(tmp0,5);
*((uint32_t*)(fp+36)) = simde_mm256_extract_epi32(tmp0,6);
*((uint16_t*)(fp+40)) = simde_mm256_extract_epi16(tmp0,6);
*((uint32_t*)(fp+42)) = simde_mm256_extract_epi32(tmp0b,7);
*((uint16_t*)(fp+46)) = simde_mm256_extract_epi16(tmp0,7);
*((uint32_t*)(fp+48)) = simde_mm256_extract_epi32(tmp1b,0);
*((uint16_t*)(fp+52)) = simde_mm256_extract_epi16(tmp0,8);
*((uint32_t*)(fp+56)) = simde_mm256_extract_epi32(tmp1b,1);
*((uint16_t*)(fp+60)) = simde_mm256_extract_epi16(tmp0,9);
*((uint32_t*)(fp+62)) = simde_mm256_extract_epi32(tmp1b,2);
*((uint16_t*)(fp+66)) = simde_mm256_extract_epi16(tmp0,10);
*((uint32_t*)(fp+68)) = simde_mm256_extract_epi32(tmp1b,3);
*((uint16_t*)(fp+72)) = simde_mm256_extract_epi16(tmp0,11);
*((uint32_t*)(fp+74)) = simde_mm256_extract_epi32(tmp1b,4);
*((uint16_t*)(fp+76)) = simde_mm256_extract_epi16(tmp0,12);
*((uint32_t*)(fp+80)) = simde_mm256_extract_epi32(tmp1b,5);
*((uint16_t*)(fp+82)) = simde_mm256_extract_epi16(tmp0,13);
*((uint32_t*)(fp+86)) = simde_mm256_extract_epi32(tmp1b,6);
*((uint16_t*)(fp+90)) = simde_mm256_extract_epi16(tmp0,14);
*((uint32_t*)(fp+92)) = simde_mm256_extract_epi32(tmp1b,7);
*((uint16_t*)(fp+94)) = simde_mm256_extract_epi16(tmp0,15);
tmp0 = simde_mm256_unpackhi_epi8(e0_256[j],e1_256[j]); // e0(i+16) e1(i+16) e0(i+17) e1(i+17) .... e0(i+31) e1(i+31)
tmp1 = simde_mm256_unpackhi_epi8(e2_256[j],e3_256[j]); // e2(i+16) e3(i+16) e2(i+17) e3(i+17) .... e2(i+31) e3(i+31)
tmp0b = simde_mm256_unpacklo_epi16(tmp0,tmp1); // e0(i+16) e1(i+16) e2(i+16) e3(i+16) ... e0(i+23) e1(i+23) e2(i+23) e3(i+23)
tmp1b = simde_mm256_unpackhi_epi16(tmp0,tmp1); // e0(i+24) e1(i+24) e2(i+24) e3(i+24) ... e0(i+31) e1(i+31) e2(i+31) e3(i+31)
tmp0 = simde_mm256_unpackhi_epi8(e4_256[j],e5_256[j]); // e4(i+16) e5(i+16) e4(i+17) e5(i+17) .... e4(i+31) e5(i+31)
*((uint32_t*)fp2) = simde_mm256_extract_epi32(tmp0b,0);
*((uint16_t*)(fp2+4)) = simde_mm256_extract_epi16(tmp0,0);
*((uint32_t*)(fp2+6)) = simde_mm256_extract_epi32(tmp0b,1);
*((uint16_t*)(fp2+10)) = simde_mm256_extract_epi16(tmp0,1);
*((uint32_t*)(fp2+12)) = simde_mm256_extract_epi32(tmp0b,2);
*((uint16_t*)(fp2+16)) = simde_mm256_extract_epi16(tmp0,2);
*((uint32_t*)(fp2+18)) = simde_mm256_extract_epi32(tmp0b,3);
*((uint16_t*)(fp2+22)) = simde_mm256_extract_epi16(tmp0,3);
*((uint32_t*)(fp2+24)) = simde_mm256_extract_epi32(tmp0b,4);
*((uint16_t*)(fp2+26)) = simde_mm256_extract_epi16(tmp0,4);
*((uint32_t*)(fp2+30)) = simde_mm256_extract_epi32(tmp0b,5);
*((uint16_t*)(fp2+34)) = simde_mm256_extract_epi16(tmp0,5);
*((uint32_t*)(fp2+36)) = simde_mm256_extract_epi32(tmp0,6);
*((uint16_t*)(fp2+40)) = simde_mm256_extract_epi16(tmp0,6);
*((uint32_t*)(fp2+42)) = simde_mm256_extract_epi32(tmp0b,7);
*((uint16_t*)(fp2+46)) = simde_mm256_extract_epi16(tmp0,7);
*((uint32_t*)(fp2+48)) = simde_mm256_extract_epi32(tmp1b,0);
*((uint16_t*)(fp2+52)) = simde_mm256_extract_epi16(tmp0,8);
*((uint32_t*)(fp2+56)) = simde_mm256_extract_epi32(tmp1b,1);
*((uint16_t*)(fp2+60)) = simde_mm256_extract_epi16(tmp0,9);
*((uint32_t*)(fp2+62)) = simde_mm256_extract_epi32(tmp1b,2);
*((uint16_t*)(fp2+66)) = simde_mm256_extract_epi16(tmp0,10);
*((uint32_t*)(fp2+68)) = simde_mm256_extract_epi32(tmp1b,3);
*((uint16_t*)(fp2+72)) = simde_mm256_extract_epi16(tmp0,11);
*((uint32_t*)(fp2+74)) = simde_mm256_extract_epi32(tmp1b,4);
*((uint16_t*)(fp2+76)) = simde_mm256_extract_epi16(tmp0,12);
*((uint32_t*)(fp2+80)) = simde_mm256_extract_epi32(tmp1b,5);
*((uint16_t*)(fp2+82)) = simde_mm256_extract_epi16(tmp0,13);
*((uint32_t*)(fp2+86)) = simde_mm256_extract_epi32(tmp1b,6);
*((uint16_t*)(fp2+90)) = simde_mm256_extract_epi16(tmp0,14);
*((uint32_t*)(fp2+92)) = simde_mm256_extract_epi32(tmp1b,7);
*((uint16_t*)(fp2+94)) = simde_mm256_extract_epi16(tmp0,15);
for (uint32_t i = 0; i < EQm; i++) {
uint32_t packed_bits = ((e[i] & 0x01) << 0) |
((e[i + EQm] & 0x01) << 1) |
((e[i + 2 * EQm] & 0x01) << 2) |
((e[i + 3 * EQm] & 0x01) << 3) |
((e[i + 4 * EQm] & 0x01) << 4) |
((e[i + 5 * EQm] & 0x01) << 5);
*fp |= (packed_bits << bit_idx);
bit_idx += 6;
if (bit_idx >= 32) {
fp++;
bit_idx -= 32;
if (bit_idx > 0)
*fp |= (packed_bits >> (6 - bit_idx));
}
}
break;
case 8:
e0=e;
e1=e0+EQm;
e2=e1+EQm;
e3=e2+EQm;
e4=e3+EQm;
e5=e4+EQm;
e6=e5+EQm;
e7=e6+EQm;
e0_256=(simde__m256i *)e0;
e1_256=(simde__m256i *)e1;
e2_256=(simde__m256i *)e2;
e3_256=(simde__m256i *)e3;
e4_256=(simde__m256i *)e4;
e5_256=(simde__m256i *)e5;
e6_256=(simde__m256i *)e6;
e7_256=(simde__m256i *)e7;
for (int k=0,j=0;j<EQm>>5;j++,k+=8) {
tmp0 = simde_mm256_unpacklo_epi8(e0_256[j],e1_256[j]); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+15) e1(i+15)
tmp1 = simde_mm256_unpacklo_epi8(e2_256[j],e3_256[j]); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+15) e3(i+15)
tmp2 = simde_mm256_unpacklo_epi8(e4_256[j],e5_256[j]); // e4(i) e5(i) e4(i+1) e5(i+1) .... e4(i+15) e5(i+15)
tmp3 = simde_mm256_unpacklo_epi8(e6_256[j],e7_256[j]); // e6(i) e7(i) e6(i+1) e7(i+1) .... e6(i+15) e7(i+15)
tmp4 = simde_mm256_unpacklo_epi16(tmp0,tmp1); // e0(i) e1(i) e2(i) e3(i) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
tmp5 = simde_mm256_unpacklo_epi16(tmp2,tmp3); // e4(i) e5(i) e6(i) e7(i) ... e4(i+7) e5(i+7) e6(i+7) e7(i+7)
f_256[k] = simde_mm256_unpacklo_epi16(tmp4,tmp5); // e0(i) e1(i) e2(i) e3(i) e4(i) e5(i) e6(i) e7(i)... e0(i+3) e1(i+3) e2(i+3) e3(i+3) e4(i+3) e5(i+3) e6(i+3) e7(i+3))
f_256[k+1] = simde_mm256_unpackhi_epi16(tmp4,tmp5); // e0(i+4) e1(i+4) e2(i+4) e3(i+4) e4(i+4) e5(i+4) e6(i+4) e7(i+4)... e0(i+7) e1(i+7) e2(i+7) e3(i+7) e4(i+7) e5(i+7) e6(i+7) e7(i+7))
tmp4 = simde_mm256_unpackhi_epi16(tmp0,tmp1); // e0(i+8) e1(i+8) e2(i+8) e3(i+8) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15)
tmp5 = simde_mm256_unpackhi_epi16(tmp2,tmp3); // e4(i+8) e5(i+8) e6(i+8) e7(i+8) ... e4(i+15) e5(i+15) e6(i+15) e7(i+15)
f_256[k+2] = simde_mm256_unpacklo_epi16(tmp4,tmp5); // e0(i+8) e1(i+8) e2(i+8) e3(i+8) e4(i+8) e5(i+8) e6(i+8) e7(i+8)... e0(i+11) e1(i+11) e2(i+11) e3(i+11) e4(i+11) e5(i+11) e6(i+11) e7(i+11))
f_256[k+3] = simde_mm256_unpackhi_epi16(tmp4,tmp5); // e0(i+12) e1(i+12) e2(i+12) e3(i+12) e4(i+12) e5(i+12) e6(i+12) e7(i+12)... e0(i+15) e1(i+15) e2(i+15) e3(i+15) e4(i+15) e5(i+15) e6(i+15) e7(i+15))
tmp0 = simde_mm256_unpackhi_epi8(e0_256[j],e1_256[j]); // e0(i+16) e1(i+16) e0(i+17) e1(i+17) .... e0(i+31) e1(i+31)
tmp1 = simde_mm256_unpackhi_epi8(e2_256[j],e3_256[j]); // e2(i+16) e3(i+16) e2(i+17) e3(i+17) .... e2(i+31) e3(i+31)
tmp2 = simde_mm256_unpackhi_epi8(e4_256[j],e5_256[j]); // e4(i+16) e5(i+16) e4(i+17) e5(i+17) .... e4(i+31) e5(i+31)
tmp3 = simde_mm256_unpackhi_epi8(e6_256[j],e7_256[j]); // e6(i+16) e7(i+16) e6(i+17) e7(i+17) .... e6(i+31) e7(i+31)
tmp4 = simde_mm256_unpacklo_epi16(tmp0,tmp1); // e0(i+!6) e1(i+16) e2(i+16) e3(i+16) ... e0(i+23) e1(i+23) e2(i+23) e3(i+23)
tmp5 = simde_mm256_unpacklo_epi16(tmp2,tmp3); // e4(i+16) e5(i+16) e6(i+16) e7(i+16) ... e4(i+23) e5(i+23) e6(i+23) e7(i+23)
f_256[k+4] = simde_mm256_unpacklo_epi16(tmp4,tmp5); // e0(i+16) e1(i+16) e2(i+16) e3(i+16) e4(i+16) e5(i+16) e6(i+16) e7(i+16)... e0(i+19) e1(i+19) e2(i+19) e3(i+19) e4(i+19) e5(i+19) e6(i+19) e7(i+19))
f_256[k+5] = simde_mm256_unpackhi_epi16(tmp4,tmp5); // e0(i+20) e1(i+20) e2(i+20) e3(i+20) e4(i+20) e5(i+20) e6(i+20) e7(i+20)... e0(i+23) e1(i+23) e2(i+23) e3(i+23) e4(i+23) e5(i+23) e6(i+23) e7(i+23))
tmp4 = simde_mm256_unpackhi_epi16(tmp0,tmp1); // e0(i+24) e1(i+24) e2(i+24) e3(i+24) ... e0(i+31) e1(i+31) e2(i+31) e3(i+31)
tmp5 = simde_mm256_unpackhi_epi16(tmp2,tmp3); // e4(i+24) e5(i+24) e6(i+24) e7(i+24) ... e4(i+31) e5(i+31) e6(i+31) e7(i+31)
f_256[k+6] = simde_mm256_unpacklo_epi16(tmp4,tmp5); // e0(i+24) e1(i+24) e2(i+24) e3(i+24) e4(i+24) e5(i+24) e6(i+24) e7(i+24)... e0(i+27) e1(i+27) e2(i+27) e3(i+27) e4(i+27) e5(i+27) e6(i+27) e7(i+27))
f_256[k+7] = simde_mm256_unpackhi_epi16(tmp4,tmp5); // e0(i+28) e1(i+28) e2(i+28) e3(i+28) e4(i+28) e5(i+28) e6(i+28) e7(i+28)... e0(i+31) e1(i+31) e2(i+31) e3(i+31) e4(i+31) e5(i+31) e6(i+31) e7(i+31))
}
break;
default: AssertFatal(1==0,"Should be here!\n");
default: AssertFatal(1==0,"Should never be here! Qm = %d\n", Qm);
}
#else
//original unoptimized loops
/*
for (int j = 0; j< EQm; j++,j2+=2){
for (int i = 0; i< Qm; i++){
f[(i+j*Qm)] = e[(i*EQm + j)];
}
}
*/
fp=f;
switch (Qm) {
case 2:
e0=e;
e1=e0+EQm;
for (int j = 0, j2 = 0; j< EQm; j++,j2+=2){
fp=&f[j2];
fp[0] = e0[j];
fp[1] = e1[j];
}
break;
case 4:
e0=e;
e1=e0+EQm;
e2=e1+EQm;
e3=e2+EQm;
for (int j = 0, j2 = 0; j< EQm; j++,j2+=4){
fp=&f[j2];
fp[0] = e0[j];
fp[1] = e1[j];
fp[2] = e2[j];
fp[3] = e3[j];
}
break;
case 6:
e0=e;
e1=e0+EQm;
e2=e1+EQm;
e3=e2+EQm;
e4=e3+EQm;
e5=e4+EQm;
fp = f;
for (int j = 0; j< EQm; j++){
*fp++ = e0[j];
*fp++ = e1[j];
*fp++ = e2[j];
*fp++ = e3[j];
*fp++ = e4[j];
*fp++ = e5[j];
}
break;
case 8:
e0=e;
e1=e0+EQm;
e2=e1+EQm;
e3=e2+EQm;
e4=e3+EQm;
e5=e4+EQm;
e6=e5+EQm;
e7=e6+EQm;
for (int j = 0, j2 = 0; j< EQm; j++,j2+=8){
fp=&f[j2];
fp[0] = e0[j];
fp[1] = e1[j];
fp[2] = e2[j];
fp[3] = e3[j];
fp[4] = e4[j];
fp[5] = e5[j];
fp[6] = e6[j];
fp[7] = e7[j];
}
break;
default: AssertFatal(1==0,"Should never be here!\n");
}
#endif
}
void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f)
{

View File

@@ -38,35 +38,29 @@ int32_t nr_segmentation(unsigned char *input_buffer,
unsigned int *F,
uint8_t BG)
{
unsigned int L,Bprime,Z,r,Kcb,Kb,k,s,crc,Kprime;
if (BG==1)
Kcb=8448;
unsigned int L, Bprime, Z, Kcb, Kb, crc, Kprime;
if (BG == 1)
Kcb = 8448;
else
Kcb=3840;
if (B<=Kcb) {
L=0;
*C=1;
Bprime=B;
Kcb = 3840;
if (B <= Kcb) {
L = 0;
*C = 1;
Bprime = B;
} else {
L=24;
*C = B/(Kcb-L);
if ((Kcb-L)*(*C) < B)
*C=*C+1;
Bprime = B+((*C)*L);
L = 24;
*C = ceil(B / (Kcb - L));
if ((Kcb - L) * (*C) < B)
*C = *C + 1;
Bprime = B + ((*C) * L);
#ifdef DEBUG_SEGMENTATION
printf("Bprime %u\n",Bprime);
#endif
}
// Find K+
Kprime = Bprime/(*C);
Kprime = Bprime / (*C);
if (BG==1)
if (BG == 1)
Kb = 22;
else {
if (B > 640) {
@@ -75,107 +69,87 @@ int32_t nr_segmentation(unsigned char *input_buffer,
Kb = 9;
} else if (B > 192) {
Kb = 8;
}
else {
} else {
Kb = 6;
}
}
if ((Kprime % Kb) > 0)
Z = (Kprime / Kb) + 1;
else
Z = Kprime / Kb;
if ((Kprime%Kb) > 0)
Z = (Kprime/Kb)+1;
else
Z = (Kprime/Kb);
LOG_D(PHY,"nr segmentation B %u Bprime %u Kprime %u z %u \n", B, Bprime, Kprime, Z);
LOG_D(PHY,"nr segmentation B %u Bprime %u Kprime %u z %u \n", B, Bprime, Kprime, Z);
if (Z <= 2) {
*K = 2;
} else if (Z<=16) { // increase by 1 byte til here
*K = Z;
} else if (Z <=32) { // increase by 2 bytes til here
*K = (Z>>1)<<1;
} else if (Z <= 16) { // increase by 1 byte til here
*K = Z;
} else if (Z <= 32) { // increase by 2 bytes til here
*K = (Z >> 1) << 1;
if (*K < Z)
*K = *K + 2;
} else if (Z <= 64) { // increase by 4 bytes til here
*K = (Z>>2)<<2;
*K = (Z >> 2) << 2;
if (*K < Z)
*K = *K + 4;
} else if (Z <=128 ) { // increase by 8 bytes til here
*K = (Z>>3)<<3;
*K = (Z >> 3) << 3;
if (*K < Z)
*K = *K + 8;
#ifdef DEBUG_SEGMENTATION
printf("Z_by_C %u , K2 %u\n",Z,*K);
#endif
} else if (Z <= 256) { // increase by 4 bytes til here
*K = (Z>>4)<<4;
if (*K < Z)
*K = *K + 16;
} else if (Z <= 384) { // increase by 4 bytes til here
*K = (Z>>5)<<5;
if (*K < Z)
*K = *K + 32;
} else {
//msg("nr_segmentation.c: Illegal codeword size !!!\n");
LOG_E(PHY, "nr_segmentation.c: Illegal codeword size !!!\n");
return -1;
}
*Zout = *K;
if(BG==1)
*K = *K*22;
if (BG == 1)
*K = *K * 22;
else
*K = *K*10;
*K = *K * 10;
*F = ((*K) - Kprime);
LOG_D(PHY,"final nr seg output Z %u K %u F %u \n", *Zout, *K, *F);
LOG_D(PHY,"C %u, K %u, Bprime_bytes %u, Bprime %u, F %u\n",*C,*K,Bprime>>3,Bprime,*F);
uint16_t Kprime_bytes = Kprime >> 3;
uint16_t Kprime_withoutCRC_bytes = (Kprime - L) >> 3;
if ((input_buffer) && (output_buffers)) {
s = 0;
for (r=0; r<*C; r++) {
k = 0;
while (k<((Kprime - L)>>3)) {
output_buffers[r][k] = input_buffer[s];
//printf("encoding segment %d : byte %d (%d) => %d\n",r,k,(Kprime-L)>>3,input_buffer[s]);
k++;
s++;
}
int s = 0;
for (int r = 0; r < *C; r++) {
memcpy(output_buffers[r], &input_buffer[s], Kprime_withoutCRC_bytes * sizeof(uint8_t));
if (*C > 1) { // add CRC
crc = crc24b(output_buffers[r],Kprime-L)>>8;
output_buffers[r][(Kprime-L)>>3] = ((uint8_t*)&crc)[2];
output_buffers[r][1+((Kprime-L)>>3)] = ((uint8_t*)&crc)[1];
output_buffers[r][2+((Kprime-L)>>3)] = ((uint8_t*)&crc)[0];
crc = crc24b(output_buffers[r], Kprime - L) >> 8;
output_buffers[r][Kprime_withoutCRC_bytes + 0] = ((uint8_t*)&crc)[2];
output_buffers[r][Kprime_withoutCRC_bytes + 1] = ((uint8_t*)&crc)[1];
output_buffers[r][Kprime_withoutCRC_bytes + 2] = ((uint8_t*)&crc)[0];
}
if (*F>0) {
for (k=Kprime>>3; k<(*K)>>3; k++) {
output_buffers[r][k] = 0;
//printf("r %d filler bits [%d] = %d Kprime %d \n", r,k, output_buffers[r][k], Kprime);
}
if (*F > 0) {
memset(&output_buffers[r][Kprime_bytes], 0, *F * sizeof(uint8_t));
}
s += Kprime_withoutCRC_bytes;
}
}
return Kb;
}

View File

@@ -44,7 +44,7 @@
//#define DEBUG_DLSCH
//#define DEBUG_DLSCH_MAPPING
static void nr_pdsch_codeword_scrambling(uint8_t *in, uint32_t size, uint8_t q, uint32_t Nid, uint32_t n_RNTI, uint32_t *out)
static void nr_pdsch_codeword_scrambling(uint32_t *in, uint32_t size, uint8_t q, uint32_t Nid, uint32_t n_RNTI, uint32_t *out)
{
nr_codeword_scrambling(in, size, q, Nid, n_RNTI, out);
}
@@ -102,8 +102,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
/// CRC, coding, interleaving and rate matching
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers] __attribute__((aligned(64)));
bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers);
uint32_t output[((rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers) + 7) / 8] __attribute__((aligned(64)));
bzero(output,((rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers) + 7) / 8);
start_meas(dlsch_encoding_stats);
if (nr_dlsch_encoding(gNB,
@@ -138,7 +138,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
#endif
if (IS_SOFTMODEM_DLSIM)
memcpy(harq->f, output, encoded_length);
memcpy(harq->f, output, (encoded_length + 7) / 8);
c16_t mod_symbs[rel15->NrOfCodewords][encoded_length];
for (int codeWord = 0; codeWord < rel15->NrOfCodewords; codeWord++) {

View File

@@ -48,7 +48,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
uint8_t slot,
NR_DL_gNB_HARQ_t *harq,
NR_DL_FRAME_PARMS* frame_parms,
unsigned char * output,
uint32_t *output,
time_stats_t *tinput,
time_stats_t *tprep,
time_stats_t *tparity,

View File

@@ -220,7 +220,8 @@ static void ldpc8blocks(void *p)
nr_interleaving_ldpc(E,
mod_order,
e,
impp->output+r_offset);
impp->output,
r_offset);
#ifdef DEBUG_DLSCH_CODING
for (int i =0; i<16; i++)
@@ -242,7 +243,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
uint8_t slot,
NR_DL_gNB_HARQ_t *harq,
NR_DL_FRAME_PARMS *frame_parms,
unsigned char *output,
uint32_t *output,
time_stats_t *tinput,
time_stats_t *tprep,
time_stats_t *tparity,
@@ -370,7 +371,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
for (int r = 0; r < impp.n_segments; r++) {
impp.perCB[r].E_cb = nr_get_E(impp.G, impp.n_segments, impp.Qm, rel15->nrOfLayers, r);
}
ldpc_interface_offload.LDPCencoder(harq->c, &impp.output, &impp);
uint8_t *d;
ldpc_interface_offload.LDPCencoder(harq->c, &d, &impp);
} else {
size_t const n_seg = (impp.n_segments / 8 + ((impp.n_segments & 7) == 0 ? 0 : 1));

View File

@@ -24,21 +24,18 @@
#include "common/utils/LOG/vcd_signal_dumper.h"
#define DEBUG_SCRAMBLING(a)
//#define DEBUG_SCRAMBLING(a) a
void nr_codeword_scrambling(uint8_t *in,
uint32_t size,
uint8_t q,
uint32_t Nid,
uint32_t n_RNTI,
uint32_t* out)
void nr_codeword_scrambling(uint32_t *in,
uint32_t size,
uint8_t q,
uint32_t Nid,
uint32_t n_RNTI,
uint32_t* out)
{
const int roundedSz = (size + 31) / 32;
uint32_t *seq = gold_cache((n_RNTI << 15) + (q << 14) + Nid, roundedSz);
for (int i = 0; i < roundedSz; i++) {
simde__m256i c = ((simde__m256i*)in)[i];
uint32_t in32 = simde_mm256_movemask_epi8(simde_mm256_slli_epi16(c, 7));
out[i] = in32 ^ seq[i];
DEBUG_SCRAMBLING(LOG_D(PHY, "in[%d] %x => %x\n", i, in32, out[i]));
}
int roundedSz = (size + 31) / 32;
uint32_t *seq = gold_cache((n_RNTI << 15) + (q << 14) + Nid, roundedSz); // Gold sequence for scrambling
while (roundedSz--)
*out++ = *in++ ^ *seq++;
}
void nr_codeword_unscrambling(int16_t* llr, uint32_t size, uint8_t q, uint32_t Nid, uint32_t n_RNTI)

View File

@@ -71,7 +71,7 @@ void nr_fill_du(uint16_t N_ZC, const uint16_t *prach_root_sequence_map);
void init_nr_prach_tables(int N_ZC);
void nr_codeword_scrambling(uint8_t *in,
void nr_codeword_scrambling(uint32_t *in,
uint32_t size,
uint8_t q,
uint32_t Nid,

View File

@@ -118,7 +118,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
@param[in] uci_on_pusch whether UCI placeholder bits need to be scrambled (true -> no optimized scrambling)
@param[out] out the scrambled bits
*/
void nr_pusch_codeword_scrambling(uint8_t *in,
void nr_pusch_codeword_scrambling(uint32_t *in,
uint32_t size,
uint32_t Nid,
uint32_t n_RNTI,

View File

@@ -63,7 +63,7 @@ typedef struct {
/// LDPC-code outputs (TS 36.212 V15.4.0, Sec 5.3.2 p. 17)
uint8_t *e;
/// Rate matching (Interleaving) outputs (TS 36.212 V15.4.0, Sec 5.4.2.2 p. 30)
uint8_t *f;
uint32_t *f;
/// Number of code segments
uint32_t C;
/// Number of bits in code segments

View File

@@ -154,7 +154,8 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
impp.perCB[j].E_cb = nr_get_E(G, impp.n_segments, impp.Qm, ulsch->pusch_pdu.nrOfLayers, j);
}
start_meas_nr_ue_phy(ue, ULSCH_LDPC_ENCODING_STATS);
ldpc_interface_offload.LDPCencoder(harq_process->c, &harq_process->f, &impp);
impp.output = harq_process->f;
ldpc_interface_offload.LDPCencoder(harq_process->c, harq_process->d, &impp);
stop_meas_nr_ue_phy(ue, ULSCH_LDPC_ENCODING_STATS);
} else {
if (ulsch->pusch_pdu.pusch_data.new_data_indicator) {
@@ -220,7 +221,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
///////////////////////// e---->| Rate matching bit interleaving |---->f /////////////////////////
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC, VCD_FUNCTION_IN);
start_meas_nr_ue_phy(ue, ULSCH_INTERLEAVING_STATS);
nr_interleaving_ldpc(impp.perCB[r].E_cb, impp.Qm, harq_process->e + r_offset, harq_process->f + r_offset);
nr_interleaving_ldpc(impp.perCB[r].E_cb, impp.Qm, harq_process->e + r_offset, harq_process->f, r_offset);
stop_meas_nr_ue_phy(ue, ULSCH_INTERLEAVING_STATS);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC, VCD_FUNCTION_OUT);

View File

@@ -55,7 +55,7 @@
//extern int32_t uplink_counter;
void nr_pusch_codeword_scrambling_uci(uint8_t *in, uint32_t size, uint32_t Nid, uint32_t n_RNTI, uint32_t* out)
void nr_pusch_codeword_scrambling_uci(uint32_t *in, uint32_t size, uint32_t Nid, uint32_t n_RNTI, uint32_t* out)
{
uint32_t *seq = gold_cache((n_RNTI << 15) + Nid, (size + 31) / 32);
for (int i=0; i<size; i++) {
@@ -77,7 +77,7 @@ void nr_pusch_codeword_scrambling_uci(uint8_t *in, uint32_t size, uint32_t Nid,
}
}
void nr_pusch_codeword_scrambling(uint8_t *in, uint32_t size, uint32_t Nid, uint32_t n_RNTI, bool uci_on_pusch, uint32_t* out)
void nr_pusch_codeword_scrambling(uint32_t *in, uint32_t size, uint32_t Nid, uint32_t n_RNTI, bool uci_on_pusch, uint32_t* out)
{
if (uci_on_pusch)
nr_pusch_codeword_scrambling_uci(in, size, Nid, n_RNTI, out);

View File

@@ -66,7 +66,7 @@ typedef struct {
/// Frame where current HARQ round was sent
uint32_t frame;
/// Interleaver outputs
uint8_t *f;
uint32_t *f;
/// LDPC lifting size
uint32_t Z;
/// REs unavailable for DLSCH (overlapping with PTRS, CSIRS etc.)

View File

@@ -510,7 +510,7 @@ int main(int argc, char **argv)
//printf("crc32: [0]->0x%08x\n",crc24c(test_input, 32));
// generate signal
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32)));
uint32_t output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32)));
bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
if (input_fd == NULL) {
nr_dlsch_encoding(gNB, frame, slot, &dlsch->harq_process, frame_parms,output,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

View File

@@ -1010,7 +1010,7 @@ int main(int argc, char **argv)
UE_harq_process->DLround = round;
UE_harq_process->first_rx = 1;
Sched_INFO = malloc(sizeof(*Sched_INFO));
Sched_INFO = aligned_alloc(32, sizeof(*Sched_INFO));
if (Sched_INFO == NULL) {
LOG_E(PHY, "out of memory\n");
exit(1);
@@ -1187,8 +1187,11 @@ int main(int argc, char **argv)
}
for (i = 0; i < available_bits; i++) {
if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) ||
((gNB_dlsch->harq_process.f[i] == 1) && (UE_llr[i] >= 0)))
uint32_t word_index = i / 32;
uint32_t bit_offset = i % 32;
uint32_t f_bit = (gNB_dlsch->harq_process.f[word_index] >> bit_offset) & 0x01;
if(((f_bit == 0) && (UE_llr[i] <= 0)) ||
((f_bit == 1) && (UE_llr[i] >= 0)))
{
if (errors_scrambling[round] == 0) {
LOG_D(PHY,"First bit in error in unscrambling = %d\n",i);