Lab Exercise 2
Lab Exercise 2
0110 = r9
0011 = r9>>1
-------------------
0010 = r9 (r9 & r9>>1)
0001 = r9 >> 1
-------------------
0000 = r9 & r9>>1
ONES: /* This subroutine finds the longest string of 1’s in one word*/
/* Make the code provided in Figure 1 a subroutine */
/* Argument (word) is passed by r4, */
/* Return value (count) is passed by r2*/
……….
………..
LOOP:
……….. /*Call ONES iteratively until the end of the words*/
………….
TEST_NUM: .words 0x0000FF00, 0x0000FFA0, 0 /*an example*/
………….
2 words Indicating the end of the words
ONES:
……….
………..
LOOP:
……….. /*Call ONES iteratively until the end of the words*/
………..
DISPLAY:
…………
………….
TEST_NUM: .words 0x0000FF00, 0x0000FFA0, 0 /*This is an example*/
………….
0 1 2 3 4
/* Memory */
.equ DDR_BASE, 0x40000000
.equ DDR_END, 0x7FFFFFFF
.equ A9_ONCHIP_BASE, 0xFFFF0000
.equ A9_ONCHIP_END, 0xFFFFFFFF
.equ SDRAM_BASE, 0x00000000
.equ SDRAM_END, 0x03FFFFFF
.equ FPGA_ONCHIP_BASE, 0x08000000
.equ FPGA_ONCHIP_END, 0x0803FFFF
.equ FPGA_CHAR_BASE, 0x09000000
.equ FPGA_CHAR_END, 0x09001FFF