📄 mult.asm
字号:
.title "TMS320C2xx PROCESSOR SELFCHECK -- MULTIPLIER TEST"
.length 60
.width 120
.option X
************************************************************
* *
* MULTIPLIER INSTRUCTIONS TEST *
* *
* This routine checks multiplier operations. *
* *
* Written by David M. Alter *
* member technical staff *
* Texas Instruments Inc. *
* *
* Release Version 1.0 *
* *
************************************************************
.def mult
.nolist
.copy "options.h"
.copy "memmap.h"
.list
.text
mult: .set $+SS
;preliminary setup
SPM 0 ;product mode shifter off
LDP #0h ;data page @ 0h
SPLK #07fffh,TEMP00 ;data(TEMP00) = 7fffh
SPLK #08001h,TEMP01 ;data(TEMP01) = 8001h
SPLK #0aaaah,TEMP02 ;data(TEMP02) = aaaah
SPLK #05555h,TEMP03 ;data(TEMP03) = 5555h
SPLK #00000h,TEMP04 ;data(TEMP04) = 0h
;test immediate addressing
LT TEMP00 ;TREG=7fffh
MPY #1fffh ;TREG=7fffh PREG=ffff8001h
PAC ;TREG=7fffh PREG=ffff8001h ACC=ffff8001h
CMPL ; ACC=00007ffeh
XOR #7ffeh ; ACC=0
BCND ermult1,NEQ ;if ACC != 0 then error
;test direct addressing
MPY TEMP01 ;TREG=7fffh PREG=c000ffffh
LTP TEMP02 ;TREG=aaaah PREG=c000ffffh ACC=c000ffffh
MPYU TEMP03 ;TREG=aaaah PREG=38e31c72h ACC=c000ffffh
LTA TEMP03 ;TREG=5555h PREG=38e31c72h ACC=f8e41c71h
MPYA TEMP02 ;TREG=5555h PREG=e38e1c72h ACC=31c738e3h
SPAC ;TREG=5555h PREG=e38e1c72h ACC=4e391c71h
LPH TEMP03 ;TREG=5555h PREG=55551c72h ACC=4e391c71h
SQRS TEMP02 ;TREG=aaaah PREG=1c7238e4h ACC=f8e3ffffh
LTS TEMP01 ;TREG=8001h PREG=1c7238e4h ACC=dc71c71bh
MPYS TEMP02 ;TREG=8001h PREG=2aaaaaaah ACC=bfff8e37h
SQRA TEMP03 ;TREG=5555h PREG=1c718e39h ACC=eaaa38e1h
APAC ;TREG=5555h PREG=1c718e39h ACC=071bc71ah
XOR #071bh,16 ; ACC=0000c71ah
XOR #0c71ah ; ACC=0
BCND ermult2,NEQ ;if ACC != 0 then error
;test indirect addressing
MAR *,AR0 ;ARP --> AR0
LAR AR0,#TEMP00 ;AR0 points to TEMP00
LT *+ ;TREG=7fffh
MPY *+ ;TREG=7fffh PREG=c000ffffh
LTP *+ ;TREG=aaaah PREG=c000ffffh ACC=c000ffffh
MPYU * ;TREG=aaaah PREG=38e31c72h ACC=c000ffffh
LTA *- ;TREG=5555h PREG=38e31c72h ACC=f8e41c71h
MPYA *+ ;TREG=5555h PREG=e38e1c72h ACC=31c738e3h
SPAC ;TREG=5555h PREG=e38e1c72h ACC=4e391c71h
LPH *- ;TREG=5555h PREG=55551c72h ACC=4e391c71h
SQRS *- ;TREG=aaaah PREG=1c7238e4h ACC=f8e3ffffh
LTS *+ ;TREG=8001h PREG=1c7238e4h ACC=dc71c71bh
MPYS *+ ;TREG=8001h PREG=2aaaaaaah ACC=bfff8e37h
SQRA * ;TREG=5555h PREG=1c718e39h ACC=eaaa38e1h
APAC ;TREG=5555h PREG=1c718e39h ACC=071bc71ah
XOR #071bh,16 ; ACC=0000c71ah
XOR #0c71ah ; ACC=0
BCND ermult3,NEQ ;if ACC != 0 then error
;test MAC & MACD instructions
MPY #0h ; PREG=0
RPT #1h ;execute next instruction twice
MAC table,TEMP03 ;TREG=5555h PREG=1c718e39h ACC=e38e1c72h
RPT #1h ;execute next instruction twice
MACD table,TEMP00 ;TREG=7fffh PREG=2aaa2aabh ACC=d5550001h
RPT #1h ;execute next instruction twice
MAC table,*- ;TREG=aaaah PREG=e38e1c72h ACC=e38d471eh
RPT #1h ;execute next instruction twice
MACD table,* ;TREG=7fffh PREG=2aaa2aabh ACC=9c70b8e6h
APAC ;TREG=7fffh PREG=2aaa2aabh ACC=c71ae391h
XOR #0c71ah,16 ; ACC=0000e391h
XOR #0e391h ; ACC=0
BCND ermult4,NEQ ;if ACC != 0 then error
;test the remaining multiplier instructions
LAR AR0,#TEMP02 ;AR0 points to TEMP02
SPL TEMP00 ;data(TEMP00) = 2aabh
SPH TEMP01 ;data(TEMP01) = 2aaah
SPL *+ ;data(TEMP02) = 2aabh
SPH *- ;data(TEMP03) = 2aaah
LTD TEMP03 ;TREG=2aaah PREG=2aaa2aabh ACC=2aaa2aabh
MPY TEMP04 ;TREG=2aaah PREG=071c38e4h ACC=2aaa2aabh
LTD *+ ;TREG=2aabh PREG=071c38e4h ACC=31c6638fh
MPYA * ;TREG=2aabh PREG=071c8e39h ACC=38e29c73h
LT TEMP01 ;TREG=2aaah PREG=071c8e39h ACC=38e29c73h
MPYA TEMP00 ;TREG=2aaah PREG=071c638eh ACC=3fff2aach
APAC ;TREG=2aaah PREG=071c638eh ACC=471b8e3ah
XOR #471bh,16 ; ACC=00008e3ah
XOR #8e3ah ; ACC=0
BCND ermult5,NEQ ;if ACC != 0 then error
RET ;test passes
*
* ERROR HANDLERS
*
ermult1: .set $+SS
LACL #60h ;immediate addressing multiplier error
RET ;test fails
ermult2: .set $+SS
LACL #61h ;direct addressing multiplier error
RET ;test fails
ermult3: .set $+SS
LACL #62h ;indirect addressing multiplier error
RET ;test fails
ermult4: .set $+SS
LACL #63h ;MAC or MACD instruction error
RET ;test fails
ermult5: .set $+SS
LACL #64h ;LTD, SPH, or SPL instruction error
RET ;test fails
*
* DATA TABLE IN PROGRAM SPACE
*
table: .set $+SS
.word 0aaaah,5555h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -