⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpu_basic.s54

📁 1. 了解TMS320C5400系列汇编语言程序的基本格式
💻 S54
字号:
;******************************************************************************
;               		SJTU DSP Tech. Center
;        Copyright (c) 2001 SJTU DSP Tech. Center. All Rights Reserved.
;
;  Description:
;  		TMS320C54x Program for Students Experiment
;
;  History:
;		Date		Authors			Changes
;		2001/12/01	Xu Sheng		Created.
;******************************************************************************

;******************************************************************************
;Target:
;	Test the effection of flag bits in ST0, ST1
;******************************************************************************


;----------- Const definition
STACK_ADDR		.set		0x0500		;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
	add		#0x8000, 16, A
	;------------------------
	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
	ld		#0x0001, 16, A
	or		#0xffff, A
	rsbx	C16
	nop
	dadd	*AR2, A, B
	;------------------------
	ssbx	C16
	nop
	dadd	*AR2, A, B
	;================================================

	;================================================
	;test FRCT
	;watch B to understand fraction mode
	ld		#0x1234, 16, A
	rsbx	FRCT
	nop
	mpya	*AR2
	;------------------------
	ssbx	FRCT
	nop
	mpya	*AR2
	;================================================

	;================================================
	;test TC
	;watch TC to understand bit test operation and corresponding flags
	bitf	*AR2, #0x8000
	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
	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
	or		#0x0002, B
	stlm	B, PMST
	ld		#0xffff, A
	stm		#0x8000, T
	st		#0x8000, *AR2
	nop
	nop
	mac		*AR2, A
	nop
	nop
	;------------------------
	ldm		PMST, B
	and		#0xfffd, B
	stlm	B, PMST
	ld		#0xffff, A
	nop
	mac		*AR2, A
	;================================================

dead_loop:
	nop
	nop
	nop
	nop
	b		dead_loop

;------------------------------------------------------------------------------
;Interrupt Vector Table, for simplicity Only RESET interrupt is defined
	.sect	"vectors"
int_RESET:
	b		main
	nop
	nop

	.space	124*16

;end of lab1.s54		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -