Skip to content

Commit add70f6

Browse files
committed
Update documentation
1 parent 4f46c8d commit add70f6

6 files changed

Lines changed: 59 additions & 27 deletions

File tree

src/bitDeMapping.jl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ Output bitsream is Array{Int8}
1414
- qamVect : Complex observation vector to decode.
1515
# --- Output parameters
1616
- []
17-
# ---
18-
# v 1.0 - Robin Gerzaguet.
1917
"""
2018
function bitDemappingQAM!(hardBits,M, qamVect)
2119
# ----------------------------------------------------
@@ -376,7 +374,22 @@ function bitDemappingQAM!(hardBits,M, qamVect)
376374
end
377375

378376

379-
377+
"""
378+
---
379+
Quadrature Amplitude Modulation (QAM) hard decoding function
380+
Apply symbol hard demapping to a input symbol sequence (of size 1xN) with constellation size M.
381+
Output is a binary (1xL) with N = L / log2(M)
382+
Conventional gray demapping is used.
383+
Input constellation is Array{Complex{Float64}}
384+
Output bitsream is Array{Int8}
385+
# --- Syntax
386+
hardBits = bitDemappingQAM!(hardBits,M,qamVect)
387+
# --- Input parameters
388+
- M : Constellation size (i.e from 4 to 256)
389+
- qamVect : Complex observation vector to decode.
390+
# --- Output parameters
391+
- hardBits : Vector of bits to populate [Array{UInt8}, length(qamVect)/log2(M)]
392+
"""
380393
function bitDemappingQAM(M,qamVect);
381394
# --- Create receive bit vector
382395
hardBits = zeros(UInt8, Int(length(qamVect)*log2(M)));

src/bitMapping.jl

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ Quadrature Amplitude Modulation (QAM) function
1717
- bitSeq : Binary sequence to be transformed into QPSK symbols [Array{UInt8}]
1818
# --- Output parameters
1919
- []
20-
# ---
21-
# v 1.0 - Robin Gerzaguet.
2220
"""
2321
function bitMappingQAM!(qamMat,M, bitSeq)
2422
# ----------------------------------------------------
@@ -166,8 +164,27 @@ function bitMappingQAM!(qamMat,M, bitSeq)
166164
end
167165

168166
# ----------------------------------------------------
169-
# --- No allocation function
167+
# --- Allocating function
170168
# ----------------------------------------------------
169+
"""
170+
---
171+
Quadrature Amplitude Modulation (QAM) function
172+
Apply symbol mapping to a input binary sequence (of size 1xL) with constellation size M.
173+
Output is a vector (1xN) with N = L / log2(M)
174+
Conventional gray mapping is used. Output constellation is casted in float, with unitary average power
175+
Supported constellation
176+
* QPSK
177+
* 16-QAM
178+
* 64-QAM
179+
* 256-QAM
180+
# --- Syntax
181+
qamMat = bitMappingQAM(M,bitSeq)
182+
# --- Input parameters
183+
- M : Modulation size (i.e from 4 to 256) such as bit per symbol is log2(M) [Int]
184+
- bitSeq : Binary sequence to be transformed into QPSK symbols [Array{UInt8}]
185+
# --- Output parameters
186+
- qamMat : Complex Vector to populate of size length(bitSeq) / log2(M) [Array{Complex{Float64}}]
187+
"""
171188
function bitMappingQAM(M,bitSeq)
172189
nbBits = length(bitSeq);
173190
nbSymb = Int( nbBits ÷ log2(M));

src/genBitSequence.jl

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,19 @@ using Random
1212

1313
"""
1414
---
15-
Create a binary sequence and populate input buffer with nbBits bits
15+
Create a binary sequence and populate input buffer with bits
1616
The array is of type UInt8 with x00 or x01)
1717
If stated, randSeed controls the seed of the random generator
1818
# --- Syntax
1919
genBitsequence!(buffer,nbBits,randSeed=-1);
2020
# --- Input parameters
2121
- buffer : Buffer to populate [Array{UInt8,nbBits}]
2222
- nbBits : Number of bits to generate [Int]
23-
- randSeed : Seed of random process (default -> -1)
23+
- randSeed : Seed of random process (default -> -1, no seed is used)
2424
# --- Output parameters
2525
- buffer : Populated buffer [Array{UInt8}]
26-
# ---
27-
# v 1.0 - Robin Gerzaguet.
2826
"""
29-
function genBitSequence!(buffer::Array{UInt8},nbBits,randSeed=-1)
27+
function genBitSequence!(buffer::Array{UInt8},randSeed=-1)
3028
# --- Setting the random seed if given
3129
if randSeed != -1
3230
# --- Seed as the second parameter
@@ -47,14 +45,12 @@ Create a binary sequence and return a buffer with nbBits bits
4745
The array is of type UInt8 with x00 or x01)
4846
If stated, randSeed controls the seed of the random generator
4947
# --- Syntax
50-
genBitsequence!(nbBits,randSeed=-1);
48+
genBitsequence(nbBits,randSeed=-1);
5149
# --- Input parameters
5250
- nbBits : Number of bits to generate [Int]
5351
- randSeed : Seed of random process (default -> -1) [Int]
5452
# --- Output parameters
5553
- buffer : Populated buffer [Array{UInt8}]
56-
# ---
57-
# v 1.0 - Robin Gerzaguet.
5854
"""
5955
function genBitSequence(nbBits,randSeed=-1)
6056
# --- Setting the random seed if given
@@ -65,7 +61,7 @@ function genBitSequence(nbBits,randSeed=-1)
6561
# --- Create the input buffer
6662
buffer = zeros(UInt8,nbBits);
6763
# --- Call the bang method
68-
genBitSequence!(buffer,nbBits,randSeed);
64+
genBitSequence!(buffer,randSeed);
6965
# --- Return the buffer
7066
return buffer;
7167
end
@@ -81,14 +77,13 @@ If stated, randSeed controls the seed of the random generator
8177
genByteSequence!(buffer,nbBytes,randSeed=-1);
8278
# --- Input parameters
8379
- buffer : Buffer to populate [Array{UInt8,nbByte}]
84-
- nbBytes : Number of byte to generate [Int]
8580
- randSeed : Seed of random process (default -> -1)
8681
# --- Output parameters
8782
- buffer : Populated buffer [Array{UInt8}]
8883
# ---
8984
# v 1.0 - Robin Gerzaguet.
9085
"""
91-
function genByteSequence!(buffer::Array{UInt8},nbBytes,randSeed=-1)
86+
function genByteSequence!(buffer::Array{UInt8},randSeed=-1)
9287
# --- Setting the random seed if given
9388
if randSeed != -1
9489
# --- Seed as the second parameter
@@ -97,7 +92,6 @@ function genByteSequence!(buffer::Array{UInt8},nbBytes,randSeed=-1)
9792
# --- Generating byte sequence
9893
Random.rand!(buffer, 0x00:0x01:0xff);
9994
# --- Switch to "pure" random system
100-
RandomDevice();
10195
if randSeed != -1
10296
RandomDevice();
10397
end
@@ -123,7 +117,7 @@ function genByteSequence(nbBytes,randSeed=-1)
123117
# --- Create buffer
124118
buffer = zeros(UInt8,nbBytes);
125119
# --- Call !
126-
genByteSequence!(buffer,nbBytes,randSeed);
120+
genByteSequence!(buffer,randSeed);
127121
end
128122

129123

src/hardConstellation.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Return the hard decoded constellation with voronoi baseds decision. The differen
1010
- qamMat : Vector to decode
1111
# --- Output parameters
1212
- []
13-
# ---
14-
# v 1.0 - Robin Gerzaguet.
1513
"""
1614
function hardConstellation!(qamThres,M, qamMat)
1715
# ----------------------------------------------------
@@ -132,6 +130,18 @@ function hardConstellation!(qamThres,M, qamMat)
132130
return qamThres;
133131
end
134132

133+
"""
134+
---
135+
Quadrature Amplitude Modulation (QAM) hard decoding function
136+
Return the hard decoded constellation with voronoi baseds decision. The difference with bitDeMapping is that bitDeMapping returns the decoded bit sequence whereas hardConstellation returns the closest constellation point. This can be use to compute raw EVM estimation (assuming a sufficiently high SNR to avoid errors).
137+
# --- Syntax
138+
qamDec = hardConstellation!(qamDec,M,qamMat)
139+
# --- Input parameters
140+
- M : Constellation size (i.e 4 to 256)
141+
- qamMat : Vector to decode
142+
# --- Output parameters
143+
- qamDec : Vector to populate [Array{Complex{Float64},N}] with N = length(qamMat)
144+
"""
135145
function hardConstellation(M,qamMat)
136146
qamThres = zeros(Complex{Float64},length(qamMat));
137147
hardConstellation!(qamThres,M,qamMat);

src/symbolDemapper.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,13 @@ Returns the log likelihood ratio of the incoming sequence qamSeq based on the ch
6969
qamSeq is an input noisy QAM sequence with same size of channel estimate vector
7070
Output is a vector of soft output binary sequence to be fed in a FEC
7171
# --- Syntax
72-
output = :symbolDemappingQAM(mcs,qamSeq,channel)
72+
output = symbolDemappingQAM(mcs,qamSeq,channel)
7373
# --- Input parameters
7474
- mcs : Constellation size (from 4 to 256) [Int]
7575
- qamSeq : Complex noisy received sequence (after equalization) [Array{Float64},N]
7676
- channel : Complex channel estimate [Array{Float64},N]
7777
# --- Output parameters
7878
- output : Soft bits [Array{UInt8},N*log2(mcs)]
79-
# ---
80-
# v 1.0 - Robin Gerzaguet.
8179
"""
8280
function symbolDemappingQAM(mcs,qamSeq,channel)
8381
# --- Creating output array for allocation

test/test_genBitSequence.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ println("Tests for binary sequence generation");
2020
@test unique(bitSeq) == [0x00,0x01] || unique(bitSeq) == [0x01,0x00] ;
2121
# --- Checking bang method
2222
bitSeq2 = zeros(UInt8,N);
23-
genBitSequence!(bitSeq2,N,rSeed);
23+
genBitSequence!(bitSeq2,rSeed);
2424
# --- Ensure that output is a UInt8 vector
2525
@test typeof(bitSeq2) == Array{UInt8,1};
2626
# --- Checking 0 and 1 populate the buffer
@@ -42,11 +42,11 @@ end
4242
@test typeof(byteSeq) == Array{UInt8,1};
4343
# --- Checking bang method
4444
byteSeq2 = zeros(UInt8,N);
45-
genByteSequence!(byteSeq2,N,rSeed);
45+
genByteSequence!(byteSeq2,rSeed);
4646
# --- Ensure that output is a UInt8 vector
4747
@test typeof(byteSeq2) == Array{UInt8,1};
4848
# --- Seed should have generated same vector for both call
4949
@test (byteSeq == byteSeq2)
50-
# --- Forcing a random seed and check taht vector is different
50+
# --- Forcing a random seed and check that vector is different
5151
@test (genByteSequence(N) != byteSeq)
5252
end

0 commit comments

Comments
 (0)