CS341 - Intro. to Computer Architecture and Organization - Professor Ackley

Tuesday and Thursday: 9:30am - 10:45am (Centennial 1028) Lab: Friday 2:00pm - 2:50pm (Centennial B146)

Y86 Processor Simulator

Goals

  • Understand what the Y86 Simulators are and what they're for
  • Install/Untar the simulator on your own cs account
  • Automatically/Manually assemble .ys assembly code to .yo object files
  • Run object code on both pipe and seq simulators

Needs


What is Y86?

The Y86 Instruction Set allows us to write x86-like assembly instructions without the complicated overhead. Essentially, Y86 was created so that one could learn the basics of writing assembly code without being overwhelmed with un-needed extras.


Commonalities

Y86 has an instruction set that is extremely similar to that of x86.
Same 8 registers:

  • %eax
  • %ecx
  • %edx
  • %ebx
  • %esi
  • %edi
  • %esp
  • %ebp

Words are stored in little-endian byte order.
Follows "AT&T Syntax", like we've been using on our machines in x86.


Differences

Y86 operations/instructions have different naming conventions than their IA32/x86 counterparts.

'Mov'es (IA32/x86 vs. Y86)

  • movl $0xabcd,%edx vs. irmovl $0xabcd,%edx
  • movl %esp,%ebx vs. rrmovl %esp,%ebx
  • movl -12(%ebp),%ecx vs. mrmovl -12(%ebp),%ecx
  • movl %esi,0x41c(%esp) vs. rmmovl %esi,0x41c(%esp)

So what's the deal? Why do the instructions have to specify directionality and type? One of the shortcomings of getting rid of all of the overhead has to do with losing some of the assumptions that the (more powerful) x86 instruction set can infer. In Y86, we have to distinctly specify:

  • Register
  • Immediate
  • Memory


Y86 Processor Simulator

Turns out that we don't have any machines which recognize and execute based on the Y86 IA. Darn.

However, we do have access to a Y86 Processor Simulator that simulates how a machine should read and execute based on the Y86 IA. That's pretty sweet.


//TODO

Download the Y86 Simulator (tar). With this tar file in the directory that you would like to install the simulator, do the following:

:$ tar -xf sim341Student.tar
:$ cd sim
:$ make clean; make

This will create a /sim directory that contains the following subdirectories:

  • misc - source code files for the YAS (Y86 assembler) and YIS (Y86 instruction set simulator).
  • seq - source code and executables for the seq simulator.
  • pipe - source code and executables for the pipe simulator.
  • y86-code - a bunch of example .ys and .yo object files. This is where you should write any code, since the make clean; make command from the /sim directory automatically compiles all .ys files in this subdirectory into .yo files using the YAS.
  • ptest - some scripts that I haven't looked into what they do.

I have already set up these simulators correctly so that they run on our Linux machines here at school. Meaning, we DO have the ability to run the processor simulators in GUI mode. Unfortunately, you will need to be physically at one of the lab machines to accomplish this, since putty (and other ssh tools) don't allow the $DISPLAY variables to be set. Who knows, maybe with some tinkering one of you could get this to work.

To simulate the execution of one of the .yo files (using SEQ), try the following steps:

  1. :$ cd seq
  2. :$ ./ssim -g ../y86-code/asum.yo

This will launch the GUI version of the SEQ simulator. You can go instruction by instruction and see what different things are being done. Play around. For more information about what the GUI version displays, check out the Y86 Simulator Guide. NOTE: to see the text version, leave out the -g flag.

NOTE: You must be in the /seq or /pipe directories when trying to run one of the simulators. Trying to do it from any other dir will fail.

Try the same with the PIPE simulator.

Compare these examples with those in your book.

Try and turn some x86 .s (Assembly. Can get by running gcc -M32 -O2 -S) into .ys.