Member Avatar
zios007

I need to put the number of cycles for each assembly instruction in the comment field and then calculate the total number of cycles for the entire 10 second timing interval.

Need to calculate the processor clock frequency (MCLK) by dividing the total number of cycles per interval by the time between "blinks" of the LED. (The clock speed should be accurate to at least 4 significant digits and is measured in cycles per second.)

Calculate the average cycles per instruction (CPI) by dividing the total number of cycles per interval by the number of instructions per interval. CPI will vary according to the instructions used in your timing loops. (CPI is measured in cycles per instruction.)

Finally, I need to calculate the raw speed of the processor (MIPS) by dividing the processor clock frequency (MCLK) by the average.

This is the code I made... some help please?
Here is in a google doc for easier view: https://docs.google.com/document/d/1F7Zm-OoA0J7ahG22zQOP4M5kIP-29dNjvJgf6Ho1o98/edit

.cdecls C,LIST, "msp430x20x3.h"  ; MSP430F2013
;          .cdecls C,LIST, "msp430x22x4.h"  ; MSP430F2274

DELAY		.equ	0		;
DELAY1      	.equ    55                      ; turn led on for 10 seconds
DELAY2      	.equ    0
;------------------------------------------------------------------------------
            .text                           ; beginning of executable code
;------------------------------------------------------------------------------
RESET:     	 mov.w   	#0x0280,SP              			; init stack pointer
            	mov.w   	#WDTPW+WDTHOLD,&WDTCTL  ; stop WDT
            	bis.b   		#0x01,&P1DIR            		; set P1.0 as output

mainloop:   
            	bis.b   		#0x01,&P1OUT           	; turn LED on
delayloop2: 	mov.w		#DELAY,r13			; loop delay counter
delayloop3:	dec.w   	13                    		; delay over?
              	jne   		delayloop3			; jumps to delayloop3
            	bic.b   		#0x01,&P1OUT            	; turn LED off


            	mov.w   	#DELAY1,r14            		 ; outer loop delay counter

delayloop:  	mov.w  	#DELAY2,r15            	 	; inner loop delay counter

delayloop1: 	dec.w   	r15                     		; delay over?
              	ne   		delayloop1              		; n
            	dec.w   	r14                    		 ; delay again
             	jne   		delayloop
		jmp     		mainloop               		; repeat stoplight

;------------------------------------------------------------------------------
;           Interrupt Vectors
;------------------------------------------------------------------------------
            .sect   ".reset"                ; MSP430 RESET Vector
            .short  RESET                   ; start address
            .end
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.