2/80 2

Similar documents
IP TCP/IP PC OS µclinux MPEG4 Blackfin DSP MPEG4 IP UDP Winsock I/O DirectShow Filter DirectShow MPEG4 µclinux TCP/IP IP COM, DirectShow I

第 15 章 程 式 編 写 語 言 15.1 程 式 編 写 語 言 的 角 色 程 式 編 寫 語 言 是 程 式 編 寫 員 與 電 腦 溝 通 的 界 面 語 法 是 一 組 規 則 讓 程 式 編 寫 員 將 字 詞 集 合 起 來 電 腦 是 處 理 位 元 和 字 節 的 機 器, 與

豐佳燕.PDF

epub83-1

<4D F736F F F696E74202D20C8EDBCFEBCDCB9B9CAA6D1D0D0DEBDB2D7F92E707074>

OOAD PowerDesigner OOAD Applying PowerDesigner CASE Tool in OOAD PowerDesigner CASE Tool PowerDesigner PowerDesigner CASE To

目次 

彩色地图中道路的识别和提取

Value Chain ~ (E-Business RD / Pre-Sales / Consultant) APS, Advanc

Outline Speech Signals Processing Dual-Tone Multifrequency Signal Detection 云南大学滇池学院课程 : 数字信号处理 Applications of Digital Signal Processing 2

Shanghai International Studies University THE STUDY AND PRACTICE OF SITUATIONAL LANGUAGE TEACHING OF ADVERB AT BEGINNING AND INTERMEDIATE LEVEL A Thes

\\Lhh\07-02\黑白\内页黑白1-16.p

标题

Microsoft Word - KSAE06-S0262.doc


Microsoft Word doc


<4D F736F F D205F FB942A5CEA668B443C5E9BB73A740B5D8A4E5B8C9A552B1D0A7F75FA6BFB1A4ACFC2E646F63>

,, [1 ], [223 ] :, 1) :, 2) :,,, 3) :,, ( ),, [ 6 ],,, [ 3,728 ], ; [9222 ], ;,,() ;, : (1) ; (2),,,,, [23224 ] ; 2,, x y,,, x y R, ( ),,, :

27 :OPC 45 [4] (Automation Interface Standard), (Costom Interface Standard), OPC 2,,, VB Delphi OPC, OPC C++, OPC OPC OPC, [1] 1 OPC 1.1 OPC OPC(OLE f


iml88-0v C / 8W T Tube EVM - pplication Notes. IC Description The iml88 is a Three Terminal Current Controller (TTCC) for regulating the current flowi

5 1 linear 5 circular ~ ~

~ Capability Maturity Model Integration, CMMI CMMI

untitled

4 115,,. : p { ( x ( t), y ( t) ) x R m, y R n, t = 1,2,, p} (1),, x ( t), y ( t),,: F : R m R n.,m, n, u.,, Sigmoid. :,f Sigmoid,f ( x) = ^y k ( t) =


基 于 SCORM 规 范 的 资 源 打 包 方 法 设 计 与 实 现 摘 要 共 享 式 教 材 组 件 参 考 模 型 (Sharable Course Object Reference Model, 简 称 SCORM), 已 成 为 目 前 国 际 上 公 认 的 e-learning

2 3. 1,,,.,., CAD,,,. : 1) :, 1,,. ; 2) :,, ; 3) :,; 4) : Fig. 1 Flowchart of generation and application of 3D2digital2building 2 :.. 3 : 1) :,

计算机与信息工程系最终.FIT)

Microsoft PowerPoint - TTCN-Introduction-v5.ppt

三維空間之機械手臂虛擬實境模擬

untitled

致 谢 开 始 这 篇 致 谢 的 时 候, 以 为 这 是 最 轻 松 最 愉 快 的 部 分, 而 此 时 心 头 却 充 满 了 沉 甸 甸 的 回 忆 和 感 恩, 一 时 间 竟 无 从 下 笔 虽 然 这 远 不 是 一 篇 完 美 的 论 文, 但 完 成 这 篇 论 文 要 感 谢


UDC 厦门大学博硕士论文摘要库

致 谢 本 人 自 2008 年 6 月 从 上 海 外 国 语 大 学 毕 业 之 后, 于 2010 年 3 月 再 次 进 入 上 外, 非 常 有 幸 成 为 汉 语 国 际 教 育 专 业 的 研 究 生 回 顾 三 年 以 来 的 学 习 和 生 活, 顿 时 感 觉 这 段 时 间 也

TI 3 TI TABLE 4 RANDBIN Research of Modern Basic Education

Microsoft PowerPoint - Lecture7II.ppt

Microsoft PowerPoint - Model Checking a Lazy Concurrent List-Based Set Algorithm.ppt [Compatibility Mode]

XXX专业本科人才培养方案

<4D F736F F D20C9CFBAA3BFC6BCBCB4F3D1A7D0C5CFA2D1A7D4BA C4EAC7EFBCBEC8EBD1A7B2A9CABFD7CAB8F1BFBCCAD4CAB5CAA9CFB8D4F22D C8B7B6A8B8E5>

iml v C / 0W EVM - pplication Notes. IC Description The iml8683 is a Three Terminal Current Controller (TTCC) for regulating the current flowin

研究論文 Assessment of Effectiveness of Passenger Seatbelt Reminder on Using Belt Rate - Toward Introducing Its Assessment in the New Car Assessm

声 明 本 人 郑 重 声 明 : 此 处 所 提 交 的 硕 士 学 位 论 文 基 于 等 级 工 鉴 定 的 远 程 考 试 系 统 客 户 端 开 发 与 实 现, 是 本 人 在 中 国 科 学 技 术 大 学 攻 读 硕 士 学 位 期 间, 在 导 师 指 导 下 进 行 的 研 究

iml v C / 4W Down-Light EVM - pplication Notes. IC Description The iml8683 is a Three Terminal Current Controller (TTCC) for regulating the cur


EK-STM32F

WTO

9 什 么 是 竞 争 与 冒 险 现 象? 怎 样 判 断? 如 何 消 除?( 汉 王 笔 试 ) 在 组 合 逻 辑 中, 由 于 门 的 输 入 信 号 通 路 中 经 过 了 不 同 的 延 时, 导 致 到 达 该 门 的 时 间 不 一 致 叫 竞 争 产 生 毛 刺 叫 冒 险 如

Microsoft PowerPoint - ch6 [相容模式]

HC50246_2009

國家圖書館典藏電子全文

A VALIDATION STUDY OF THE ACHIEVEMENT TEST OF TEACHING CHINESE AS THE SECOND LANGUAGE by Chen Wei A Thesis Submitted to the Graduate School and Colleg

TMC TMC 159

HC20131_2010

Learning Java

Gerolor Motors Series Dimensions A,B C T L L G1/2 M8 G1/ A 4 C H4 E

UDC Empirical Researches on Pricing of Corporate Bonds with Macro Factors 厦门大学博硕士论文摘要库

1對外華語文詞彙教學的策略研究_第三次印).doc

(Pattern Recognition) 1 1. CCD

English Language

CH01.indd

Microsoft PowerPoint ARIS_Platform_en.ppt

國立臺南大學數位論文典藏.pdf

untitled


1 目 錄 1. 簡 介 一 般 甄 試 程 序 第 一 階 段 的 準 備 第 二 階 段 的 準 備 每 間 學 校 的 面 試 方 式 各 程 序 我 的 做 法 心 得 及 筆 記 結 論..

Abstract Today, the structures of domestic bus industry have been changed greatly. Many manufacturers enter into the field because of its lower thresh

Some experiences in working with Madagascar: installa7on & development Tengfei Wang, Peng Zou Tongji university


赵 鹍 : 持 久 的 卓 越 : 日 本 年 PISA 测 试 结 果 的 影 响 因 素 分 析 及 启 示 本 的 正 常 社 会 生 活 也 深 受 教 育 影 响 日 本 的 报 刊 文 章 通 常 认 为, 读 者 能 看 懂 复 杂 的 统 计 表, 能 理 解 有

CC213

9330.doc

医院信息系统门诊划价子系统

6 : W eb 827 ) [ 5 ] 211, : (1) (2),, (3) 212, [ 6-7 ], B /S,,,, 1 1 Fig11 Design of the system architecture

Microsoft PowerPoint - STU_EC_Ch08.ppt

The Definition and Application of Ling-tzu in Tzu Style Wang Wei-Yung Professor, Department of Chinese Literature, National Cheng Kung University Chao

Thesis for the Master degree in Engineering Research on Negative Pressure Wave Simulation and Signal Processing of Fluid-Conveying Pipeline Leak Candi

59 1 CSpace 2 CSpace CSpace URL CSpace 1 CSpace URL 2 Lucene 3 ID 4 ID Web 1. 2 CSpace LireSolr 3 LireSolr 3 Web LireSolr ID

場 的 職 能 需 求 狀 況, 並 能 有 一 套 職 能 管 理 資 訊 系 統 對 各 職 位 進 行 職 能 資 料 管 理 分 析 與 應 用 資 料, 則 對 企 業 人 力 應 用 與 提 昇 上 均 有 極 大 之 助 益, 故 本 研 究 之 主 要 目 的 有 二 : (1) 職

35期

enews174_2

Process Data flow Data store External entity 6-10 Context diagram Level 0 diagram Level 1 diagram Level 2 diagram

Computer Architecture

/2008 ± ± 148

Microsoft Word - 专论综述1.doc

Gerotor Motors Series Dimensions A,B C T L L G1/2 M G1/ A 4 C H4 E

Microsoft PowerPoint - STU_EC_Ch02.ppt

<4D F736F F D20CDC1B5D8B5C4B1A3D5CFB9A6C4DCD3EBD6D0B9FAC5A9B4E5D1F8C0CFB1A3D5CFCCE5CFB5B5C4BDA8C9E820D6D3CBAED3B32E646F63>

小论文草稿2_邓瀚



热设计网

Microsoft PowerPoint _Safety_CAERI.ppt [互換モード]

symmetrical cutting patterns with various materials for visual designing; ii. This part combined costumes, bags and oilpaper umbrellas with the tradit

第三章 国内外小组合作学习的应用情况

Microsoft Word - 11月電子報1130.doc

KDC-U5049 KDC-U4049 Made for ipod, and Made for iphone mean that an electronic accessory has been designed to connect specifically to ipod, or iphone,

892213E006146

Transcription:

2/80 2

3/80 3

DSP2400 is a high performance Digital Signal Processor (DSP) designed and developed by author s laboratory. It is designed for multimedia and wireless application. To develop application easily on DSP2400 platform, a high level programming language compiler is needed. Because of good portability and performance, C programming language is used as developing language on all kinds of platforms, including embedded system and DSP platform, and there are plenty of source codes developed in C in the world. Using C as developing language of DSP2400 platform can take advantage of existing C program resource. This thesis presents the method of translating C source code to the target code with the two famous tools: LEX and YACC, and the detail design of a C compiler with these two tools. The compiler is composed of two parts: the front end and the back end. In the process of syntax 4/80 4

analysis, the front end of compiler performs semantic checking and code transfer by step. The front end gives a syntax tree as its output, which is the intermediate representation of the source code. Optimization modules of the back end of compiler take the syntax tree as the input and perform basic block division, control flow analysis, block optimization and iteration optimization based on the tree, and then output an optimized tree. The code generation module performs target codes generation based on the given tree. In the code generation module, according to optimization principles and features of the target processor, a new register allocation algorithm and some optimization methods are proposed and implemented to make the compiler generate effective codes. The structure of implemented compiler is very flexible, extensible and portable, and the compiler could generate effective codes for the target processor. This thesis will descript how to construct the modules of compiler in the order of compiling process. It presents the basic idea of module construction and gives the data structure and algorithm to implement the modules. KEY WORDS: dsp, compiler, c programming language, lex, yacc 5/80 5

2004 1 16 1

2

8/80 8

9/80 9

10/80 10 C

Figure 1-1 The compiler structure 11/80 11

2.2. 2.2.1. 13/80 13

2.2.2. Figure 2-1 The FSM model for recognizing the identifier 14/80 14

15/80 15 2.3.

2-2 Figure 2-2 The growth procedure of the syntax tree 16/80 16

2-3 Figure 2-3 The construct procedure of the syntax tree 2.3.2. LR 17/80 17

2-4 LR Figure 2-4 The work of LR analyzer 18/80 18

19/80 19 2.4.

20/80 20 2-5 Figure 2-5 The property transform

21/80 21 2.5.

2-6 Figure 2-6 Runtime memory allocation 2.6. 22/80 22

3-2 Figure 3-2 The back-end structure of the compiler 24/80 24

25/80 25

4-1 LEX Figure 4-1 LEX syntax description file format 26/80 26

4-2 Figure 4-2 The protype definition for class 27/80 27

4-3 LALR(1) Figure 4-3 The symbol set definition for LALR(1) grammar 28/80 28

4-4 Figure 4-4 The procedure of accidence analysis 29/80 29

4-5 YYSTYPE Figure 4-5 YYSTYPE definition 4-6 Figure 4-6 The recognition code for decimal integer 4.2. 30/80 30

31/80 31 translation_unit external_declaration translation_unit external_declaration external_declaration function_definition declaration

declaration declaration_specifiers declaration_specifiers init_declarator_list compound_statement { } {statement_list} {declaration_list} { declaration_list statement_list } statement_list statement_list statement statement_list statement 32/80 32

4-7 Figure 4-7 The structure of translation unit class 33/80 33

34/80 34

35/80 35

4-8 Figure 4-8 The class structure of a syntax sub-tree 36/80 36

37/80 37

4-9 Figure 4-9 An example of symbol specification list 38/80 38

4-10 Figure 4-10 The syntax sub-tree structure for select statement data 39/80 39

4-11 Figure 4-11 The syntax sub-tree structure for iteration statement data 40/80 40

4-12 Figure 4-12 A syntax tree for an expression 41/80 41

42/80 42

4-13 Figure 4-13 The structure of a function syntax tree 43/80 43

5.1. 5.1.1.1. 44/80 44

45/80 45 5.1.1.2.

46/80 46 5.1.2. 5.1.2.1.

47/80 47

48/80 48 5-1

5-1 Figure 5-1 The function descriptor for FIB function 49/80 49

5-2 Figure The program flow for FIB function 5.1.2.2. 50/80 50

51/80 51

5-1 52/80 52

53/80 53 5.1.2.3.

5.2. 5.2.1. 54/80 54

5-3 DSP2400 24 Figure The 24-bit operation for DSP2400 55/80 55

± ± ± 5-4 DSP2400 Figure 5-4 DSP2400 memory address sketch map 5.2.2. 56/80 56

57/80 57

5-5 Figure 5-5 The structure of the active record 5.2.3. 58/80 58

59/80 59 5-6 Figure 5-6 The code generation for expression

5-7 Figure 5-7 The code generation for if-else 60/80 60

5-8 switch DSP2400 Figure 5-8 The DSP2400 code generated by switch statement 61/80 61

5-9 DSP2400 Figure 5-9 DSP2400 code structure for loop statement 62/80 62

5-10 for DSP2400 Figure 5-10 The DSP2400 code for for statement 63/80 63

5.2.4. 5.2.4.1. 64/80 64

5-11 Figure 5-11 Code generation flow 65/80 65

5-12 Figure 5-12 The state for the middle result stack 5.2.4.2. 66/80 66

5-13 Figure 5-13 The layout for float point number s e 127 ( 1)2 (1. f ) 67/80 67

5-2 68/80 68

69/80 69 5.2.4.3.

5-14 Figure 5-14 The code generation algorithmic 5.2.4.4. 70/80 70

71/80 71

72/80 72

73/80 73

Kaufmann 1997 209-211 [20] Ken Kennedy Randy Allen Optimizing Compilers for Modern Architectures: A Dependence-based Approach Morgan Kaufmann 1997 [21] 1996.6 30 [22] 1982.1 73-81 75/80 75

77/80 77

78/80 78

80/80 80

DSP C 2004.1.16 7 DSP C 24 1. 2. 3. 4. 2004 1 16 81/80 81