Skip to content Skip to navigation Skip to collection information

OpenStax_CNX

You are here: Home » Content » DSP Laboratory with TI TMS320C54x (International Demo) » Lab 1: Prelab

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • Rice Digital Scholarship display tagshide tags

    This collection is included in aLens by: Digital Scholarship at Rice University

    Click the "Rice Digital Scholarship" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Lab 1: Prelab

Module by: Douglas L. Jones, Swaroop Appadwedula, Matthew Berry, Mark Haun, Jake Janovetz, Michael Kramer, Dima Moussa, Daniel Sachs, Brian Wade, Patrick Frantz, Emiko Yamai, Hironori Takaryo, Yoji Yamada. E-mail the authors

Based on: FIR Filtering: Basic Assembly Exercise for TI TMS320C54x by Douglas L. Jones, Swaroop Appadwedula, Matthew Berry, Mark Haun, Jake Janovetz, Michael Kramer, Dima Moussa, Daniel Sachs, Brian Wade

Summary: TI社 TMS320C54x アセンブリコードを手作業により学びます。ここで扱う命令セットには、2の補数表現を利用した固定小数点表現での乗算を含みます。

アセンブリ演習

 下記のコード例を分析して下さい。不明な点はTwo's Complement and Fractional Arithmetic for 16-bit Processors, Addressing Modes for TI TMS320C54x および Mnemonic Instruction Set [link]を参照して下さい。


	
	1  FIR_len .set    3
	2
	3  ; Assume: 
	4  ;   BK = 3
	5  ;   AR0 = 1
	6  ;   AR2 = 1000h
	7  ;   AR3 = 1004h
	8  ;
	9  ;   FRCT = 1
	10
	11      stl     A,*AR3+%
	12      rptz    A,(FIR_len-1)
	13      mac     *AR2+0%,*AR3+0%,A
	
      

 ";"から始まる行は全てコメントです。この例でのコメントは、11行目に示した最初の命令文stlを実行する前の段階での補助レジスタBKの値とアドレスレジスタAR0,AR2, 及び AR3の内容を示しています。1行めのFIR_len .set 3という文は、FIR_lenという文字列が3に等しいということを定義しています(訳注:C言語の#define文と同等です)。BKレジスタの値は、このコード例で使用したいサーキュラー・バッファの長さを示しています。記号%は、インクリメント演算子+を修飾しており、これによりサーキュラー・バッファを実現しています。すなわち、メモリアドレスをBKレジスタの値で除算した剰余がゼロになるまでアドレスレジスタがインクリメントする、ということです。インクリメント演算子+の次に0を置いた場合、レジスタAR0が指定する値までインクリメントするという動作になります。 注意:hが末尾に付いている数および0xで始まる数は、16進数の値を表しています。

例 1

1000hと0x1000は、両方とも10進数の4096を表しています。

 データメモリは1000h番地から始まり、下記のよに初期化されていると仮定します。

図 1: データメモリの内容(実行前)
図 1 (reg1.png)

 まずstl,rptz, 及び mac命令を各自で理解してから、コード例を一行ずつ実行したときのアキュムレータAおよび補助レジスタAR2AR3の値を図 2の空欄に記入して下さい。さらに、3行のコードをすべて実行した後でのメモリの内容を図 3の空欄に記入して下さい。

図 2: 実行結果
A AR2 AR3  
00 0000 8000h 1000h 1004h at start of code
      after stl instruction
      after rptz instruction
      after first mac instruction
      after second mac instruction
      after third mac instruction

 この演習を行う際、アキュムレーターAが40ビットレジスタであることや、乗算が固定小数点演算モードであることを考慮に入れてください。このモードでは、DSP上での整数は分数(いわゆるQフォーマットの小数)として解釈され、また乗算器もそのように扱うでしょう。このような扱いは、ALU内の整数の乗算結果を1ビット左シフトすることによりなされます(ここに示すすべての例では、すべての演算は固定小数点演算であると仮定します)。したがって、mac命令によりALUによって実行される乗算結果は、単に2つの整数を乗算したときの結果の2倍の値となります。DSPにおける数値表現および演算は、Two's Complement and Fractional Arithmetic for 16-bit Processorsという文書にさらに詳しく記述されていますので、適宜参照して下さい。

図 3: データメモリの内容(実行後)
図 3 (reg2.png)

Collection Navigation

Content actions

Download:

Collection as:

EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add:

Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks