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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
zzha zzha
OpenXG-RAN
Commits
03d9f414
Commit
03d9f414
authored
Nov 09, 2017
by
Florian Kaltenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding ldpc testbench framework
parent
17b9a9e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
271 additions
and
1 deletion
+271
-1
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+3
-0
openair1/PHY/CODING/TESTBENCH/ldpctest.c
openair1/PHY/CODING/TESTBENCH/ldpctest.c
+267
-0
openair1/SIMULATION/TOOLS/rangen_double.c
openair1/SIMULATION/TOOLS/rangen_double.c
+1
-1
No files found.
cmake_targets/CMakeLists.txt
View file @
03d9f414
...
...
@@ -1931,6 +1931,9 @@ target_link_libraries (dlsim_tm4
pthread m rt
${
CONFIG_LIBRARIES
}
${
ATLAS_LIBRARIES
}
${
XFORMS_LIBRARIES
}
${
T_LIB
}
)
add_executable
(
ldpctest
${
OPENAIR1_DIR
}
/PHY/CODING/TESTBENCH/ldpctest.c
)
target_link_libraries
(
ldpctest m SIMU
${
ATLAS_LIBRARIES
}
)
foreach
(
myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim
)
add_executable
(
${
myExe
}
...
...
openair1/PHY/CODING/TESTBENCH/ldpctest.c
0 → 100644
View file @
03d9f414
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "SIMULATION/TOOLS/defs.h"
// 4-bit quantizer
char
quantize4bit
(
double
D
,
double
x
)
{
double
qxd
;
qxd
=
floor
(
x
/
D
);
// printf("x=%f,qxd=%f\n",x,qxd);
if
(
qxd
<=
-
8
)
qxd
=
-
8
;
else
if
(
qxd
>
7
)
qxd
=
7
;
return
((
char
)
qxd
);
}
char
quantize
(
double
D
,
double
x
,
unsigned
char
B
)
{
double
qxd
;
char
maxlev
;
qxd
=
floor
(
x
/
D
);
// printf("x=%f,qxd=%f\n",x,qxd);
maxlev
=
1
<<
(
B
-
1
);
if
(
qxd
<=
-
maxlev
)
qxd
=
-
maxlev
;
else
if
(
qxd
>=
maxlev
)
qxd
=
maxlev
-
1
;
return
((
char
)
qxd
);
}
#define MAX_BLOCK_LENGTH 6000
int
test_ldpc
(
unsigned
int
coded_bits
,
double
sigma
,
unsigned
char
qbits
,
unsigned
int
block_length
,
unsigned
int
ntrials
,
unsigned
int
*
errors
,
unsigned
int
*
trials
,
unsigned
int
*
uerrors
,
unsigned
int
*
crc_misses
,
unsigned
int
*
iterations
)
{
unsigned
char
test_input
[
block_length
+
1
];
unsigned
char
decoded_output
[
block_length
];
short
*
channel_input
,
*
channel_output
;
unsigned
int
i
,
trial
=
0
;
unsigned
int
crc
=
0
;
unsigned
char
ret
;
unsigned
char
uerr
;
unsigned
char
crc_type
;
channel_input
=
(
short
*
)
malloc
(
coded_bits
*
sizeof
(
short
));
channel_output
=
(
short
*
)
malloc
(
coded_bits
*
sizeof
(
short
));
*
iterations
=
0
;
*
errors
=
0
;
*
crc_misses
=
0
;
*
uerrors
=
0
;
while
(
trial
++
<
ntrials
)
{
// printf("encoding\n");
// test_input[0] = 0x80;
for
(
i
=
0
;
i
<
block_length
;
i
++
)
{
test_input
[
i
]
=
(
unsigned
char
)(
taus
()
&
0xff
);
}
//replace with ldpc encoder, write to channel_input
/*
dlsch_encoding(test_input,
&PHY_vars_eNB->lte_frame_parms,
num_pdcch_symbols,
PHY_vars_eNB->dlsch_eNB[0][0],
0,
subframe,
&PHY_vars_eNB->dlsch_rate_matching_stats,
&PHY_vars_eNB->dlsch_turbo_encoding_stats,
&PHY_vars_eNB->dlsch_interleaving_stats);
*/
uerr
=
0
;
for
(
i
=
0
;
i
<
coded_bits
;
i
++
)
{
#ifdef DEBUG_CODER
if
((
i
&
0xf
)
==
0
)
printf
(
"
\n
e %d..%d: "
,
i
,
i
+
15
);
#endif
channel_output
[
i
]
=
(
short
)
quantize
(
sigma
/
4
.
0
,(
2
.
0
*
channel_input
[
i
])
-
1
.
0
+
sigma
*
gaussdouble
(
0
.
0
,
1
.
0
),
qbits
);
}
#ifdef DEBUG_CODER
printf
(
"
\n
"
);
exit
(
-
1
);
#endif
// replace this with ldpc decoder
/*
ret = dlsch_decoding(PHY_vars_UE,
channel_output,
&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->dlsch_ue[0][0],
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid],
frame,
subframe,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid,
num_pdcch_symbols,1);
*/
/*
if (ret < dlsch_ue->max_turbo_iterations+1) {
*iterations = (*iterations) + ret;
// if (ret>1)
// printf("ret %d\n",ret);
} else
*iterations = (*iterations) + (ret-1);
if (uerr==1)
*uerrors = (*uerrors) + 1;
*/
for
(
i
=
0
;
i
<
block_length
;
i
++
)
{
if
(
decoded_output
[
i
]
!=
test_input
[
i
])
{
*
errors
=
(
*
errors
)
+
1
;
// printf("*%d, ret %d\n",*errors,ret);
/*
if (ret < dlsch_ue->max_turbo_iterations+1)
*crc_misses = (*crc_misses)+1;
*/
break
;
}
}
/*
if (ret == dlsch_ue->max_turbo_iterations+1) {
// exit(-1);
}
*/
if
(
*
errors
==
100
)
{
printf
(
"trials %d
\n
"
,
trial
);
break
;
}
}
*
trials
=
trial
;
// printf("lte: trials %d, errors %d\n",trial,*errors);
return
(
0
);
}
#define NTRIALS 10000
int
main
(
int
argc
,
char
*
argv
[])
{
int
ret
,
ret2
;
unsigned
int
errors
,
uerrors
,
errors2
,
crc_misses
,
iterations
,
trials
,
trials2
,
block_length
,
errors3
,
trials3
;
double
SNR
,
sigma
,
rate
=
.
5
;
unsigned
char
qbits
,
mcs
;
char
done0
=
0
;
char
done1
=
1
;
char
done2
=
1
;
unsigned
int
coded_bits
;
unsigned
char
NB_RB
=
25
;
int
num_pdcch_symbols
=
1
;
int
subframe
=
6
;
randominit
(
0
);
//logInit();
if
(
argc
>
1
)
qbits
=
atoi
(
argv
[
1
]);
else
qbits
=
4
;
printf
(
"Quantization bits %d
\n
"
,
qbits
);
printf
(
"Coded_bits (G) = %d
\n
"
,
coded_bits
);
for
(
SNR
=-
5
;
SNR
<
15
;
SNR
+=
.
1
)
{
sigma
=
pow
(
10
.
0
,
-
.
05
*
SNR
);
printf
(
"
\n\n
SNR %f dB => sigma %f
\n
"
,
SNR
,
sigma
);
errors
=
0
;
crc_misses
=
0
;
errors2
=
0
;
errors3
=
0
;
iterations
=
0
;
if
(
done0
==
0
)
{
ret
=
test_ldpc
(
coded_bits
,
sigma
,
// noise standard deviation
qbits
,
block_length
,
// block length bytes
NTRIALS
,
&
errors
,
&
trials
,
&
uerrors
,
&
crc_misses
,
&
iterations
);
if
(
ret
>=
0
)
printf
(
"%f,%f,%f,%f
\n
"
,
SNR
,(
double
)
errors
/
trials
,(
double
)
crc_misses
/
trials
,(
double
)
iterations
/
trials
);
if
(((
double
)
errors
/
trials
)
<
1e-2
)
done0
=
1
;
}
if
((
done0
==
1
)
&&
(
done1
==
1
)
&&
(
done2
==
1
))
{
printf
(
"done
\n
"
);
break
;
}
}
return
(
0
);
}
openair1/SIMULATION/TOOLS/rangen_double.c
View file @
03d9f414
...
...
@@ -44,7 +44,7 @@ void randominit(unsigned seed_init)
{
int
i
;
// this need to be integrated with the existing rng, like taus: navid
msg
(
"Initializing random number generator, seed %x
\n
"
,
seed_init
);
//
msg("Initializing random number generator, seed %x\n",seed_init);
if
(
seed_init
==
0
)
{
srand
((
unsigned
)
time
(
NULL
));
...
...
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