Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CSE 230 Project 2: LED Pattern Generator Learning Objectives: Use PLP branch ins

ID: 2293809 • Letter: C

Question

CSE 230 Project 2: LED Pattern Generator Learning Objectives: Use PLP branch instructions Read from a memory mapped I/O device The Task: Write a program in PLP assembly that repeatedly reads the value of the switches (address: 0xf0100000) and displays a pattern on the LED array based on what switches. Each time the switch value is read, the pattern should be displayed regardless of whether the switch value has changed or not since the last time it was read. The table below indicates the pattern that should be displayed for each possible switch setting: Switch HexadeciBinary Switch LED Pattern Number Switch Value Value 0x00000001 0b00000001 Turn all 8 LEDs on and then off 0x0000002 0b00000010 Turn all even numbered LEDs on and then off Turn all odd numbered LEDs on and then off Cycle through all 8 LEDs in order with only one LED on at a time (a marquee) All LEDs off 0xeeeeee04 | ebeeeee 100 8x00000008 8be000100 Other Other Other

Explanation / Answer

.org 0x10000000 main: li $t0 , 0xf0100000 # load the memory address for the switches into $t0 li $t1 , 0xf0200000 # load the memory address for the LEDs into $t1 start: lw $t2 , 0($t0) # load the value from the address of the switches into $t2 sw $t2 , 0($t1) # store the value from $t2 into the address of the LEDs ($t1) j start # jump to the start label main: li $t0 , 0xf0a00000 # load the memory address for the switches into $t0 li $t1 , 0xf9a4808e # this hex number can be broken into fourths # 0xf9 - for the first(left, most significant) digit # this is 0b11111001 in binary # 0xa4 - for the second digit # 0b10100100 # 0x80 - for the third digit # 0b10000000 # 0x8e - for the fourth(last, right, least significant digit) # 0b10001110 sw $t1 , 0($t0) # this stores the value into the memory address of the seven segment display