Skip to content

December 2023 name-emu improvements#35

Open
qwe-q wants to merge 4 commits intomainfrom
lineinfo-nameemu
Open

December 2023 name-emu improvements#35
qwe-q wants to merge 4 commits intomainfrom
lineinfo-nameemu

Conversation

@qwe-q
Copy link
Collaborator

@qwe-q qwe-q commented Dec 6, 2023

The emulator has matured quite a lot in the last month. The commit info is kinda lacking, so I'll explain everything I've been up to:

System Calls

An arbitrary system call handler has been added and the instruction is now supported. Currently working are MARS syscalls PrintString, PrintInt and Exit.

ELF Loading

This one was... Difficult to figure out. name-emu now loads ELF files instead of the raw binary format we were using earlier. This allows for split data and text segments for instance and is generally the way forward for new features given our split architecture.

Bug fixes and cleanup

It seems that name-emu is far from my most bug-free work. Many details both subtle and obvious were completely wrong in the emulator causing wild crashes in more complicated programs. Everything from instruction decoding to branching to memory accesses to arithmetic was touched.

New instructions

  • jr
  • syscall
  • bltz
  • bgtz
  • addi
  • addiu

With all of these changes, the Fibonacci program set out for us as a target program runs successfully. name-emu reports:

The Fibonacci numbers are:
1 1 2 3 5 8 13 21 34 55 89 144

This PR is not yet mergeable; it will break the rest of NAME because name-as cannot yet create ELF files. Fibonacci was tested by using the GNU MIPS utilities to assemble and link it (as and ld). The ELF file is currently hardcoded to a specific path.

name-as will need to catch up to name-emu in order to merge this PR. Is this an achievable goal by the end of the semester?

This was referenced Dec 6, 2023
fn main() -> DynResult<()> {


let elf_file_data = std::fs::read("/home/qwe/Documents/CS4485/Fibonacci_linked").unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants