DSP基础知识 (一) 20111128 -实验程序注释版
来源:互联网 发布:12c5a60怎么使用p4端口 编辑:程序博客网 时间:2024/06/07 07:57
;******************************************************************************
;Target:
; Test the effection of flag bits in ST0, ST1
;******************************************************************************
;----------- Const definition
STACK_ADDR .set0x0500 ;bottom of stack
.mmregs
.global main
;------------------------------------------------------------------------------
.text
main:
stm #STACK_ADDR, SP;set stack
stm #0x00a8, PMST;relocate Interrupt Vector Table
stm #0x0000, SWWSR;no software wait for all memory
;put a value for future use, *(0x2000) = 0xff80
stm #0x2000, AR2
st #0xff80, *AR2
;================================================
;test SXM
;watch A to understand sign extension
ssbx SXM
nop
ld *AR2, A
;------------------------
rsbx SXM
nop
ld *AR2, A
;================================================
;================================================
;test OVM
;watch A and B to understand saturation
ssbx SXM
ssbx OVM
ld #0x8000, 16, A ;A=#0x8000<<16
add #0x8000, 16, A ;A=A+#0x8000<<16
;------------------------
rsbx OVM
ld #0x7fff, 16, B
add #0x7fff, 16, B
;================================================
;================================================
;test C16
;watch B to understand 2-16 mode
ssbx OVM
ld #0x0001, 16, A
add #0x7fff, A
dst A, *AR2 ;*AR2=A
ld #0x0001, 16, A
or #0xffff, A
rsbx C16
nop
dadd *AR2, A, B ; B(39-16)=*AR2(31-16)+A(31-16)
;------------------------
ssbx C16
nop
dadd *AR2, A, B ; B=*AR2+A
;================================================
;================================================
;test FRCT
;watch B to understand fraction mode
ld #0x1234, 16, A
rsbx FRCT
nop
mpya *AR2 ; B=*AR2 *A(32-16),T=*AR2
;------------------------
ssbx FRCT
nop
mpya *AR2
;================================================
;================================================
;test TC
;watch TC to understand bit test operation and corresponding flags
bitf *AR2, #0x8000 ;TC=(*AR2 && #0x800)
nop
nop
;------------------------
bitf *AR2, #0x0001
nop
nop
;================================================
;================================================
;test C
;watch C to understand max & min operation and corresponding flags
ssbx SXM
ld #0x7fff, A
ld #0x8000, B
max A ;A=max(A,B)
nop
nop
;------------------------
min B
nop
nop
;================================================
;================================================
;test OVA, OVB
;watch OVA to understand overflow
ssbx SXM
rsbx OVA;clear overflow flag
ld #0x7fff, 16, A
add #0xffff, A
nop
nop
;------------------------
add #0x7fff, 16, A
nop
nop
;================================================
;================================================
;test SMUL
;watch A to understand multiply saturation
ssbx SXM
ssbx OVM
ssbx FRCT
ldm PMST, B ;B=PMST(处理器方式状态寄存器)
or #0x0002, B; B=B|#0x0002
stlm B, PMST ; PMST=B
ld #0xffff, A
stm #0x8000, T ;T=#0x800
st #0x8000, *AR2; *AR2=#0x8000
nop
nop
mac *AR2, A ; A=A+T*(*AR2)
nop
nop
;------------------------
ldm PMST, B ;B=PMST
and #0xfffd, B ;B=B�xfffd
stlm B, PMST
ld #0xffff, A
nop
mac *AR2, A
;================================================
dead_loop:
nop
nop
nop
nop
b dead_loop; PC(程序计数器)=dead_loop
;------------------------------------------------------------------------------
;Interrupt Vector Table, for simplicity Only RESET interrupt is defined
.sect ".vectors"
int_RESET:
b main ;b是跳转指令,PC载入制定指令的地址
nop
nop
.space 124*16
;end of lab1.s54
;Target:
; Test the effection of flag bits in ST0, ST1
;******************************************************************************
;----------- Const definition
STACK_ADDR .set0x0500 ;bottom of stack
.mmregs
.global main
;------------------------------------------------------------------------------
.text
main:
stm #STACK_ADDR, SP;set stack
stm #0x00a8, PMST;relocate Interrupt Vector Table
stm #0x0000, SWWSR;no software wait for all memory
;put a value for future use, *(0x2000) = 0xff80
stm #0x2000, AR2
st #0xff80, *AR2
;================================================
;test SXM
;watch A to understand sign extension
ssbx SXM
nop
ld *AR2, A
;------------------------
rsbx SXM
nop
ld *AR2, A
;================================================
;================================================
;test OVM
;watch A and B to understand saturation
ssbx SXM
ssbx OVM
ld #0x8000, 16, A ;A=#0x8000<<16
add #0x8000, 16, A ;A=A+#0x8000<<16
;------------------------
rsbx OVM
ld #0x7fff, 16, B
add #0x7fff, 16, B
;================================================
;================================================
;test C16
;watch B to understand 2-16 mode
ssbx OVM
ld #0x0001, 16, A
add #0x7fff, A
dst A, *AR2 ;*AR2=A
ld #0x0001, 16, A
or #0xffff, A
rsbx C16
nop
dadd *AR2, A, B ; B(39-16)=*AR2(31-16)+A(31-16)
;------------------------
ssbx C16
nop
dadd *AR2, A, B ; B=*AR2+A
;================================================
;================================================
;test FRCT
;watch B to understand fraction mode
ld #0x1234, 16, A
rsbx FRCT
nop
mpya *AR2 ; B=*AR2 *A(32-16),T=*AR2
;------------------------
ssbx FRCT
nop
mpya *AR2
;================================================
;================================================
;test TC
;watch TC to understand bit test operation and corresponding flags
bitf *AR2, #0x8000 ;TC=(*AR2 && #0x800)
nop
nop
;------------------------
bitf *AR2, #0x0001
nop
nop
;================================================
;================================================
;test C
;watch C to understand max & min operation and corresponding flags
ssbx SXM
ld #0x7fff, A
ld #0x8000, B
max A ;A=max(A,B)
nop
nop
;------------------------
min B
nop
nop
;================================================
;================================================
;test OVA, OVB
;watch OVA to understand overflow
ssbx SXM
rsbx OVA;clear overflow flag
ld #0x7fff, 16, A
add #0xffff, A
nop
nop
;------------------------
add #0x7fff, 16, A
nop
nop
;================================================
;================================================
;test SMUL
;watch A to understand multiply saturation
ssbx SXM
ssbx OVM
ssbx FRCT
ldm PMST, B ;B=PMST(处理器方式状态寄存器)
or #0x0002, B; B=B|#0x0002
stlm B, PMST ; PMST=B
ld #0xffff, A
stm #0x8000, T ;T=#0x800
st #0x8000, *AR2; *AR2=#0x8000
nop
nop
mac *AR2, A ; A=A+T*(*AR2)
nop
nop
;------------------------
ldm PMST, B ;B=PMST
and #0xfffd, B ;B=B�xfffd
stlm B, PMST
ld #0xffff, A
nop
mac *AR2, A
;================================================
dead_loop:
nop
nop
nop
nop
b dead_loop; PC(程序计数器)=dead_loop
;------------------------------------------------------------------------------
;Interrupt Vector Table, for simplicity Only RESET interrupt is defined
.sect ".vectors"
int_RESET:
b main ;b是跳转指令,PC载入制定指令的地址
nop
nop
.space 124*16
;end of lab1.s54
- DSP基础知识 (一) 20111128 -实验程序注释版
- DSP 实验一(CCS操作实验)
- 关于程序注释的基础知识[一]
- DSP实验四(DSP的定时器)
- DSP/BIOS 程序开发二 基础知识
- DSP/BIOS 程序开发一
- 关于程序注释的基础知识
- DSP基础知识
- DSP实验
- Oracle基础知识(一) - 给表或列添加注释
- DSP初识(一)
- 实验一 类、对象基础知识
- dsp--28335的使用fifo的串口中断实验(一)
- 关于程序注释的基础知识[二]
- 关于程序注释的基础知识[三]
- 关于程序注释的基础知识[四]
- 数字信号处理 DSP(一)
- dsp程序
- PreparedStatement设值where in语句
- 原来IIS服务器是可以架设JSP服务器的
- 感触
- getSystemService 笔记
- windows 自动登录
- DSP基础知识 (一) 20111128 -实验程序注释版
- Ruby-匿名类 (Metaclass or Eigenclass)
- 让Json更懂中文(JSON_UNESCAPED_UNICODE)
- 在DirectX 8 中进行2D渲染
- Ruby-方法调用
- 一点基础的东西:Objective-C的类型和常量
- Java基础之线程最详细最精简的介绍
- erter
- http://blog.csdn.net/kunshan_shenbin