CS273 HW 7 - Ziad Arafat

  1. ASR on the first byte and ROR on the remaining bytes.
CLC // R19, R18, R17, R16 ldi R20, 7 loop: ASR R19 ROR R18 ROR R17 ROR R16 dec R20 cpi R20, 0 BRNE loop

  1. 0x22
0x8A >1000 1010 >0100 0101 >0010 0010 0x22

  1. PROGRAM:
// R16< The sequence we are searching in // R17< 0000 1010 // R18< 0000 1111 // R19< tmporary spot for R16 LDI R17, 0b00001010 LDI R18, 0b00001111 // do it 8 times LDI R20, 8 LOOP: MOV R19, R16 // Copy R16 to R19 AND R19, R18 // Remove the front nibble CP R19, R17 // Compare to 1010 // Did we find 1010? BREQ FOUND ROR R16 // shift it right to check the next 4 bits DEC R20 cpi R20, 0 BREQ NOTFOUND // Did we not find it? JMP LOOP FOUND: // WE FOUND IT // does something jmp FINISH NOTFOUND: // WE DIDN'T FIND IT // does something else FINISH: ret

  1. The step sizes are
    1. 3222Volts\frac{32}{2^{2}} Volts

    2. 3228Volts\frac{32}{2^{8}}Volts

    3. 32216Volts\frac{32}{2^{16}}Volts


Step Size=25.6210Step\ Size=\frac{25.6}{2^{10}}

Dout=VinStep SizeD_{out} = \frac{V_{in}}{Step\ Size}

Vin=Step Size×DoutV_{in} = Step\ Size \times D_{out}

Therefore:


  1. Same process as before.