Code

WCDMA channelization code generator

Markus Nentwig November 13, 20101 comment Coded in Matlab

Generates wideband CDMA channelization codes, based on 3GPP TS 25.213 V10.0.0 section 4.3.1.1

http://www.3gpp.org/ftp/Specs/archive/25_series/25.213/25213-a00.zip

% WCDMA channelization codes 
% source:
% 3GPP TS 25.213 V10.0.0 section 4.3.1.1
%
% parameters: 
% sf: spreading factor
% k: code number
%
% The returned code is a column vector with length sf
%
% this code has not been tested extensively. Please verify
% independently that it does what it promises.
function code=UTRA_FDD_chanCode(sf, k)
persistent flag;
persistent codes;

% * ********************************************
% * Build codebook
% * ********************************************
if isempty(flag)
  codes={};
  flag=1;
  
  % start of recursion: Identity code for sf=1
  codes{1, 1}=1;
  for sfi=1:8
    sfg=2 ^ sfi;
    for kgDest=0:2:sfg-2
      kgSrc=kgDest/2;
      prev=codes{sfg/2, kgSrc+1};
      % generation method:
      % - duplicate a lower-sf code
      % - duplicate and change sign
      codes{sfg, kgDest+1}=[prev prev];
      codes{sfg, kgDest+2}=[prev -prev];
    end
  end
end

% * ********************************************
% * look up the requested code from codebook
% * ********************************************
code=transpose(codes{sf, k+1});

% ################## CUT HERE ######################### 

% Example use (put this into a separate file)
sf=128; codenum=3;
chanCode=UTRA_FDD_chanCode(sf, codenum);

sig=[1 0 0 1 0 0 ]; % signal, row vector
len=size(sig, 2), 
% convolve:
s=chanCode * sig; % now matrix, one row per repetition
len=len*sf;
s=reshape(s, 1, len);
% plot
stem(s);

Comments:

manyu1994
Said:
I need golay code (24,12) in vhdl
5 years ago
0
Reply
Sorry, you need javascript enabled to post any comments.
Sorry, you need javascript enabled to post any comments.