Turbo Encoder/Decoder MegaCore Function User...

50
Turbo Encoder/Decoder MegaCore Function User Guide Version 1.0 April 2000

Transcript of Turbo Encoder/Decoder MegaCore Function User...

Page 1: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCoreFunction User Guide

Version 1.0April 2000

Page 2: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Altera, APEX, APEX 20K, APEX 20KE, MegaCore, MegaWizard, OpenCore, Quartus, and specific device designations are trademarks and/or servicemarks of Altera Corporation in the United States and other countries. Product design elements and mnemonics used by Altera Corporation are protectedby copyright and/or trademark laws.

Altera Corporation acknowledges the trademarks of other organizations for their respective products or services mentioned in this document, includingthe following: Verilog is a registered trademark of Cadence Design Systems, Incorporated. Microsoft is a registered trademark and Windows is atrademark of Microsoft Corporation.

Altera reserves the right to make changes, without notice, in the devices or the device specifications identified in this document. Altera advises itscustomers to obtain the latest version of device specifications to verify, before placing orders, that the information being relied upon by the customer iscurrent. Altera warrants performance of its semiconductor products to current specifications in accordance with Altera’s standard warranty. Testingand other quality control techniques are used to the extent Altera deems such testing necessary to support this warranty. Unless mandated bygovernment requirements, specific testing of all parameters of each device is not necessarily performed. In the absence of written agreement to thecontrary, Altera assumes no liability for Altera applications assistance, customer’s product design, or infringement of patents or copyrights of thirdparties by or arising from use of semiconductor devices described herein. Nor does Altera warrant or represent any patent right, copyright, or otherintellectual property right of Altera covering or relating to any combination, machine, or process in which such semiconductor devices might be or areused.

Altera products are not authorized for use as critical components in life support devices or systems without the express written approval of the presidentof Altera Corporation. As used herein:

1. Life support devices or systems are devices or systems that (a) are intended for surgical implant into the body or (b) support or sustain life, and whosefailure to perform, when properly used in accordance with instructions for use provided in the labeling, can be reasonably expected to result in asignificant injury to the user.

2. A critical component is any component of a life support device or system whose failure to perform can be reasonably expected to cause the failure ofthe life support device or system, or to affect its safety or effectiveness.

Products mentioned in this document are covered by one or more of the following U.S. patents: 6,032,159; 6,031,763; 6,031,391; 6,029,236; 6,028,809;6,028,808; 6,028,787; 6,026,226; 6,025,737; 6,023,439; 6,020,760; 6,020,759; 6,020,758; 6,018,490; 6,018,476; 6,014,334; 6,011,744; 6,011,730; 6,011,406;6,005,379; 5,999,016; 5,999,015; 5,998,295; 5,996,039; 5,986,470; 5,986,465; 5,983,277; 5,982,195; 5,978,476; 5,977,793; 5,977,791; 5,968,161; 5,970,255;5,966,597; 5,963,565; 5,969,051; 5,963,069; 5,963,049; 5,959,891; 5,953;537; 5,949,991; 5,949,710; 5,949,250; 5,949,239; 5,954,751; 5,943,267; 5,942,914;5,940,852; 5,939,790; 5,936,425; 5,926,036; 5,925,904; 5,923,567; 5,915,756; 5,915,017; 5,909,450; 5,909,375; 5,909,126; 5,905,675; 5,904,524; 5,900,743;5,898,628; 5,898,318; 5,894,228; 5,893,088; 5,892,683; 5,883,526; 5,880,725; 5,880,597; 5,880,596; 5,878,250; 5,875,112; 5,873,113; 5,872,529; 5,872,463;5,870,410; 5,869,980; 5,869,979; 5,861,760; 5,859,544; 5,859,542; 5,850,365; 5,850,152; 5,850,151; 5,848,005; 5,847,617; 5,845,385; 5,844,854; RE35,977;5,838,628; 5,838,584; 5,835,998; 5,834,849; 5,828,229; 5,825,197; 5,821,787: 5,821,773; 5,821,771; 5,815,726; 5,815,024; 5,815,003; 5,812,479; 5,812,450;5,809,281; 5,809,034; 5,805,516; 5,802,540; 5,801,541; 5,796,267; 5,793,246; 5,790,469; 5,787,009; 5,771,264; 5,768,562; 5,768,372; 5,767,734; 5,764,583;5,764,569; 5,764,080; 5,764,079; 5,761,099; 5,760,624; 5,757,207; 5,757,070; 5,744,991; 5,744,383; 5,740,110; 5,732,020; 5,729,495; 5,717,901; 5,705,939;5,699,020; 5,699,312; 5,696,455; 5,693,540; 5,694,058; 5,691,653; 5,689,195; 5,668,771; 5,680,061; 5,672,985; 5,670,895; 5,659,717; 5,650,734; 5,649,163;5,642,262; 5,642,082; 5,633,830; 5,631,576; 5,621,312; 5,614,840; 5,612,642; 5,608,337; 5,606,276; 5,606,266; 5,604,453; 5,598,109; 5,598,108; 5,592,106;5,592,102; 5,590,305; 5,583,749; 5,581,501; 5,574,893; 5,572,717; 5,572,148; 5,572,067; 5,570,040; 5,567,177; 5,565,793; 5,563,592; 5,561,757; 5,557,217;5,555,214; 5,550,842; 5,550,782; 5,548,552; 5,548,228; 5,543,732; 5,543,730; 5,541,530; 5,537,295; 5,537,057; 5,525,917; 5,525,827; 5,523,706; 5,523,247;5,517,186; 5,498,975; 5,495,182; 5,493,526; 5,493,519; 5,490,266; 5,488,586; 5,487,143; 5,486,775; 5,485,103; 5,485,102; 5,483,178; 5,477,474; 5,473,266;5,463,328, 5,444,394; 5,438,295; 5,436,575; 5,436,574; 5,434,514; 5,432,467; 5,414,312; 5,399,922; 5,384,499; 5,376,844; 5,371,422; 5,369,314; 5,359,243;5,359,242; 5,353,248; 5,352,940; 5,309,046; 5,350,954; 5,349,255; 5,341,308; 5,341,048; 5,341,044; 5,329,487; 5,317,210; 5,315,172; 5,301,416; 5,294,975;5,285,153; 5,280,203; 5,274,581; 5,272,368; 5,268,598; 5,266,037; 5,260,611; 5,260,610; 5,258,668; 5,247,478; 5,247,477; 5,243,233; 5,241,224; 5,237,219;5,220,533; 5,220,214; 5,200,920; 5,187,392; 5,166,604; 5,162,680; 5,144,167; 5,138,576; 5,128,565; 5,121,006; 5,111,423; 5,097,208; 5,091,661; 5,066,873;5,045,772; 4,969,121; 4,930,107; 4,930,098; 4,930,097; 4,912,342; 4,903,223; 4,899,070; 4,899,067; 4,871,930; 4,864,161; 4,831,573; 4,785,423; 4,774,421;4,713,792; 4,677,318; 4,617,479; 4,609,986; 4,020,469; and certain foreign patents.

Altera products are protected under numerous U.S. and foreign patents and pending applications, maskwork rights, andcopyrights.

Copyright © 2000 Altera Corporation. All rights reserved.

Printed on Recycled Paper.

Page 3: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

®

About this User Guide

User Guide

This user guide provides comprehensive information about the Altera® turbo encoder/decoder MegaCore™ function.

� For the most up-to-date information about Altera IP products, go to the Altera world-wide web site at http://www.altera.com/IPMegaStore.

How to Contact Altera

For additional information about Altera products, consult the sources shown in Table 1.

Note:(1) You can also contact your local Altera sales office or sales representative.

Table 1. How to Contact Altera

Information Type Access USA & Canada All Other Locations

Technical support Telephone hotline (800) 800-EPLD(6:00 a.m. to 6:00 p.m. Pacific Time)

(408) 544-7000 (1)(7:30 a.m. to 5:30 p.m. Pacific Time)

Fax (408) 544-6401 (408) 544-6401 (1)

Electronic mail [email protected] [email protected]

FTP site ftp.altera.com ftp.altera.com

Altera Literature Services

Telephone hotline (888) 3-ALTERA (1) (408) 544-7144 (1)

Fax (please specify Altera Literature)

(408) 935-0515 (408) 935-0515

Electronic mail [email protected] (1) [email protected] (1)

Non-technical customer service

Telephone hotline (800) SOS-EPLD (408) 544-7000 (7:30 a.m. to 5:30 p.m. Pacific Time)

Fax (408) 544-7606 (408) 544-7606

General product information

Telephone (408) 544-7104 (408) 544-7104 (1)

World-wide web site http://www.altera.com/IPMegaStore

http://www.altera.com/IPMegaStore

Altera Corporation iii

Page 4: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

About this User Guide

Typographic Conventions

The Turbo Encoder/Decoder MegaCore Function User Guide uses the typographic conventions shown in Table 2.

Table 2. Conventions

Visual Cue Meaning

Bold Type with Initial Capital Letters

Command names, dialog box titles, checkbox options, and dialog box options are shown in bold, initial capital letters. Example: Save As dialog box.

bold type External timing parameters, directory names, project names, disk drive names, filenames, filename extensions, and software utility names are shown in bold type. Examples: fMAX, \maxplus2 directory, d: drive, chiptrip.gdf file.

Bold italic type Book titles are shown in bold italic type with initial capital letters. Example: 1999 Device Data Book.

Italic Type with Initial Capital Letters

Document titles are shown in italic type with initial capital letters. Example: AN 75 (High-Speed Board Design).

Italic type Internal timing parameters and variables are shown in italic type. Examples: tPIA, n + 1.Variable names are enclosed in angle brackets (< >) and shown in italic type. Example: <file name>, <project name>.pof file.

Initial Capital Letters Keyboard keys and menu names are shown with initial capital letters. Examples: Delete key, the Options menu.

“Subheading Title” References to sections within a document and titles of Quartus and MAX+PLUS II Help topics are shown in quotation marks. Example: “Configuring a FLEX 10K or FLEX 8000 Device with the BitBlaster™ Download Cable.”

Courier type Reserved signal and port names are shown in uppercase Courier type. Examples: DATA1, TDI, INPUT.

User-defined signal and port names are shown in lowercase Courier type. Examples: my_data, ram_input.

Anything that must be typed exactly as it appears is shown in Courier type. For example: c:\max2work\tutorial\chiptrip.gdf. Also, sections of an actual file, such as a Report File, references to parts of files (e.g., the AHDL keyword SUBDESIGN), as well as logic function names (e.g., TRI) are shown in Courier.

1., 2., 3., and a., b., c.,... Numbered steps are used in a list of items when the sequence of the items is important, such as the steps listed in a procedure.

� Bullets are used in a list of items when the sequence of the items is not important.

� The checkmark indicates a procedure that consists of one step only.

� The hand points to information that requires special attention.

� The angled arrow indicates you should press the Enter key.

� The feet direct you to more information on a particular topic.

iv Altera Corporation

Page 5: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

®

Contents

April 2000, ver.1 User Guide

Specifications—Encoder ............................................................................................................................7Features .............................................................................................................................................9General Description .........................................................................................................................9Functional Description ..................................................................................................................11Performance ....................................................................................................................................15

Specifications—Decoder..........................................................................................................................17Features ...........................................................................................................................................19General Description .......................................................................................................................19Functional Description ..................................................................................................................21Performance ....................................................................................................................................29Typical Configurations .................................................................................................................31

Getting Started .............................................................................................................................................33Downloading & Installing the Function .....................................................................................35Generating a Custom Turbo Function ........................................................................................37Using the C-Model .........................................................................................................................42Using the VHDL Model ................................................................................................................45Performing Synthesis, Compilation & Post-Routing Simulation ...........................................49Configuring a Device .....................................................................................................................50

Altera Corporation v

Page 6: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Notes:

Page 7: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

®

Altera Corporation 7

Specifications—EncoderContents

User Guide

1

Specifications—Encoder

Features .............................................................................................................................................9General Description .........................................................................................................................9

The Turbo Encoder ................................................................................................................10Interleavers .............................................................................................................................10

Functional Description ..................................................................................................................11Using the Turbo Encoder ......................................................................................................12

Performance ....................................................................................................................................15

Page 8: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Notes:

Page 9: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

®

Specifications—Encoder

User Guide

1

Specifications—Encoder

Features � Compliant with the 3rd Generation Partnership Project (3GPP); Technical Specification Group Radio Access Network; Multiplexing and Channel Coding (FDD) (3G TS 25.212 version 3.1.0)

� Dramatically shortens design cycles� Optimized for the Altera® APEX™ 20K architecture� OpenCore™ feature allows you to instantiate and simulate designs in

the Quartus™ software before licensing

General Description

A significant amount of research has been carried out to make efficient use of available bandwidth. This research has led to the development of sophisticated coding schemes. The last major step was the introduction of the Viterbi and Reed-Solomon decoders. Since then, a new method has emerged. A combination of iteratively run ‘soft in/soft out’ decoders with simple component codes and an interleaver have allowed the gap to the theoretical limit (Shannon limit) to be narrowed even further. This process is referred to as ‘turbo coding’ or ‘iterative decoding’.

The basic block diagram of a turbo encoder/decoder is shown in Figure 1.

Figure 1. Turbo Encoder/Decoder Block Diagram

Turbo Encoder Turbo Decoder

Information bits

Transmittedinformation

bits

Received information bits

Interleaver

max-logMAPDecoder 1

Encoder 1

Transmittedparity bits

Received parity bits

Encoder 2

max-logMAPDecoder 2

Interleaver De-interleaverDe-puncture

Puncture

CHANNEL

n

Altera Corporation 9

Page 10: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Specifications—Encoder Turbo Encoder/Decoder MegaCore Function User Guide

The Turbo Encoder

The turbo encoder MegaCore™ function uses a stream-driven implementation and feeds the incoming information bits through to the output. In addition, it encodes them using encoder 1, a recursive convolutional encoder. It also feeds the information bits via a pseudo random interleaver into encoder 2. The encoded bit streams can be punctured to save bandwidth.

Interleavers

Interleaving is the process of reordering a binary sequence in a systematic way. Convolutional codes are designed to combat random independent errors. However, errors typically come in bursts rather than being randomly distributed. Interleaving can be used to disperse the burst errors, making them easier to correct.

The turbo encoder interleaver, as defined by 3GPP, is a 3-stage interleaver with a block size between 320 and 5,114. The input sequence is first written row by row into a matrix. The rows are then algebraically interleaved, based on sets of prime integers. Each row is then interleaved with a predefined pattern. The output sequence is generated by reading out the matrix, column by column. The output sequence is pruned in the cases where the input sequence does not exactly fill the matrix.

10 Altera Corporation

Page 11: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide Specifications—Encoder

1

Specifications—Encoder

Functional Description

Figure 2 shows the turbo encoder interface.

Figure 2. The Turbo Encoder Interface

Table 1 shows the interface signal definitions.

Note:(1) ITLV_INIT can be asserted only when INPUT_READY is high, and before data is shifted-in. If you wish to

reinitialize the interleaver at any other time, ABORT must be asserted. This returns the encoder to a state where it can respond to ITLV_INIT.

DATA_IN DATA_OUT

PUNCT_ENABLE

ABORT

SHIFT_IN_ENABLE

SHIFT_OUT_ENABLE

INPUT_READYOUTPUT_READY

RESET

CLK

BLOCK_SIZE

ITLV_INIT

Table 1. Interface Signals

Signal Name Width Description

CLK 1 Clock.

RESET 1 Asynchronous reset.

ABORT 1 Synchronous reset.

BLOCK_SIZE 13 Block size. Between 320 and 5,114

ITLV_INIT 1 Interleaver initialization. Must be asserted high for one or more clock cycles after reset, or after changing BLOCK_SIZE. (1)

INPUT_READY 1 Indicates that the encoder is ready to accept input data.

OUTPUT_READY 1 Indicates that the encoder is ready to output data.

SHIFT_IN_ENABLE 1 When high, DATA_IN will be shifted into the turbo encoder on the next rising clock edge.

SHIFT_OUT_ENABLE 1 When high, the next output will be made available on DATA_OUT after the next rising clock edge.

DATA_IN 1 Data input.

DATA_OUT 1 Data output.

PUNCT_ENABLE 1 Puncture rate. When 0, no puncturing, rate = 1/3; when 1, rate = 1/2.

Altera Corporation 11

Page 12: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Specifications—Encoder Turbo Encoder/Decoder MegaCore Function User Guide

Using the Turbo Encoder

The turbo encoder is a slave device that is operated using two control input signals: SHIFT_IN_ENABLE and SHIFT_OUT_ENABLE. Being a slave device, it is up to the host to provide the control signals at the correct time with regard to the encoder’s state. Two status signals are used to indicate the encoders state: INPUT_READY and OUTPUT_READY.

The process of encoding a block of data can be broken down into four phases.

The Shift-In Phase

Figure 3 shows the shift-in phase timing diagram. Shifting-in can only commence if INPUT_READY is high. ITLV_INIT is asserted high for one clock cycle to initialize the interleaver (necessary only if BLOCK_SIZE is changed and after RESET). The data at DATA_IN must be valid when SHIFT_IN_ENABLE is high, as it will be registered on the next rising clock edge. After a rising clock edge, DATA_IN may be changed without asserting SHIFT_IN_ENABLE low. SHIFT_IN_ENABLE may be asserted low at any time to insert a pause in the input stream if data cannot be made available before the rising clock edge.

Figure 3. The Shift-in Phase Timing Diagram

The Active Phase

Figure 4 shows the active phase timing diagram. The encoder will go into the active phase automatically when it detects that the required number of bits have been shifted in. The host should not try to shift more data in, any attempt to do so is be ignored by the encoder.

DATA_IN

SHIFT_IN_ENABLE

CLK

D1 D2 D3 D4 D5

ITLV_INIT

INPUT_READY

SHIFT_OUT_ENABLE

DATA_OUT X

X X

12 Altera Corporation

Page 13: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide Specifications—Encoder

1

Specifications—Encoder

During the active phase the encoder interleaves and encodes the information, generates the tail bits, and prepares itself to produce punctured output data. The active phase lasts for more than BLOCK_SIZE clock cycles. When the active phase is over, the encoder will automatically enter the shift-out phase.

Figure 4. The Active Phase Timing Diagram

The Shift-Out Phase

Figure 5 shows the shift-out phase timing diagram. After OUTPUT_READY has gone from low to high, the encoder is ready to shift-out the data using SHIFT_OUT_ENABLE. The output is registered and DATA_OUT is not valid until after the next rising clock edge. SHIFT_OUT_ENABLE can be asserted low at any time to create a pause in the output stream. When all of the punctured data has been read from the encoder, it enters the finished phase.

Trellis Termination of Turbo Code

The trellis termination of the turbo code is described in 3rd Generation Partnership Project (3GPP); Technical Specification Group Radio Access Network; Multiplexing and Channel Coding (FDD) (3G TS 25.212 version 3.1.0). The relevant section is repeated here.

Tail bits are added after the encoding of information bits. The trellis is terminated by taking the tail bits from the shift register feedback after all of the information bits have been encoded. The first three tail bits are used to terminate the first convolutional encoder; the last three tail bits to terminate the second convolutional encoder. Each tail bit is followed by a parity bit from the convolutional encoder being terminated. The tail bits emerge from the encoder in the following sequence:

X(t) Y(t) X(t+1) Y(t+1) X(t+2) Y(t+2) X’(t) Y’(t) X’(t+1) Y’(t+1) X’(t+2) Y’(t+2)

DATA_IN

SHIFT_IN_ENABLE

CLK

D326 X

INPUT_READY

D325D324

SHIFT_OUT_ENABLE

DATA_OUT X

Altera Corporation 13

Page 14: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Specifications—Encoder Turbo Encoder/Decoder MegaCore Function User Guide

where:

X is the tail bit from the first convolutional encoderY is the parity bit from the first convolutional encoderX’ is the tail bit from the second convolutional encoderY’ is the parity bit from the second convolutional encoder

� The tail is not effected by puncturing, for a given set of information input bits, i.e. it is identical for punctured and non-punctured encoded outputs.

During the normal phase, the information and parity sequences emerge from the encoder as shown in the following sequences: X(t) Y(t) Y'(t) X(t+1) Y(t+1) Y'(t+1) ...(unpunctured); X(t) Y(t) X(t+1) Y'(t+1) X(t+2) Y(t+2) ...(punctured).

Figure 5. The Shift-Out Phase Timing Diagram

The Finished Phase

In the finished phase, the encoder prepares itself for the next block of data by clearing all registers. OUTPUT_READY is asserted low after the final data has been shifted out by the host system (see Figure 6). One clock cycle later the encoder will return to the shift-in phase, ready to accept the next block. OUTPUT_READY will remain low until the next block of data is ready to be shifted-out.

DATA_IN

SHIFT_IN_ENABLE

CLK

X

OUTPUT_READY

SHIFT_OUT_ENABLE

DATA_OUT X D5D1 D2 D3 D4

14 Altera Corporation

Page 15: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide Specifications—Encoder

1

Specifications—Encoder

Figure 6. The Finished Phase Timing Diagram

Performance Table 2 shows the function’s performance with various devices.

Size

The amount of logic needed for the turbo encoder MegaCore function is 2,892 logic elements (LEs). The function uses 10 embedded system blocks (ESBs).

DATA_IN

SHIFT_IN_ENABLE

CLK

X

OUTPUT_READY

SHIFT_OUT_ENABLE

DATA_OUT D326 XD325D324 D327 D328 D329

Table 2. Encoder Performance

Device Frequency (MHz)

APEX 20K100 -2 38

APEX 20K200 -2 34

APEX 20KE100 -2 50

APEX 20KE200 -2 48

APEX 20K100 -1 51

APEX 20KE100 -1 60

Altera Corporation 15

Page 16: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Specifications—Encoder Turbo Encoder/Decoder MegaCore Function User Guide

16 Altera Corporation

Page 17: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

®

Altera Corporation 17

Specifications—DecoderContents

User Guide

Specifications—

2

Decoder

Features ...........................................................................................................................................19General Description .......................................................................................................................19

Interleavers .............................................................................................................................20Turbo Encoder ........................................................................................................................20Turbo Decoder ........................................................................................................................21

Functional Description ..................................................................................................................21Data Format ............................................................................................................................22Memory Requirements ..........................................................................................................23Interface Definition ................................................................................................................24Decoder Operation ................................................................................................................26

Performance ....................................................................................................................................29Size ...........................................................................................................................................30

Typical Configurations .................................................................................................................31

Page 18: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Notes:

Page 19: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

®

Specifications—Decoder

User Guide

Specifications—

2

Decoder

Features � Compliant with 3rd Generation Partnership Project (3GPP); Technical Specification Group Radio Access Network; Multiplexing and Channel Coding (FDD) (3G TS 25.212 version 3.1.0)

� High-performance max-logMAP (logarithmic ‘maximum a posteriori’) decoder for maximum error correction

� Data rates in excess of 2 megabits per second (Mbps)� Includes 3GPP-compliant ‘mother’ interleaver� Interleaver block sizes from 320 to 5,114 bits� Block size can change between each block� Soft values (logarithmic likelihood) from 3 to 8 bits� Optional two memory banks for maximum throughput� Optimized for the Altera® APEX™ 20K and APEX 20KE architectures� MegaWizard™ Plug-In for easy parameterization

General Description

A significant amount of research has been carried out to make efficient use of available bandwidth. This research has led to the development of sophisticated coding schemes. The last major step was the introduction of the Viterbi and Reed-Solomon decoders. Since then, a new method has emerged. A combination of iteratively run ‘soft in/soft out’ decoders with simple component codes and an interleaver have allowed the gap to the theoretical limit (Shannon limit) to be narrowed even further. This process is referred to as ‘turbo coding’ or ‘iterative decoding’.

Figure 1 shows the basic block diagram of a turbo encoder/decoder.

Altera Corporation 19

Page 20: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Specifications—Decoder Turbo Encoder/Decoder MegaCore Function User Guide

Figure 1. Turbo Encoder/Decoder Block Diagram

Note:(1) Although the illustration shows two max-logMAP decoders, they are physically implemented as one max-logMAP

decoder.

Interleavers

Interleaving is the process of reordering a binary sequence in a systematic way. Convolutional codes are designed to combat random independent errors. For channels with memory, such as fading channels, this method is not optimal. Errors typically come in bursts rather than being randomly distributed. Interleaving can be used to disperse the burst errors, making them easier to correct.

Turbo Encoder

The turbo encoder feeds the incoming information bits through to the output. In addition, it encodes them using encoder 1, a recursive convolutional encoder. It also feeds the information bits via an interleaver into encoder 2. The encoded bit streams can be punctured to save bandwidth.

Turbo Encoder Turbo Decoder

Information bits

Transmittedinformation

bits

Received information bits

Interleaver

max-logMAPDecoder 1 (1)

Encoder 1

Transmittedparity bits

Received parity bits

Encoder 2

max-logMAPDecoder 2 (1)

Interleaver De-interleaverDe-puncture

Puncture

CHANNEL

n

20 Altera Corporation

Page 21: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide Specifications—Decoder

Specifications—

2

Decoder

Turbo Decoder

After depuncturing the received data stream, the information bits and parity 1 bits are fed into decoder 1. The equalizer (not shown in Figure 1) delivers soft information on the received data stream, i.e., it delivers probabilities of the received values. These probabilities can be interpreted as containing the received bit value and the confidence value, which indicates how likely it is that this bit is correct. Decoder 1 then evaluates these probabilities and combines them with the parity 1 probabilities. This refines the soft information so the confidence of individual bit correctness is maximized. The refined probabilities are fed into decoder 2 with the information bits and the parity 2 bits, again producing enhanced soft information. After a predefined number of iterations (typically three to six), the decoding process is completed, and the soft decision values are available at the output.

When data is exchanged between the two decoders, the soft values are reordered to match the interleaving structure. This reordering is done with the interleaver and deinterleaver between the decoders. When the second decoder has finished, the next iteration is started. Again, decoder 1 is activated using the soft information from the previous decoding as well as the information bits and parity 1 bits, and the second decoder is activated.

The decoding makes use of the ‘maximum a posteriori’ (MAP) algorithm; an extremely computationally intensive algorithm. There has been much work in both improving the efficiency and researching the use of alternatives. The only viable alternative is the soft output Viterbi algorithm (SOVA), which is similar to the algorithms used in some channel equalizers. However, SOVA is sub-optimum and is currently not supported by the Altera® turbo encoder/decoder MegaCore™ function.

Functional Description

Figure 2 shows an example system that contains the turbo decoder MegaCore function. In this example, the processor controls the operation of the core by setting up the parameters and initiating the decode of each block. The processor writes the information and parity data into the appropriate memory, and reads the decoded information from the information likelihood memory. All writing and reading is in the form of logarithmic likelihood values

Altera Corporation 21

Page 22: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Specifications—Decoder Turbo Encoder/Decoder MegaCore Function User Guide

Figure 2. An Example System

Data Format

The turbo decoder requires all data to be in the log-likelihood format. The equalizer has to provide soft information, also parity 1 and parity 2 bit sequences according to the following equation:

The log-likelihood value is the logarithm of the probability that the received bit is a ’0’, divided by the probability of this bit being a ’1’, and is represented as a two’s complement number. A value of zero indicates equal probability of a ‘1’ and a ‘0’, which should be used for de-puncturing. The most negative two’s complement number is unused so that the representation is balanced. As an example, Table 1 shows the meanings of 3-bit values.

The output data is provided in the same log-likelihood format. If only hard information is required, the sign bit can be considered as a hard decision bit.

Parity Likelihood Memory

Turbo Decoder Core

Information Likelihood Memory

Apriori Memory

Alpha Matrix Memory

Control Processor

L x( ) P x 0=( )P x 1=( )---------------------log=

Table 1. The Meanings of 3-bit Values

Value Meaning

011 Maximum likelihood of a ‘0’

010 Medium likelihood of a ‘0’

001 Low likelihood of a ‘0’

000 Equal probability of a ‘1’ and a ‘0’

111 Low likelihood of a ‘1’

110 Medium likelihood of a ‘1’

101 Maximum likelihood of a ‘1’

100 Not used

22 Altera Corporation

Page 23: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide Specifications—Decoder

Specifications—

2

Decoder

Memory Requirements

The max-logMAP decoder requires access to the described memories.

The information likelihood memory stores the logarithmic likelihood values for the information bits. This data is written into the memory before decoding begins, and the corrected values are read back from this memory after decoding.

The parity likelihood memories store the logarithmic likelihood values for the parity 1 and parity 2 bits. This data is written into the memory before decoding begins.

The apriori memory stores correction values that are passed between iterations of the turbo decoder. It is not externally accessible.

The alpha matrix memory is used as intermediate storage by the max-logMAP decoders. It is not externally accessible.

The information likelihood memory and the apriori memory are included in the turbo decoder MegaCore function and are always implemented as on-chip memory. The parity likelihood memories and alpha matrix memory can be implemented on-chip or off-chip. They are not included in the turbo decoder, and you must connect them to the turbo decoder. The turbo decoder requires single-cycle access to each of these memories, although access can be pipelined. Synchronous SRAM is recommended for off-chip memories. The alpha matrix and parity likelihood memories must always be separate from each other.

The turbo decoder supports the use of two banks of information memory, which allows one bank to be written and read by the processor, while the data in the other bank is processed. The use of two banks of information memory minimizes the delay between decoding each block and achieves the maximum throughput. When using this option, two banks of parity likelihood memory should also be implemented outside the core. The address space for parity 1 likelihood memory is from 0 to 8,191 (213 – 1), addresses 000..00 to 011..11; for parity 2 from 8,192 to 16,383 (214 – 1), addresses 100..00 to 111..11. If maximum block size is used the address space for parity 1 likelihood memory is from 0 to 5,116; parity 2 from 8,192 to 13308.

Altera Corporation 23

Page 24: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Specifications—Decoder Turbo Encoder/Decoder MegaCore Function User Guide

Interface Definition

This section describes the turbo decoder MegaCore function’s interfaces. Table 2 shows the function’s parameters.

Table 3 shows the general signals.

Table 2. Parameters

Name Range Description

SOFTBITS 3 to 8 The number of bits (N) used for the log likelihood values for information and parity bits.

TMEMACCA 2 to 6 The number of pipeline stages outside the core for read access to the alpha matrix memory.

TMEMACCP 2 to 6 The number of pipeline stages outside the core for read access to the parity likelihood memory.

BANKSWAP 0 or 1 Indicates whether two banks of information memory are to be included in the core to achieve maximum performance.

Table 3. General Signals

Name Type Description

CLK Input System clock.

RESET Input Global asynchronous reset.

24 Altera Corporation

Page 25: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide Specifications—Decoder

Specifications—

2

Decoder

Table 4 shows the configuration and control interface signal definitions.

Table 5 shows the information memory interface signal definitions.

Table 6 shows the parity likelihood memory interface signal definitions.

Table 4. Configuration and Control Interface Signals

Name Type Width Description

ABORT Input Aborts any active operation and returns core to reset state.

START Input Instructs core to begin decoding a block of data.

LD_INT Input Instructs interleaver to re-initialize with new block size.

ACTIVE Output Indicates core is busy processing data or initializing the interleaver.

PUNCTURE Input When asserted, the core will set alternate Parity 1 and Parity 2 values to 0.

BLOCK_SIZE Input 13 Block size.

ITERATIONS Input 4 Number of iterations.

Table 5. Information Memory Interface Signals

Name Type Width Description

INFO_DATA_IN Input N Memory data input.

INFO_ADDR Input 13 Memory address.

INFO_RD Input Memory read strobe.

INFO_WR Input Memory write strobe.

INFO_DATA_OUT Output N Memory data output.

Table 6. Parity Likelihood Memory Interface Signals

Name Type Width Description

PARITY_DATA_IN Input N Memory data input.

PARITY_ADDR Output 14 Memory address.

PARITY_RD Output Information memory read strobe.

Altera Corporation 25

Page 26: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Specifications—Decoder Turbo Encoder/Decoder MegaCore Function User Guide

Table 7 shows the alpha matrix memory interface signal definitions.

Decoder Operation

The turbo decoder MegaCore function operates as a slave device under the control of a processor. The operating sequence is described in the steps that follow.

1. Reset the core by asserting the RESET signal. The RESET signal must be de-asserted synchronously with respect to CLK to avoid metastability issues.

2. Configure the core by setting the PUNCTURE,ITERATIONS and BLOCK_SIZE configuration signals.

3. Assert LD_INT to initialize the interleaver, if BLOCK_SIZE has been changed, and wait until ACTIVE goes inactive (see Figure 3).

4. Write information and parity likelihood values into their respective memories.

5. Assert START to begin the decoding of the block.

6. Wait until ACTIVE goes inactive.

7. Read the corrected information likelihood values from the information memory.

8. Repeat from step 4 (or from step 2 if the interleaver block size changes).

Figure 4 shows the turbo decoder timing diagram.

Table 7. Alpha Memory Interface Signals

Name Direction Width Description

ALPHA_DATA_IN Input 8 × (N – 1) Data from memory.

ALPHA_DATA_OUT Output 8 × (N – 1) Data to memory.

ALPHA_ADDR Output 13 Memory address.

ALPHA_RD Output Memory read strobe.

ALPHA_WR Output Memory write strobe.

26 Altera Corporation

Page 27: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide Specifications—Decoder

Specifications—

2

Decoder

Figure 3. Initializing the Turbo Decoder (1)

Note:(1) BLOCK_SIZE (not shown) must be valid at least one clock cycle before LD_INT is asserted, and then must continue

to be valid.

LD_INT

ACTIVE

CLK

INFO_DATA_IN

INFO _ADDR

INFO_WR

START

Altera Corporation 27

Page 28: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Specifications—Decoder Turbo Encoder/Decoder MegaCore Function User Guide

Figure 4. Turbo Decoder Timing Diagram—without Bank Swapping (1)

Note:(1) START is asserted for one (or more) clock cycles, while ACTIVE is low. One clock cycle after START is asserted,

ACTIVE goes high.

The sequence is slightly different when two banks of information memory are used. Bank swapping automatically takes place every time START is asserted. The corrected information likelihood values from the previous block can be read, and the new information likelihood values for the next block written, while the core is decoding the current block (see Figure 5). If you use bank swapping, implement two banks of parity likelihood memory outside the core.

ACTIVE

PARITY_DATA_IN

PARITY _ADDR

PARITY_RD

ALPHA_DATA_OUT

ALPHA_ADDR

ALPHA_RD

ALPHA_WR

Decoder Active

Block 0 Block 1

ReadInfo

WriteInfo

Decoder Active

ALPHA_DATA_IN

INFO_WR

INFO_RD

START

ReadInfo

WriteInfo

28 Altera Corporation

Page 29: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide Specifications—Decoder

Specifications—

2

Decoder

Figure 5. Turbo Decoder Timing Diagram—with Bank Swapping (1)

Note:(1) START is asserted for one (or more) clock cycles, while ACTIVE is low. One clock cycle after START is asserted,

ACTIVE goes high.

Performance The max-logMAP decoder requires two clock cycles to decode each bit, plus a few cycles to fill the pipeline at the start of each decoding block. The max-logMAP decoder needs to operate twice for each iteration of the turbo decoder; once for each set of parity bits. Hence each iteration of the turbo decoder requires 4 clock cycles per information bit. The maximum clock frequency of the turbo decoder is about 50 MHz, but this depends on the parameters selected. The performance of the turbo decoder is determined by the number of iterations required.

For example, with five iterations, 20 clock cycles will be required per sample. Allowing an overhead of 5 cycles per sample gives 25 cycles per bit. At a clock rate of 50 MHz, that provides a bit rate of 2 Mbps.

ACTIVE

PARITY_DATA_IN

PARITY _ADDR

PARITY_RD

ALPHA_DATA_OUT

ALPHA_ADDR

ALPHA_RD

ALPHA_WR

Decoder Active Decodeand

ReadInfo 0

Decodeand

WriteInfo 2

Decodeand

ReadInfo

Decodeand

WriteInfo 1

WriteInfo 0

Decoder Active

ALPHA_DATA_IN

INFO_WR

INFO_RD

START

Altera Corporation 29

Page 30: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Specifications—Decoder Turbo Encoder/Decoder MegaCore Function User Guide

Higher throughput can be achieved by using several turbo decoders in parallel. The decoding of each block is totally independent of all other blocks.

Size

The amount of logic needed for the turbo decoder MegaCore function does not vary greatly; about 5,000 to 7,500 logic elements (LEs), which fits on an Altera EP20K200 device. However, the memory configuration influences the chosen device. The internal RAM takes up four embedded system blocks (ESBs). The size of the other memories varies with the number of bits used to represent the soft decision (logarithmic likelihood) values. Table 8 defines the various memory sizes, where N is the number of bits used to represent the logarithmic likelihood values:

The information likelihood and apriori memories must be on-chip and are included with the turbo decoder. The parity likelihood and alpha matrix memories are outside the core, and can be implemented on-chip or off-chip, which allows you to select a configuration best suited to your system. The information likelihood and parity memories may be duplicated to increase throughput, by avoiding the need to read the results and write the new data between blocks.

Table 8. Memory Sizes

Memory Name Size Size with Bank Swapping

Information Likelihood 5K × N 2 x 5K × N

Parity Likelihood 1K × N 2 x 10K × N

Apriori 5K × N 5K × N

Alpha Matrix 5K × 8(N – 1) 5K × 8(N – 1)

30 Altera Corporation

Page 31: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide Specifications—Decoder

Specifications—

2

Decoder

Typical Configurations

A typical configuration uses 5 bits to represent the soft decision values. The parity memory is on-chip, and the alpha matrix memory off-chip. The information likelihood and apriori memories are 5K × 5, and occupy 13 ESBs each. The parity memory occupies 26 ESBs. The total on-chip memory requirement is 58 ESBs, and an Altera EP20K300E is a suitable device. If the parity memory is implemented off-chip, the total ESB count is 32 ESBs, and the decoder would fit in an Altera EP20K200E device. Table 9 indicates further example configurations.

Table 9. Configuration Examples

SOFTBITS BANKSWAP Alpha Memory Parity Memory ESB Count Suitable Device

3 0 On-chip On-chip 75 EP20K400

3 1 On-chip On-chip 98 EP20K400

4 0 Off-chip On-chip 44 EP20K200

4 1 Off-chip On-chip 74 EP20K400

5 0 Off-chip Off-chip 30 EP20K200

5 1 Off-chip Off-chip 43 EP20K200

5 0 Off-chip On-chip 55 EP20K300E

5 1 Off-chip On-chip 93 EP20K400

5 0 On-chip On-chip 135 EP20K600E

8 0 Off-chip Off-chip 44 EP20K200

8 1 Off-chip On-chip 64 EP20K300E

8 0 Off-chip Off-chip 84 EP20K400

8 1 Off-chip On-chip 144 EP20K600E

Altera Corporation 31

Page 32: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Notes:

Page 33: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

®

Altera Corporation 33

Getting StartedContents

User Guide

Getting Started

3

Downloading & Installing the Function .....................................................................................35Obtaining MegaCore Functions ...........................................................................................36Installing the MegaCore Files ...............................................................................................36

Generating a Custom Turbo Function ........................................................................................37Using the C-Model .........................................................................................................................42

BER Graphs .............................................................................................................................43Using the VHDL Model ................................................................................................................45

Setting Up Your System ........................................................................................................46Using the VHDL Testbench ..................................................................................................46

Performing Synthesis, Compilation & Post-Routing Simulation ...........................................49Configuring a Device .....................................................................................................................50

Page 34: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Notes:

Page 35: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

®

Getting Started

User Guide

Getting Started

3

This section describes how to obtain the turbo encoder/decoder MegaCore™ function, explains how to install it on your PC, and walks you through the process of implementing the function in a design. You can test-drive MegaCore functions using the Altera® OpenCore™ feature to simulate the functions within your custom logic. When you are ready to generate programming or configuration files, you should license the function through the Altera web site or through your local Altera sales representative. The functions are optimized for Altera APEX™ 20K and APEX 20KE devices, greatly enhancing your productivity by allowing you to focus efforts on the custom logic in the system.

This walk-through involves the following steps:

1. Downloading and installing the turbo encoder/decoder MegaCore function.

2. Generating a custom MegaCore function.

3. Implementing your system using VHDL, or Verilog HDL.

4. Compiling your design.

5. Licensing the turbo encoder/decoder MegaCore function and configuring the devices.

The instructions assume that:

� You are using a PC.� You are familiar with the Quartus™ software. � The Quartus software version 2000.02 (or higher) is installed in the

default location.� You are using the OpenCore feature to test-drive the turbo

encoder/decoder MegaCore function or you have licensed the function.

Downloading & Installing the Function

Before you can start using Altera MegaCore functions, you must obtain the MegaCore files and install them on your PC. The following instructions describe this process.

Altera Corporation 35

Page 36: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Getting Started Turbo Encoder/Decoder MegaCore Function User Guide

Obtaining MegaCore Functions

If you have Internet access, you can download the turbo encoder/decoder MegaCore function from the Altera web site at http://www.altera.com. Follow the instructions below to obtain the turbo encoder/decoder MegaCore function via the Internet. If you do not have Internet access, you can obtain the turbo encoder/decoder MegaCore function from your local Altera representative.

1. Point your web browser at http://www.altera.com/IPmegastore.

2. In the IP MegaSearch keyword field type turbo.

3. Click the appropriate link for your desired MegaCore function.

4. Click the link for the download icon.

5. Follow the online instructions to download the function and save it to your hard disk.

Installing the MegaCore Files

For Windows 95/98 and Windows NT 4.0, follow the instructions below:

1. Click Run (Start menu).

2. Type <path name>\<filename>, where <path name> is the location of the downloaded MegaCore function and <filename> is the filename of the function. Click OK.

3. The MegaCore Installer dialog box appears. Follow the online instructions to finish installation.

4. After you have finished installing the MegaCore files, you must specify the MegaCore function’s library folder (\turbo_codec\lib) as a user library in the Quartus and MAX+PLUS II software. Search for “User Libraries” in Quartus Help for instructions on how to add a library.

MegaCore Folder Structure

Altera MegaCore function files are organized into several folders; the top-level directory is \turbo_codec (see Table 1).

36 Altera Corporation

Page 37: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide GettingGetting Started

Getting Started

3

The MegaCore folder structure may contain several MegaCore products. Additionally, Altera updates MegaCore files from time-to-time. Therefore, Altera recommends that you do not save your project-specific files in the MegaCore folder structure.

Generating a Custom Turbo Function

This section describes the design flow using the Altera turbo encoder/decoder MegaCore function and the Quartus development system. Altera provides a MegaWizard™ Plug-In with the turbo encoder/decoder MegaCore function. The MegaWizard Plug-In Manager, which you can use within the Quartus software or as a stand-alone application, lets you create or modify design files to meet the needs of your application. You can then instantiate the custom megafunction in your design file.

You can use the Altera OpenCore feature to compile and simulate the MegaCore functions in the Quartus software, allowing you to evaluate the functions before deciding to license them.

To create a custom version of the turbo encoder/decoder MegaCore function, follow these steps:

� Before you can use the MegaWizard™ Plug-In, your PC must have Java Run Time Environment version 1.2.2 installed. This file can be obtained from the Java web site at http://java.sun.com/products/jdk/1.2/jre/

Table 1. Turbo MegaCore Folders

Folder Description

\turbo_codec Contains all files for the turbo encoder/decoder MegaCore function.

\doc Contains documentation for the function.

\lib Contains encrypted lower-level design files. After installing the MegaCore function, you should set a user library in the Quartus or MAX+PLUS II software that points to this folder. This library allows you to access all the necessary MegaCore files.

\c_model Contains the file to run the C-model, and the files for the bit error rate (BER) graphs.

\sim_lib\sim_model Contains the vhdl\modelsim folder

\vhdl\modelsim Contains precomplied libraries for the ModelSim simulator.

\sim_lib\reference_design Contains the reference design file.

\sim_lib\testbench Contains the files for the testbench.

Altera Corporation 37

Page 38: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Getting Started Turbo Encoder/Decoder MegaCore Function User Guide

1. Start the MegaWizard Plug-In Manager by choosing the MegaWizard Plug-In Manager command (Tools menu in the Quartus software). The MegaWizard Plug-In Manager dialog box is displayed.

� Refer to the Quartus Help for more information on how to use the MegaWizard Plug-In Manager.

2. Specify that you want to create a new custom megafunction and click Next.

3. Select Turbo Codec in the Communications folder (see Figure 1), and click Next.

38 Altera Corporation

Page 39: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide GettingGetting Started

Getting Started

3

Figure 1. Selecting the Megafunction

4. Select either decoder or encoder (see Figures 2 and 3). If you select the decoder, select your required parameters. Click Next.

Altera Corporation 39

Page 40: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Getting Started Turbo Encoder/Decoder MegaCore Function User Guide

Figure 2. Selecting the Encoder

40 Altera Corporation

Page 41: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide GettingGetting Started

Getting Started

3

Figure 3. Selecting the Decoder

5. The MegaWizard Plug-In lists the product order code for your custom megafunction (see Figure 4). You will need this code when you want to license the MegaCore function. Click Next.

Altera Corporation 41

Page 42: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Getting Started Turbo Encoder/Decoder MegaCore Function User Guide

Figure 4. Order Codes

6. The final screen lists the design files that the wizard creates. Click Finish.

Once you have created a custom megafunction, you can integrate it into your system design and compile.

Using the C-Model

The C-model is a program that allows you to enter your choice of parameters and view the number of errors, the bit error rate (BER) and the frame error rate. To use the C-model follow the steps below.

1. Open the MS-DOS Command Prompt software. Change the folder to <pathname>\turbo_codec\c_model, where <pathname> is the location of the function.

42 Altera Corporation

Page 43: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide GettingGetting Started

Getting Started

3

2. Type BER_simulator for the C-model with no-puncturing; BER_simulator_punct for the C-model with puncturing, and type in the parameters and required values as shown:

-c <channel> -n <signal-to-noise ratio> -i <number of iterations>-f <number of frames> -l <block length> -w <number of softbits>�

e.g.ber_simulator -c 0 -n 1 -i 5 -f 100 -l 320 -w 5�

Table 2 shows the C-model parameters and valid values.

3. If the parameters are entered incorrectly, the incorrect syntax error message appears and the C-model will illustrate the correct syntax.

4. The C-model outputs are in the format shown:

<number of errors>|<number of bits transmitted>|<BER>|<Frame Error Rate>

Note:(1) Channel value 0 selects ‘additive white Gaussian noise’; 1 selects Rayleigh Fading.

BER Graphs

Altera have used this C-model for all combinations of parameters and collated the BERs they produce. These results have been entered into a database. You can access this database using MATLAB. The following steps explain how to show the turbo decoder BER graphs in MATLAB.

� For more information on MATLAB, refer to the Math Works website at http://www.mathworks.com.

1. Open the MATLAB software. At the command prompt change the folder to the \turbo_codec\c_model folder.

Table 2. C-Model Valid Parameter Values

Parameter Valid Values

Channel 0 or 1 (1)

Signal to noise ratio 0 to 20

Number of iterations 1 to 16

Number of soft bits 1 to 16

Block size 320 to 5,114

Number of frames Any positive integer > 20

Altera Corporation 43

Page 44: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Getting Started Turbo Encoder/Decoder MegaCore Function User Guide

2. At the command prompt type BER_graphs. Select your chosen axis variables is the drop-down menus, change the values with the slider bars, and click Update to view the BER graph. Figure 5 shows an example.

Figure 5. BER Graph

� The results for this model are not accurate for low BERs, as only one million samples were used for each parameter combination. Also the BER has a floor of 10–8; preventing the graphs going on to –∞. A BER of 10–8 can be interpreted as the decoder decoding all bits correctly

44 Altera Corporation

Page 45: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide GettingGetting Started

Getting Started

3

Using the VHDL Model

The turbo decoder MegaCore function is supplied with a VHDL model, a reference design (see Figure 6), and a system testbench (see Figure 7). You can use the reference design to simulate the functionality of the turbo function in your system. The reference design is:

� supplied as source code, instantiating decoder from precompiled libraries;

� synthesizable;� intended to be used as a basis for your design.

Figure 6. Decoder Reference Design Block Diagram

Figure 7. System Testbench Block Diagram

The following instructions describe how to set up your system and how to use the system testbench in the ModelSim software.

SOFTBITSTMEMACCATMEMACCP

BANKSWAP = 0ITERATIONSBLOCK_SIZE

AlphaMemory

ParityMemory

Decoder

ITERATIONSBLOCK_SIZE

SNR

EncoderRandomStimulus

Decoder Reference Design

CompareDelay

Processor

CHANNEL

Altera Corporation 45

Page 46: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Getting Started Turbo Encoder/Decoder MegaCore Function User Guide

Setting Up Your System

Four precompiled ModelSim libraries are provided with the turbo encoder/decoder MegaCore function: random, turbolib, memlib, and itlvlib.

These are installed in the folder turbo_codec\sim_lib\sim_model\vhdl\ModelSim. Follow the steps below to set up logical maps to these libraries.

1. Run the ModelSim software and create a logical map called random to the folder containing the precompiled library by typing the following command in the ModelSim software.

vmap random <Drive:>/<Turbo MegaCore Path>/sim_lib/sim_model/vhdl/ModelSim/random�

� You can also use the ModelSim graphical user interface to create the logical map. Refer to the ModelSim online help for details.

2. Repeat step 1 for the other libraries but replace every instance of random with turbolib, then memlib, and finally itlvlib.

Using the VHDL Testbench

Altera provides a reference design and a system testbench. You must compile these files, before simulating with the ModelSim software, by performing the following steps.

1. Select Simulation (Options menu). Under the Suppress Warnings section in the Simulation Options dialog box, check From Synopsis Packages and From IEEE Numeric Std Packages. Click OK

2. Choose Compile (Design menu).

3. In the Compile HDL Source Files dialog box (see Figure 8), click Default Options. The Compiler Options dialog box appears (see Figure 9).

46 Altera Corporation

Page 47: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide GettingGetting Started

Getting Started

3

Figure 8. Compile HDL Source Files Dialog Box

Figure 9. Compiler Options

4. In the Compiler Options dialog box, check the Use 1993 Language Syntax option and the Use explicit declarations only option in the VHDL tab. Click OK.

5. In the Compile HDL Source Files dialog box, select turbolib in the Library drop-down list. Also select the turbo_codec\sim_lib\reference_design folder in the Look In drop-down list box.

Altera Corporation 47

Page 48: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Getting Started Turbo Encoder/Decoder MegaCore Function User Guide

6. Select auktd_umts_turbo_decoder_chip.vhd and click Compile.

7. Select the turbo_codec\sim_lib\testbench folder in the Look In drop-down list box.

8. Select AWGN_BPSK_channel.vhd and click Compile. Repeat for auktd_tdec_refdesign_ctrl.vhd, aukte_tenc_refdesign_ctrl, and auktde_turbo_tb. You must compile auktde_turbo_tb.vhd last.

9. Once compilation finishes, click Done.

The configuration is included in the file auktde_turbo_tb.vhd; the VHDL configuration is defined with the prefix cfg_.

The configuration must be loaded specifying the parameter values. See Table 1 on page 11, Table 2 on page 24 and Table 4 on page 25 for a detailed description of the parameters. The clock_period parameter can be any valid time period (for example, 30 ns); the signal2noise_ratio parameter can be set between 3.0 and –0.5 (dB); the seed parameter can be set between 0 and 4,095.

� The seed parameter selects which random number sequence you require, i.e. there are 4,096 different random number sequences.

You can quickly load the configuration from the command line in the ModelSim software. For example:

vsim -GgTMEMACCA=2 -GgTMEMACCP=2 {-Gclock_period=20 ns} -Ggiterations=3 -Gsignal2noise_ratio=1.0 -Ggblock_size=320 -GgSOFTBITS=4 -Gseed=100 TurboLib.cfg_auktde_turbo_tb�

� You can also use the ModelSim graphical user interface to load the configuration. Refer to the ModelSim online help for details.

Altera provide a .do file in the turbo_codec\sim_lib\sim_model\vhdl\ModelSim folder. This sets-up a timing diagram display window that shows the relevant signals for the testbench. To use the .do file, type the following commands.

do <Drive:>/<Turbo MegaCore Path>sim_lib/sim_model/vhdl/ModelSim/testbench_wave_template.do�run 300 us�

48 Altera Corporation

Page 49: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Turbo Encoder/Decoder MegaCore Function User Guide GettingGetting Started

Getting Started

3

Performing Synthesis, Compilation & Post-Routing Simulation

The Quartus software works seamlessly with tools from all EDA vendors, including Cadence, Exemplar Logic, Mentor Graphics, Synopsys, Synplicity, and Viewlogic. After you have licensed the MegaCore function, you can generate EDIF, VHDL, Verilog HDL, and Standard Delay Output Files from the Quartus software and use them with your existing EDA tools to perform functional modeling and post-route simulation of your design.

The following sections describe the design flow to compile and simulate your custom MegaCore design with a third-party EDA tool. To synthesize your design in a third-party EDA tool and perform post-route simulation, perform the following steps:

1. Create your custom design instantiating a turbo encoder/decoder MegaCore function.

2. Synthesize the design using your third-party EDA tool. Your EDA tool should treat the MegaCore instantiation as a black box by either setting attributes or ignoring the instantiation.

3. After compilation, generate a hierarchical netlist file in your third-party EDA tool.

4. Open your netlist file in the Quartus software.

� Before you compile, you must select Leonardo Spectrum as the design entry tool. To do this, select EDA Tool Settings (Project Menu) and under the Design entry/synthesis tool drop-down box, select Leonardo Spectrum.

5. Select Compile mode (Processing menu).

6. Specify the compiler settings in the Compiler Settings dialog box (Processing menu) or use the Compiler Settings wizard.

7. Specify the user libraries for the project and the order in which the Compiler searches the libraries.

8. Specify the input settings for the project under the EDA Tool Settings (Project menu).

9. Depending on the type of output file you want, specify Verilog HDL output settings or VHDL output settings in the General Settings dialog box (Project menu).

Altera Corporation 49

Page 50: Turbo Encoder/Decoder MegaCore Function User …flex.phys.tohoku.ac.jp/riron/vhdl/up1/altera/ug/turbo_ug.pdfTurbo Encoder/Decoder MegaCore Function User Guide, April 2000 A-UG-TURBO-01

Getting Started Turbo Encoder/Decoder MegaCore Function User Guide

10. Compile your design. The Quartus Compiler synthesizes and performs place-and-route on your design, and generates output and programming files.

11. Import your Quartus-generated output files (.edo, .vho, .vo, or .sdo) into your third-party EDA tool for post-route, device-level, and system-level simulation.

12. Turn on the Verilog Netlist Writer or VHDL Netlist Writer command (Interfaces menu), depending on the type of output file you want to use in your third-party simulator.

13. Compile your design. The Quartus Compiler synthesizes and performs place-and-route on your design, and generates output and programming files.

14. Import your Quartus-generated output files (.edo, .vho, .vo, or .sdo) into your third-party EDA tool for post-route, device-level, and system-level simulation.

Configuring a Device

After you have compiled and analyzed your design, you are ready to configure your targeted Altera device. If you are evaluating the MegaCore function with the OpenCore feature, you must license the function before you can generate configuration files.

50 Altera Corporation