unix - Feedback on Assembly answer -


i have been asked provide solution following question;

1.a) in mips assembly, there many ways of copying contents of 1 register register, using 1 instruction. write 5 single instructions, each copy contents of $s0 $s1. cannot use mips pseudo-instructions.

i have worked out following solutions, unable find way "mark" them please reply if there "easier" ways or if think of following wrong;

add $s1, $s0, $zero addi $s1, $s0, 0 sub $s1, $s0, $zero lw $s1, 0($s0) , $s1, $s0, $zero 

as further point have following question, has thrown me, due double ^ involved;

1.b) if execute following grep command:

grep -e "^[^a][bc].*" 

which of following lines (typed on console) matched?

abc abx zc zchello abno bb bdbc bca cba bbbbb 

any of course appreciated.

4 out of 5 fine me.

however operation:

lw $s1, 0($s0) 

does not want. x(reg) syntax indirect addressing. let's $s0 contains 1165. in case, lw $s1, 0($s0) put $s1 value stored @ memory address 1165. lw $s1, 4($s0) put value @ memory address 1169 $s0.

hopefully that's clear. if not, can google indirect addressing, or ask, , i'll try explain better.

if want test out mips code, there's excellent java based mips simulator lets 'inspect' state of cpu, step through program, etc:

http://courses.missouristate.edu/kenvollmar/mars/

unfortunately i'm no grep expert can't there. unix program, take @ manpage , message:

man page:

man grep 

help message:

grep --help 

hope helps!


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -