PowerPC Coding (Stage 1) -- Code the task as if it was to be done on the 68K CISC processor

The original 68K source code

The original description of the task C <- [A] + [B] given in HVZ is given if file e1v0.s.

Code from  HVZ Computer Organization
Chapter 2 -- Figure 2.26 -- page 67
A 68000 routine for C <- [A] + [B]

C	EQU	$202200
	ORG	$201150
A	DC.W	639	
B	DC.W	-215	
	ORG	$201200	
	MOVE	A,D0	
	ADD	B,D0	
	MOVE	D0,C	
	END

Software engineering and SDS simulator experience

We know that many of the features of the original HVZ code for Task 1 will not work with the SDS toolkit. We have also adopted a number of software engineering coding practices, both for our own coding convenience and to allow easier debugging using the SDS simulator. The key practices can be reviewed via the following links

This would appear to suggest using source file e1final.s as the starting point in the WIDFI process. However, we have also gained some experience with the SDS processor and approaches to make debugging of the code from within the SDS window much easier. The approach discussed in that link suggested that the first test of any code segment should be using data examples that were easy to follow through the various SDS simulator windows. In particular, writing code where the test values in the source file and the SDS window values look the same (in hexadecimal). This equivalence partitioning method suggests that we use test example values

FIRST:	EQU 0x123
SECOND:	EQU 0x456

which appear the same in Source code, Memory and Register windows, rather than

FIRST:	EQU 639
SECOND:	EQU -215

which don't appear in the same format in all the windows

Once we know the code for Task 1 is working with these values, then we can demonstrate the code's operation using other values if necessary.


Working version of the 68K code for Task 1 to be translated to PowerPC syntax

; A 68000 routine for SUM <- [FIRST] + [SECOND]

*******************************************************

SUM:	EQU	0x7200		; Specify location to store the result

	section const
	.EXPORT FIRST
FIRST:	DC.W	0x123	 	; FIRST = 0x123
SECOND:	DC.W	0x456		; SECOND = 0x456

	section code		; Start of CODE (program) section
	.EXPORT mycode
mycode:				; Make "mycode" into a subroutine/function
	MOVE.W	FIRST, D0	; 	D0 <- [FIRST]
	ADD.W	SECOND, D0	; 	D0 <- [D0] + [SECOND]
	MOVE.W	D0, SUM		; 	SUM <- [D0]
	RTS			; return

	END	


Last modified: July 08, 1996 03:36 PM by M. Smith.
Copyright -- M. R. Smith