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
lizhongxiao
OpenXG-RAN
Commits
92cdd224
Commit
92cdd224
authored
6 years ago
by
martino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Right path to compile new crc functions
parent
69767e7d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
19 deletions
+100
-19
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+2
-2
openair1/PHY/CODING/crc_byte.c
openair1/PHY/CODING/crc_byte.c
+81
-1
openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c
openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c
+15
-14
openair1/PHY/CODING/nrPolar_tools/nr_polar_kernal_operation.c
...air1/PHY/CODING/nrPolar_tools/nr_polar_kernal_operation.c
+2
-2
No files found.
cmake_targets/CMakeLists.txt
View file @
92cdd224
...
...
@@ -1091,7 +1091,7 @@ set(PHY_POLARSRC
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_crc_byte.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_bit_insertion.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_channel_interleaver_pattern.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_crc.c
#
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_crc.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_info_bit_pattern.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c
...
...
@@ -2367,7 +2367,7 @@ target_link_libraries (dlsim_tm4
)
add_executable
(
polartest
${
OPENAIR1_DIR
}
/PHY/CODING/TESTBENCH/polartest.c
)
target_link_libraries
(
polartest m SIMU PHY PHY_NR -lm
${
ATLAS_LIBRARIES
}
)
target_link_libraries
(
polartest m SIMU PHY PHY_NR
PHY_COMMON
-lm
${
ATLAS_LIBRARIES
}
)
foreach
(
myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim
)
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/crc_byte.c
View file @
92cdd224
...
...
@@ -33,14 +33,17 @@
#include "coding_defs.h"
/*ref 36-212 v8.6.0 , pp 8-9 */
/* the highest degree is set by default */
unsigned
int
poly24a
=
0x864cfb00
;
//1000 0110 0100 1100 1111 1011 D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1
unsigned
int
poly24b
=
0x80006300
;
// 1000 0000 0000 0000 0110 0011 D^24 + D^23 + D^6 + D^5 + D + 1
uint32_t
poly24c
=
0xB2B11700
;
//101100101011000100010111
unsigned
int
poly16
=
0x10210000
;
// 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1
unsigned
int
poly12
=
0x80F00000
;
// 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1
unsigned
int
poly8
=
0x9B000000
;
// 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1
uint32_t
poly6
=
0x84000000
;
// 10000100000... -> D^6+D^5+1
uint32_t
poly11
=
0xc4200000
;
//11000100001000... -> D^11+D^10+D^9+D^5+1
/*********************************************************
For initialization && verification purposes,
...
...
@@ -93,6 +96,18 @@ void crcTableInit (void)
crc8Table
[
c
]
=
(
unsigned
char
)
(
crcbit
(
&
c
,
1
,
poly8
)
>>
24
);
}
while
(
++
c
);
}
//Generic version
void
crcTable256Init
(
uint32_t
poly
,
uint32_t
*
crc256Table
)
{
unsigned
char
c
=
0
;
do
{
crc256Table
[
c
]
=
crcbit
(
&
c
,
1
,
poly
);
}
while
(
++
c
);
}
/*********************************************************
Byte by byte implementations,
...
...
@@ -193,6 +208,71 @@ crc8 (unsigned char * inptr, int bitlen)
return
crc
;
}
//Generic version
unsigned
int
crcPayload
(
unsigned
char
*
inptr
,
int
bitlen
,
uint32_t
*
crc256Table
)
{
int
octetlen
,
resbit
;
unsigned
int
crc
=
0
;
octetlen
=
bitlen
/
8
;
// Change in bytes
resbit
=
(
bitlen
%
8
);
while
(
octetlen
--
>
0
)
{
crc
=
(
crc
<<
8
)
^
crc256Table
[(
*
inptr
++
)
^
(
crc
>>
24
)];
}
if
(
resbit
>
0
)
{
crc
=
(
crc
<<
resbit
)
^
crc256Table
[((
*
inptr
)
>>
(
8
-
resbit
))
^
(
crc
>>
(
32
-
resbit
))];
}
return
crc
;
}
void
nr_crc_computation
(
uint8_t
*
input
,
uint8_t
*
output
,
uint16_t
payloadBits
,
uint16_t
crcParityBits
,
uint32_t
*
crc256Table
)
{
//Create payload in bit
uint8_t
*
input2
=
(
uint8_t
*
)
malloc
(
payloadBits
);
//divided by 8 (in bits)
uint8_t
mask
=
128
;
// 10000000
for
(
uint8_t
ind
=
0
;
ind
<
(
payloadBits
/
8
);
ind
++
)
{
input2
[
ind
]
=
0
;
for
(
uint8_t
ind2
=
0
;
ind2
<
8
;
ind2
++
)
{
if
(
input
[
8
*
ind
+
ind2
])
{
input2
[
ind
]
=
input2
[
ind
]
|
mask
;
}
mask
=
mask
>>
1
;
}
mask
=
128
;
}
//crcTable256Init(poly);
unsigned
int
crcBits
;
crcBits
=
crcPayload
(
input2
,
payloadBits
,
crc256Table
);
//create crc in byte
unsigned
int
mask2
=
0x80000000
;
//100...
output
=
(
uint8_t
*
)
malloc
(
sizeof
(
uint8_t
)
*
crcParityBits
);
for
(
uint8_t
ind
=
0
;
ind
<
crcParityBits
;
ind
++
)
{
if
(
crcBits
&
mask2
)
output
[
ind
]
=
1
;
else
output
[
ind
]
=
0
;
mask2
=
mask2
>>
1
;
}
}
#ifdef DEBUG_CRC
/*******************************************************************/
/**
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c
View file @
92cdd224
...
...
@@ -21,10 +21,11 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
/*
// ----- New implementation ----
uint32_t
poly6
=
0x84000000
;
// 1000100000... -> D^6+D^5+1
uint32_t
poly11
=
0x
63
200000
;
//11000100001000... -> D^11+D^10+D^9+D^5+1
uint32_t
poly16
=
0x
81080000
;
//
100000010000100... - > D^16+D^12+D^5+1
uint32_t poly6 = 0x84000000; // 1000
0
100000... -> D^6+D^5+1
uint32_t poly11 = 0x
c4
200000; //11000100001000... -> D^11+D^10+D^9+D^5+1
uint32_t poly16 = 0x
10210000; //00
100000010000100... - > D^16+D^12+D^5+1
uint32_t poly24a = 0x864cfb00; //100001100100110011111011 -> D^24+D^23+D^18+D^17+D^14+D^11+D^10+D^7+D^6+D^5+D^4+D^3+D+1
uint32_t poly24b = 0x80006300; //100000000000000001100011 -> D^24+D^23+D^6+D^5+D+1
uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
...
...
@@ -91,7 +92,7 @@ unsigned int crcbit (unsigned char* inputptr, int octetlen, unsigned int poly)
return crc;
}
/*
void crcTableInit (void)
{
unsigned char c = 0;
...
...
@@ -106,7 +107,7 @@ void crcTableInit (void)
} while (++c);
}
*/
void crcTable256Init (uint32_t poly, uint32_t* crc256Table)
{
unsigned char c = 0;
...
...
@@ -114,14 +115,14 @@ void crcTable256Init (uint32_t poly, uint32_t* crc256Table)
do {
crc256Table[c] = crcbit(&c, 1, poly);
/*
crc6Table[c] = crcbit(&c, 1, poly6);
crc11Table[c]= crcbit(&c, 1, poly11);
crc16Table[c] =crcbit(&c, 1, poly16);
crc24aTable[c]=crcbit(&c, 1, poly24a);
crc24bTable[c]=crcbit(&c, 1, poly24b);
crc24cTable[c]=crcbit(&c, 1, poly24c);
*/
//
crc6Table[c] = crcbit(&c, 1, poly6);
//
crc11Table[c]= crcbit(&c, 1, poly11);
//
crc16Table[c] =crcbit(&c, 1, poly16);
//
crc24aTable[c]=crcbit(&c, 1, poly24a);
//
crc24bTable[c]=crcbit(&c, 1, poly24b);
//
crc24cTable[c]=crcbit(&c, 1, poly24c);
} while (++c);
//return crc256Table;
...
...
@@ -145,7 +146,7 @@ unsigned int crcPayload(unsigned char * inptr, int bitlen, uint32_t* crc256Table
}
return crc;
}
*/
// ----- Old implementation ----
uint8_t
**
crc24c_generator_matrix
(
uint16_t
payloadSizeBits
){
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/nrPolar_tools/nr_polar_kernal_operation.c
View file @
92cdd224
...
...
@@ -16,10 +16,10 @@ void nr_polar_kernal_operation(uint8_t *u, uint8_t *d, uint16_t N)
d
[
i
]
=
0
;
for
(
j
=
0
;
j
<
N
;
j
++
)
// ... looking at all the elements of u
{
d
[
i
]
=
d
[
i
]
+
(
(
!
(
j
-
i
))
|
(
!
i
)
)
*
u
[
j
];
d
[
i
]
=
d
[
i
]
||
(
(
!
(
j
-
i
))
|
(
!
i
)
)
*
u
[
j
];
}
d
[
i
]
=
d
[
i
]
%
2
;
// modulo 2
//
d[i]=d[i]%2; // modulo 2
}
/*
...
...
This diff is collapsed.
Click to expand it.
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