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
canghaiwuhen
OpenXG-RAN
Commits
796c931a
Commit
796c931a
authored
Mar 03, 2019
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
soft-beta version of polar decoder step 1
parent
bad87bd1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
69 deletions
+82
-69
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+81
-69
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+1
-0
No files found.
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
796c931a
...
...
@@ -1087,81 +1087,93 @@ uint32_t polar_decoder_int16(int16_t *input,
}
memcpy
((
void
*
)
&
polarParams
->
tree
.
root
->
alpha
[
0
],(
void
*
)
&
d_tilde
[
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
generic_polar_decoder
(
polarParams
,
polarParams
->
tree
.
root
);
//Extract the information bits (û to ĉ)
uint64_t
Cprime
[
4
]
=
{
0
,
0
,
0
,
0
};
uint64_t
B
[
4
]
=
{
0
,
0
,
0
,
0
};
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
Cprime
[
i
>>
6
]
=
Cprime
[
i
>>
6
]
|
((
uint64_t
)
polarParams
->
nr_polar_U
[
polarParams
->
Q_I_N
[
i
]])
<<
(
i
&
63
);
//Deinterleaving (ĉ to b)
uint8_t
*
Cprimebyte
=
(
uint8_t
*
)
Cprime
;
if
(
polarParams
->
K
<
65
)
{
B
[
0
]
=
polarParams
->
B_tab0
[
0
][
Cprimebyte
[
0
]]
|
polarParams
->
B_tab0
[
1
][
Cprimebyte
[
1
]]
|
polarParams
->
B_tab0
[
2
][
Cprimebyte
[
2
]]
|
polarParams
->
B_tab0
[
3
][
Cprimebyte
[
3
]]
|
polarParams
->
B_tab0
[
4
][
Cprimebyte
[
4
]]
|
polarParams
->
B_tab0
[
5
][
Cprimebyte
[
5
]]
|
polarParams
->
B_tab0
[
6
][
Cprimebyte
[
6
]]
|
polarParams
->
B_tab0
[
7
][
Cprimebyte
[
7
]];
}
else
if
(
polarParams
->
K
<
129
)
{
int
len
=
polarParams
->
K
/
8
;
if
((
polarParams
->
K
&
7
)
>
0
)
len
++
;
for
(
int
k
=
0
;
k
<
len
;
k
++
)
{
B
[
0
]
|=
polarParams
->
B_tab0
[
k
][
Cprimebyte
[
k
]];
B
[
1
]
|=
polarParams
->
B_tab1
[
k
][
Cprimebyte
[
k
]];
}
}
int
len
=
polarParams
->
payloadBits
;
//int len_mod64=len&63;
int
crclen
=
polarParams
->
crcParityBits
;
uint64_t
rxcrc
=
B
[
0
]
&
((
1
<<
crclen
)
-
1
);
uint32_t
crc
;
uint64_t
Ar
;
AssertFatal
(
len
<
65
,
"A must be less than 65 bits
\n
"
);
if
(
len
<=
32
)
{
Ar
=
(
uint32_t
)(
B
[
0
]
>>
crclen
);
uint8_t
A32_flip
[
4
];
uint32_t
Aprime
=
(
uint32_t
)(
Ar
<<
(
32
-
len
));
A32_flip
[
0
]
=
((
uint8_t
*
)
&
Aprime
)[
3
];
A32_flip
[
1
]
=
((
uint8_t
*
)
&
Aprime
)[
2
];
A32_flip
[
2
]
=
((
uint8_t
*
)
&
Aprime
)[
1
];
A32_flip
[
3
]
=
((
uint8_t
*
)
&
Aprime
)[
0
];
crc
=
(
uint64_t
)(
crc24c
(
A32_flip
,
len
)
>>
8
);
}
else
if
(
len
<=
64
)
{
Ar
=
(
B
[
0
]
>>
crclen
)
|
(
B
[
1
]
<<
(
64
-
crclen
));;
uint8_t
A64_flip
[
8
];
uint64_t
Aprime
=
(
uint32_t
)(
Ar
<<
(
64
-
len
));
A64_flip
[
0
]
=
((
uint8_t
*
)
&
Aprime
)[
7
];
A64_flip
[
1
]
=
((
uint8_t
*
)
&
Aprime
)[
6
];
A64_flip
[
2
]
=
((
uint8_t
*
)
&
Aprime
)[
5
];
A64_flip
[
3
]
=
((
uint8_t
*
)
&
Aprime
)[
4
];
A64_flip
[
4
]
=
((
uint8_t
*
)
&
Aprime
)[
3
];
A64_flip
[
5
]
=
((
uint8_t
*
)
&
Aprime
)[
2
];
A64_flip
[
6
]
=
((
uint8_t
*
)
&
Aprime
)[
1
];
A64_flip
[
7
]
=
((
uint8_t
*
)
&
Aprime
)[
0
];
crc
=
(
uint64_t
)(
crc24c
(
A64_flip
,
len
)
>>
8
);
}
for
(
int
iter
=
0
;
iter
<
4
;
iter
++
)
{
generic_polar_decoder
(
polarParams
,
polarParams
->
tree
.
root
);
//Extract the information bits (û to ĉ)
uint64_t
Cprime
[
4
]
=
{
0
,
0
,
0
,
0
};
uint64_t
B
[
4
]
=
{
0
,
0
,
0
,
0
};
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
Cprime
[
i
>>
6
]
=
Cprime
[
i
>>
6
]
|
((
uint64_t
)
polarParams
->
nr_polar_U
[
polarParams
->
Q_I_N
[
i
]])
<<
(
i
&
63
);
//Deinterleaving (ĉ to b)
uint8_t
*
Cprimebyte
=
(
uint8_t
*
)
Cprime
;
if
(
polarParams
->
K
<
65
)
{
B
[
0
]
=
polarParams
->
B_tab0
[
0
][
Cprimebyte
[
0
]]
|
polarParams
->
B_tab0
[
1
][
Cprimebyte
[
1
]]
|
polarParams
->
B_tab0
[
2
][
Cprimebyte
[
2
]]
|
polarParams
->
B_tab0
[
3
][
Cprimebyte
[
3
]]
|
polarParams
->
B_tab0
[
4
][
Cprimebyte
[
4
]]
|
polarParams
->
B_tab0
[
5
][
Cprimebyte
[
5
]]
|
polarParams
->
B_tab0
[
6
][
Cprimebyte
[
6
]]
|
polarParams
->
B_tab0
[
7
][
Cprimebyte
[
7
]];
}
else
if
(
polarParams
->
K
<
129
)
{
int
len
=
polarParams
->
K
/
8
;
if
((
polarParams
->
K
&
7
)
>
0
)
len
++
;
for
(
int
k
=
0
;
k
<
len
;
k
++
)
{
B
[
0
]
|=
polarParams
->
B_tab0
[
k
][
Cprimebyte
[
k
]];
B
[
1
]
|=
polarParams
->
B_tab1
[
k
][
Cprimebyte
[
k
]];
}
}
int
len
=
polarParams
->
payloadBits
;
//int len_mod64=len&63;
int
crclen
=
polarParams
->
crcParityBits
;
uint64_t
rxcrc
=
B
[
0
]
&
((
1
<<
crclen
)
-
1
);
uint32_t
crc
;
uint64_t
Ar
;
AssertFatal
(
len
<
65
,
"A must be less than 65 bits
\n
"
);
if
(
len
<=
32
)
{
Ar
=
(
uint32_t
)(
B
[
0
]
>>
crclen
);
uint8_t
A32_flip
[
4
];
uint32_t
Aprime
=
(
uint32_t
)(
Ar
<<
(
32
-
len
));
A32_flip
[
0
]
=
((
uint8_t
*
)
&
Aprime
)[
3
];
A32_flip
[
1
]
=
((
uint8_t
*
)
&
Aprime
)[
2
];
A32_flip
[
2
]
=
((
uint8_t
*
)
&
Aprime
)[
1
];
A32_flip
[
3
]
=
((
uint8_t
*
)
&
Aprime
)[
0
];
crc
=
(
uint64_t
)(
crc24c
(
A32_flip
,
len
)
>>
8
);
}
else
if
(
len
<=
64
)
{
Ar
=
(
B
[
0
]
>>
crclen
)
|
(
B
[
1
]
<<
(
64
-
crclen
));;
uint8_t
A64_flip
[
8
];
uint64_t
Aprime
=
(
uint32_t
)(
Ar
<<
(
64
-
len
));
A64_flip
[
0
]
=
((
uint8_t
*
)
&
Aprime
)[
7
];
A64_flip
[
1
]
=
((
uint8_t
*
)
&
Aprime
)[
6
];
A64_flip
[
2
]
=
((
uint8_t
*
)
&
Aprime
)[
5
];
A64_flip
[
3
]
=
((
uint8_t
*
)
&
Aprime
)[
4
];
A64_flip
[
4
]
=
((
uint8_t
*
)
&
Aprime
)[
3
];
A64_flip
[
5
]
=
((
uint8_t
*
)
&
Aprime
)[
2
];
A64_flip
[
6
]
=
((
uint8_t
*
)
&
Aprime
)[
1
];
A64_flip
[
7
]
=
((
uint8_t
*
)
&
Aprime
)[
0
];
crc
=
(
uint64_t
)(
crc24c
(
A64_flip
,
len
)
>>
8
);
}
#if 0
printf("A %llx B %llx|%llx Cprime %llx|%llx (crc %x,rxcrc %llx %d)\n",
Ar,
B[1],B[0],Cprime[1],Cprime[0],crc,
rxcrc,polarParams->payloadBits);
printf("A %llx B %llx|%llx Cprime %llx|%llx (crc %x,rxcrc %llx %d)\n",
Ar,
B[1],B[0],Cprime[1],Cprime[0],crc,
rxcrc,polarParams->payloadBits);
#endif
out
[
0
]
=
Ar
;
out
[
0
]
=
Ar
;
for
(
int
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
printf
(
"alpha[%d]=%d, beta[%d]=%d
\n
"
,
i
,
polarParams
->
tree
.
root
->
alpha
[
i
],
i
,
polarParams
->
tree
.
root
->
beta
[
i
]);
return
(
crc
^
rxcrc
);
if
(
crc
==
rxcrc
)
return
(
0
);
memcpy
((
void
*
)
&
polarParams
->
tree
.
root
->
alpha
[
0
],(
void
*
)
&
polarParams
->
tree
.
root
->
beta
[
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
}
return
(
-
1
);
}
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
796c931a
...
...
@@ -70,6 +70,7 @@ typedef struct decoder_node_t_s {
int
all_frozen
;
int16_t
*
alpha
;
int16_t
*
beta
;
int16_t
*
soft_beta
;
}
decoder_node_t
;
typedef
struct
decoder_tree_t_s
{
...
...
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