I'm writing a MIPS simulator in C++. It takes in a text file in hex, and needs to output the register contents and the decoded instruction after every instruction. So I convert the hex file to binary to grab the opcodes, rs, rt, rd, funct, and sham field so I can figure out what instruction it is.
I'm stuck because I've come the SW and LW instructions and I'm not sure how to handle simulating the memory. I have my registers in an array[0-31] and as well as my instructions[whatever number of instructions read in], and words[whatever number or words read in].
But I'm not sure how to simulate LW and SW... I know how to encode/decode them, but the memory part (along with the offset) is throwing me off. Any suggestions? Thanks in advance for any help.