Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RAN
Commits
f050cdf4
Commit
f050cdf4
authored
Jan 05, 2024
by
Jaroslava Fiedlerova
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/improve-pucch-codec' into integration_2024_w01
parents
ad234a03
18919576
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
997 additions
and
1194 deletions
+997
-1194
openair1/PHY/CODING/TESTBENCH/smallblocktest.c
openair1/PHY/CODING/TESTBENCH/smallblocktest.c
+136
-128
openair1/PHY/CODING/nrSmallBlock/encodeSmallBlock.c
openair1/PHY/CODING/nrSmallBlock/encodeSmallBlock.c
+7
-6
openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h
openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h
+1
-1
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
+1
-1
openair1/PHY/NR_TRANSPORT/nr_uci_tools_common.c
openair1/PHY/NR_TRANSPORT/nr_uci_tools_common.c
+7
-6
openair1/PHY/NR_TRANSPORT/pucch_rx.c
openair1/PHY/NR_TRANSPORT/pucch_rx.c
+470
-583
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
+373
-411
openair1/PHY/TOOLS/tools_defs.h
openair1/PHY/TOOLS/tools_defs.h
+2
-1
openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
+0
-57
No files found.
openair1/PHY/CODING/TESTBENCH/smallblocktest.c
View file @
f050cdf4
...
...
@@ -8,144 +8,152 @@
configmodule_interface_t
*
uniqCfg
=
NULL
;
int
main
(
int
argc
,
char
*
argv
[])
{
time_stats_t
timeEncoder
,
timeDecoder
;
opp_enabled
=
1
;
reset_meas
(
&
timeEncoder
);
reset_meas
(
&
timeDecoder
);
randominit
(
0
);
int
arguments
,
iterations
=
1000
,
messageLength
=
11
;
//int matlabDebug = 0;
uint32_t
testInput
,
encoderOutput
,
codingDifference
,
nBitError
=
0
,
blockErrorState
=
0
,
blockErrorCumulative
=
0
,
bitErrorCumulative
=
0
;
uint16_t
estimatedOutput
;
double
SNRstart
=
-
20
.
0
,
SNRstop
=
5
.
0
,
SNRinc
=
0
.
5
;
//dB
double
SNR
,
SNR_lin
,
sigma
;
double
modulatedInput
[
NR_SMALL_BLOCK_CODED_BITS
],
channelOutput
[
NR_SMALL_BLOCK_CODED_BITS
];
//int16_t channelOutput_int16[NR_SMALL_BLOCK_CODED_BITS];
int8_t
channelOutput_int8
[
NR_SMALL_BLOCK_CODED_BITS
];
unsigned
char
qbits
=
8
;
while
((
arguments
=
getopt
(
argc
,
argv
,
"s:d:f:l:i:mhg"
))
!=
-
1
)
switch
(
arguments
)
{
case
's'
:
SNRstart
=
atof
(
optarg
);
break
;
case
'd'
:
SNRinc
=
atof
(
optarg
);
break
;
case
'f'
:
SNRstop
=
atof
(
optarg
);
break
;
case
'l'
:
messageLength
=
atoi
(
optarg
);
break
;
case
'i'
:
iterations
=
atoi
(
optarg
);
break
;
/*case 'm':
matlabDebug = 1;
//#define DEBUG_POLAR_MATLAB
break;*/
case
'g'
:
iterations
=
1
;
SNRstart
=
-
6
.
0
;
SNRstop
=
-
6
.
0
;
messageLength
=
11
;
break
;
case
'h'
:
//printf("./smallblocktest -s SNRstart -d SNRinc -f SNRstop -l messageLength -i iterations -m Matlab Debug\n");
printf
(
"./smallblocktest -s SNRstart -d SNRinc -f SNRstop -l messageLength -i iterations
\n
"
);
exit
(
-
1
);
default:
perror
(
"[smallblocktest.c] Problem at argument parsing with getopt"
);
exit
(
-
1
);
}
uint16_t
mask
=
0x07ff
>>
(
11
-
messageLength
);
for
(
SNR
=
SNRstart
;
SNR
<=
SNRstop
;
SNR
+=
SNRinc
)
{
printf
(
"SNR %f
\n
"
,
SNR
);
SNR_lin
=
pow
(
10
,
SNR
/
10
.
0
);
sigma
=
1
.
0
/
sqrt
(
SNR_lin
);
for
(
int
itr
=
1
;
itr
<=
iterations
;
itr
++
)
{
//Generate random test input of length "messageLength"
testInput
=
0
;
for
(
int
i
=
1
;
i
<
messageLength
;
i
++
)
{
testInput
|=
(
((
uint32_t
)
(
rand
()
%
2
))
&
1
);
testInput
<<=
1
;
}
testInput
|=
(
((
uint32_t
)
(
rand
()
%
2
))
&
1
);
//Encoding
start_meas
(
&
timeEncoder
);
encoderOutput
=
encodeSmallBlock
((
uint16_t
*
)
&
testInput
,
(
uint8_t
)
messageLength
);
stop_meas
(
&
timeEncoder
);
for
(
int
i
=
0
;
i
<
NR_SMALL_BLOCK_CODED_BITS
;
i
++
)
{
//BPSK modulation
if
((
encoderOutput
>>
i
)
&
1
)
{
modulatedInput
[
i
]
=-
1
;
}
else
{
modulatedInput
[
i
]
=
1
;
}
//AWGN
channelOutput
[
i
]
=
modulatedInput
[
i
]
+
(
gaussdouble
(
0
.
0
,
1
.
0
)
*
(
1
/
sqrt
(
SNR_lin
)
)
);
//Quantization
channelOutput_int8
[
i
]
=
quantize
(
sigma
/
16
.
0
,
channelOutput
[
i
],
qbits
);
}
//Decoding
start_meas
(
&
timeDecoder
);
estimatedOutput
=
decodeSmallBlock
(
channelOutput_int8
,
(
uint8_t
)
messageLength
);
stop_meas
(
&
timeDecoder
);
time_stats_t
timeEncoder
,
timeDecoder
;
opp_enabled
=
1
;
reset_meas
(
&
timeEncoder
);
reset_meas
(
&
timeDecoder
);
randominit
(
0
);
int
arguments
,
iterations
=
1000
,
messageLength
=
11
;
// int matlabDebug = 0;
uint32_t
testInput
,
encoderOutput
,
codingDifference
,
nBitError
=
0
,
blockErrorState
=
0
,
blockErrorCumulative
=
0
,
bitErrorCumulative
=
0
;
uint16_t
estimatedOutput
;
double
SNRstart
=
-
20
.
0
,
SNRstop
=
5
.
0
,
SNRinc
=
0
.
5
;
// dB
double
SNR
,
SNR_lin
,
sigma
;
double
modulatedInput
[
NR_SMALL_BLOCK_CODED_BITS
],
channelOutput
[
NR_SMALL_BLOCK_CODED_BITS
];
// int16_t channelOutput_int16[NR_SMALL_BLOCK_CODED_BITS];
int8_t
channelOutput_int8
[
NR_SMALL_BLOCK_CODED_BITS
];
unsigned
char
qbits
=
8
;
while
((
arguments
=
getopt
(
argc
,
argv
,
"s:d:f:l:i:mhg"
))
!=
-
1
)
switch
(
arguments
)
{
case
's'
:
SNRstart
=
atof
(
optarg
);
break
;
case
'd'
:
SNRinc
=
atof
(
optarg
);
break
;
case
'f'
:
SNRstop
=
atof
(
optarg
);
break
;
case
'l'
:
messageLength
=
atoi
(
optarg
);
break
;
case
'i'
:
iterations
=
atoi
(
optarg
);
break
;
/*case 'm':
matlabDebug = 1;
//#define DEBUG_POLAR_MATLAB
break;*/
case
'g'
:
iterations
=
1
;
SNRstart
=
-
6
.
0
;
SNRstop
=
-
6
.
0
;
messageLength
=
11
;
break
;
case
'h'
:
// printf("./smallblocktest -s SNRstart -d SNRinc -f SNRstop -l messageLength -i iterations -m Matlab Debug\n");
printf
(
"./smallblocktest -s SNRstart -d SNRinc -f SNRstop -l messageLength -i iterations
\n
"
);
exit
(
-
1
);
default:
perror
(
"[smallblocktest.c] Problem at argument parsing with getopt"
);
exit
(
-
1
);
}
uint16_t
mask
=
0x07ff
>>
(
11
-
messageLength
);
for
(
SNR
=
SNRstart
;
SNR
<=
SNRstop
;
SNR
+=
SNRinc
)
{
printf
(
"SNR %f
\n
"
,
SNR
);
SNR_lin
=
pow
(
10
,
SNR
/
10
.
0
);
sigma
=
1
.
0
/
sqrt
(
SNR_lin
);
for
(
int
itr
=
1
;
itr
<=
iterations
;
itr
++
)
{
// Generate random test input of length "messageLength"
testInput
=
0
;
for
(
int
i
=
1
;
i
<
messageLength
;
i
++
)
{
testInput
|=
(((
uint32_t
)(
rand
()
%
2
))
&
1
);
testInput
<<=
1
;
}
testInput
|=
(((
uint32_t
)(
rand
()
%
2
))
&
1
);
// Encoding
start_meas
(
&
timeEncoder
);
encoderOutput
=
encodeSmallBlock
(
testInput
,
messageLength
);
stop_meas
(
&
timeEncoder
);
for
(
int
i
=
0
;
i
<
NR_SMALL_BLOCK_CODED_BITS
;
i
++
)
{
// BPSK modulation
if
((
encoderOutput
>>
i
)
&
1
)
{
modulatedInput
[
i
]
=
-
1
;
}
else
{
modulatedInput
[
i
]
=
1
;
}
// AWGN
channelOutput
[
i
]
=
modulatedInput
[
i
]
+
(
gaussdouble
(
0
.
0
,
1
.
0
)
*
(
1
/
sqrt
(
SNR_lin
)));
// Quantization
channelOutput_int8
[
i
]
=
quantize
(
sigma
/
16
.
0
,
channelOutput
[
i
],
qbits
);
}
// Decoding
start_meas
(
&
timeDecoder
);
estimatedOutput
=
decodeSmallBlock
(
channelOutput_int8
,
(
uint8_t
)
messageLength
);
stop_meas
(
&
timeDecoder
);
#ifdef DEBUG_SMALLBLOCKTEST
printf
(
"[smallblocktest] Input = 0x%x, Output = 0x%x, DecoderOutput = 0x%x
\n
"
,
testInput
,
encoderOutput
,
estimatedOutput
);
for
(
int
i
=
0
;
i
<
32
;
i
++
)
printf
(
"[smallblocktest] Input[%d] = %d, Output[%d] = %d, codingDifference[%d]=%d, Mask[%d] = %d
\n
"
,
i
,
(
testInput
>>
i
)
&
1
,
i
,
(
estimatedOutput
>>
i
)
&
1
,
i
,
(
codingDifference
>>
i
)
&
1
,
i
,
(
mask
>>
i
)
&
1
);
printf
(
"[smallblocktest] Input = 0x%x, Output = 0x%x, DecoderOutput = 0x%x
\n
"
,
testInput
,
encoderOutput
,
estimatedOutput
);
for
(
int
i
=
0
;
i
<
32
;
i
++
)
printf
(
"[smallblocktest] Input[%d] = %d, Output[%d] = %d, codingDifference[%d]=%d, Mask[%d] = %d
\n
"
,
i
,
(
testInput
>>
i
)
&
1
,
i
,
(
estimatedOutput
>>
i
)
&
1
,
i
,
(
codingDifference
>>
i
)
&
1
,
i
,
(
mask
>>
i
)
&
1
);
#endif
//Error Calculation
estimatedOutput
&=
mask
;
codingDifference
=
((
uint32_t
)
estimatedOutput
)
^
testInput
;
// Count the # of 1's in codingDifference by Brian Kernighan’s algorithm.
// Error Calculation
estimatedOutput
&=
mask
;
codingDifference
=
((
uint32_t
)
estimatedOutput
)
^
testInput
;
// Count the # of 1's in codingDifference by Brian Kernighan’s algorithm.
for
(
nBitError
=
0
;
codingDifference
;
nBitError
++
)
codingDifference
&=
codingDifference
-
1
;
for
(
nBitError
=
0
;
codingDifference
;
nBitError
++
)
codingDifference
&=
codingDifference
-
1
;
blockErrorState
=
(
nBitError
>
0
)
?
1
:
0
;
blockErrorState
=
(
nBitError
>
0
)
?
1
:
0
;
blockErrorCumulative
+=
blockErrorState
;
bitErrorCumulative
+=
nBitError
;
blockErrorCumulative
+=
blockErrorState
;
bitErrorCumulative
+=
nBitError
;
nBitError
=
0
;
blockErrorState
=
0
;
}
nBitError
=
0
;
blockErrorState
=
0
;
}
//
Error statistics for the SNR; iteration times are in nanoseconds and microseconds, respectively.
printf
(
"[smallblocktest] SNR=%+7.3f, BER=%9.6f, BLER=%9.6f, t_Encoder=%9.3fns, t_Decoder=%7.3fus
\n
"
,
SNR
,
((
double
)
bitErrorCumulative
/
(
iterations
*
messageLength
)),
((
double
)
blockErrorCumulative
/
iterations
),
((
double
)
timeEncoder
.
diff
/
timeEncoder
.
trials
)
/
(
get_cpu_freq_GHz
()),
((
double
)
timeDecoder
.
diff
/
timeDecoder
.
trials
)
/
(
get_cpu_freq_GHz
()
*
1000
.
0
));
//
Error statistics for the SNR; iteration times are in nanoseconds and microseconds, respectively.
printf
(
"[smallblocktest] SNR=%+7.3f, BER=%9.6f, BLER=%9.6f, t_Encoder=%9.3fns, t_Decoder=%7.3fus
\n
"
,
SNR
,
((
double
)
bitErrorCumulative
/
(
iterations
*
messageLength
)),
((
double
)
blockErrorCumulative
/
iterations
),
((
double
)
timeEncoder
.
diff
/
timeEncoder
.
trials
)
/
(
get_cpu_freq_GHz
()),
((
double
)
timeDecoder
.
diff
/
timeDecoder
.
trials
)
/
(
get_cpu_freq_GHz
()
*
1000
.
0
));
blockErrorCumulative
=
0
;
bitErrorCumulative
=
0
;
}
blockErrorCumulative
=
0
;
bitErrorCumulative
=
0
;
}
print_meas
(
&
timeEncoder
,
"smallblock_encoder"
,
NULL
,
NULL
);
print_meas
(
&
timeDecoder
,
"smallblock_decoder"
,
NULL
,
NULL
);
print_meas
(
&
timeEncoder
,
"smallblock_encoder"
,
NULL
,
NULL
);
print_meas
(
&
timeDecoder
,
"smallblock_decoder"
,
NULL
,
NULL
);
return
(
0
);
return
(
0
);
}
openair1/PHY/CODING/nrSmallBlock/encodeSmallBlock.c
View file @
f050cdf4
...
...
@@ -34,11 +34,12 @@
//input = [0 ... 0 c_K-1 ... c_2 c_1 c_0]
//output = [d_31 d_30 ... d_2 d_1 d_0]
uint32_t
encodeSmallBlock
(
uint16_t
*
in
,
uint8_t
len
){
uint32_t
out
=
0
;
for
(
uint16_t
i
=
0
;
i
<
len
;
i
++
)
if
((
*
in
&
(
1
<<
i
))
>
0
)
out
^=
nrSmallBlockBasis
[
i
];
uint32_t
encodeSmallBlock
(
int
in
,
int
len
)
{
uint32_t
out
=
0
;
for
(
int
i
=
0
;
i
<
len
;
i
++
)
if
((
in
&
(
1
<<
i
))
>
0
)
out
^=
nrSmallBlockBasis
[
i
];
return
out
;
return
out
;
}
openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h
View file @
f050cdf4
...
...
@@ -43,7 +43,7 @@
#define L1d_CLS 64
uint32_t
encodeSmallBlock
(
uint16_t
*
in
,
uint8_
t
len
);
uint32_t
encodeSmallBlock
(
int
in
,
in
t
len
);
uint16_t
decodeSmallBlock
(
int8_t
*
in
,
uint8_t
len
);
...
...
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
View file @
f050cdf4
...
...
@@ -42,7 +42,7 @@
void
nr_group_sequence_hopping
(
pucch_GroupHopping_t
PUCCH_GroupHopping
,
uint32_t
n_id
,
uint8_
t
n_hop
,
in
t
n_hop
,
int
nr_slot_tx
,
uint8_t
*
u
,
uint8_t
*
v
);
...
...
openair1/PHY/NR_TRANSPORT/nr_uci_tools_common.c
View file @
f050cdf4
...
...
@@ -32,12 +32,13 @@
#include "nr_dci.h"
void
nr_group_sequence_hopping
(
pucch_GroupHopping_t
PUCCH_GroupHopping
,
uint32_t
n_id
,
uint8_t
n_hop
,
int
nr_slot_tx
,
uint8_t
*
u
,
uint8_t
*
v
)
{
void
nr_group_sequence_hopping
(
pucch_GroupHopping_t
PUCCH_GroupHopping
,
uint32_t
n_id
,
int
n_hop
,
int
nr_slot_tx
,
uint8_t
*
u
,
uint8_t
*
v
)
{
/*
* Implements TS 38.211 subclause 6.3.2.2.1 Group and sequence hopping
* The following variables are set by higher layers:
...
...
openair1/PHY/NR_TRANSPORT/pucch_rx.c
View file @
f050cdf4
This diff is collapsed.
Click to expand it.
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
View file @
f050cdf4
This diff is collapsed.
Click to expand it.
openair1/PHY/TOOLS/tools_defs.h
View file @
f050cdf4
...
...
@@ -215,7 +215,8 @@ extern "C" {
{
return
(
c16_t
){.
r
=
(
int16_t
)((
a
.
r
*
b
)
>>
Shift
),
.
i
=
(
int16_t
)((
a
.
i
*
b
)
>>
Shift
)};
}
__attribute__
((
always_inline
))
inline
c16_t
c16divShift
(
const
c16_t
a
,
const
c16_t
b
,
const
int
Shift
)
{
__attribute__
((
always_inline
))
inline
c16_t
c16MulConjShift
(
const
c16_t
a
,
const
c16_t
b
,
const
int
Shift
)
{
return
(
c16_t
)
{
.
r
=
(
int16_t
)((
a
.
r
*
b
.
r
+
a
.
i
*
b
.
i
)
>>
Shift
),
.
i
=
(
int16_t
)((
a
.
r
*
b
.
i
-
a
.
i
*
b
.
r
)
>>
Shift
)
...
...
openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
View file @
f050cdf4
...
...
@@ -83,64 +83,7 @@ binary_search_float_nr(
return
first
;
}
/*
void nr_generate_pucch0(int32_t **txdataF,
NR_DL_FRAME_PARMS *frame_parms,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
int16_t amp,
int nr_slot_tx,
uint8_t mcs,
uint8_t nrofSymbols,
uint8_t startingSymbolIndex,
uint16_t startingPRB);
void nr_generate_pucch1(int32_t **txdataF,
NR_DL_FRAME_PARMS *frame_parms,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint64_t payload,
int16_t amp,
int nr_slot_tx,
uint8_t nrofSymbols,
uint8_t startingSymbolIndex,
uint16_t startingPRB,
uint16_t startingPRB_intraSlotHopping,
uint8_t timeDomainOCC,
uint8_t nr_bit);
void nr_generate_pucch2(int32_t **txdataF,
NR_DL_FRAME_PARMS *frame_parms,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint64_t payload,
int16_t amp,
int nr_slot_tx,
uint8_t nrofSymbols,
uint8_t startingSymbolIndex,
uint8_t nrofPRB,
uint16_t startingPRB,
uint8_t nr_bit);
void nr_generate_pucch3_4(int32_t **txdataF,
NR_DL_FRAME_PARMS *frame_parms,
pucch_format_nr_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint64_t payload,
int16_t amp,
int nr_slot_tx,
uint8_t nrofSymbols,
uint8_t startingSymbolIndex,
uint8_t nrofPRB,
uint16_t startingPRB,
uint8_t nr_bit,
uint8_t occ_length_format4,
uint8_t occ_index_format4);
*/
/**************** variables **************************************/
/**************** functions **************************************/
//extern uint8_t is_cqi_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id);
//extern uint8_t is_ri_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id);
/*******************************************************************
*
* NAME : pucch_procedures_ue_nr
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment