y86

How to convert IA32 'cmp' instruction to Y86?

ⅰ亾dé卋堺 提交于 2020-01-04 14:04:01
问题 IA32 to Y86 ATT Assembly I have the following IA32 assembly code: Bubble: .LFB0: pushl %esi pushl %ebx movl 16(%esp), %esi movl 12(%esp), %edx subl $1, %esi andl %esi, %esi jle .L1 .L7: xorl %eax, %eax .L5: movl 4(%edx,%eax,4), %ecx movl (%edx,%eax,4), %ebx cmpl %ebx, %ecx jge .L4 movl %ebx, 4(%edx,%eax,4) movl %ecx, (%edx,%eax,4) .L4: addl $1, %eax cmpl %eax, %esi jg .L5 subl $1, %esi jne .L7 .L1: popl %ebx popl %esi ret I'm trying to convert it to Y86 assembly code. I'm having trouble

How to convert IA32 'cmp' instruction to Y86?

人盡茶涼 提交于 2020-01-04 14:03:40
问题 IA32 to Y86 ATT Assembly I have the following IA32 assembly code: Bubble: .LFB0: pushl %esi pushl %ebx movl 16(%esp), %esi movl 12(%esp), %edx subl $1, %esi andl %esi, %esi jle .L1 .L7: xorl %eax, %eax .L5: movl 4(%edx,%eax,4), %ecx movl (%edx,%eax,4), %ebx cmpl %ebx, %ecx jge .L4 movl %ebx, 4(%edx,%eax,4) movl %ecx, (%edx,%eax,4) .L4: addl $1, %eax cmpl %eax, %esi jg .L5 subl $1, %esi jne .L7 .L1: popl %ebx popl %esi ret I'm trying to convert it to Y86 assembly code. I'm having trouble

Y86 assembly global variables

别说谁变了你拦得住时间么 提交于 2019-12-31 04:26:11
问题 I am struggling to get global variables to work correctly for my Y86 assignment. Unfortunately the only examples we were provided with are in IA-32 assembly. I have searched for the last few hours but to no avail. This is very basic I know but I am a complete novice at Y86. I am "declaring" my variables as follows .align 4 x: .long 1 y: .long 4 When I use them in an operation such as irmovl x, %edx I see the value 380 is assigned to the edx register instead of the value 4. I think what is

IA32 assembly code to Y86 assembly code: leal instruction

ε祈祈猫儿з 提交于 2019-12-24 15:19:18
问题 I am studying how to convert IA32 assembly code to Y86 assembly code, and I am stuck in the following instruction which is in IA32 code: leal(%edx, %eax), %eax I cannot find the equivalent instructions for the Y86 code. I have though of two version as the following ones, but I am not sure which is right: Version 1: mrmovl (%edx), %ebx mrmovl (%eax), %esi addl %ebx, %esi rrmovl %esi, 5eax Version 2: addl %edx, %eax Does anyone have a better idea? 回答1: LEA doesn't access memory, it only does

Do I understand the stack properly in this Y86 Assembly code?

筅森魡賤 提交于 2019-12-24 08:26:18
问题 I've created this simple and pointless assembly (Y86) code to see if I understand everything that's happening in the stack when the instructions call, pushl, popl and ret are used. Like I said, this code is pointless, it's just for testing/learning purposes. Although, all memory addresses were correctly (hopeful) calculated and are not random. The assembly code is the following: | .pos 0 0x00 | irmovl Stack, %esp 0x06 | rrmovl %esp, %ebp 0x08 | irmovl $5, %eax 0x0E | call func 0x13 | halt

Does pushl %esp update ESP before or after storing?

人盡茶涼 提交于 2019-12-11 06:08:40
问题 The pushl Y86 instruction both decrements the stack pointer by 4 and writes a register value to memory. So it's not clear what the processor should do when it executes the instruction pushl %esp , since the register being pushed is being changed by the same instruction. Two possible events can occur: (1) push the original value of %esp , or (2) push the decremented value of %esp . In light of this, how could we modify this code-equivalent of pushl REG to account for, and accomdate, these

Fail to build y86-64 simulator from sources

佐手、 提交于 2019-12-02 15:35:52
问题 I am attempting to compile a simulator for Y86-64 code on Linux.I have already rewritten the makefile but it turned out like below.It said "undefined reference for 'matherr'".(Looks like it connects with gcc when linking) (cd pipe; make all GUIMODE=-DHAS_GUI TKLIBS="-L/usr/lib/ -ltk8.5 -ltcl8.5" TKINC="-I/usr/include/tcl8.5 ") make[1]: 进入目录“/home/gongchen/桌面/ICS/archlab-handout/sim/pipe” # Building the pipe-std.hcl version of PIPE ../misc/hcl2c -n pipe-std.hcl < pipe-std.hcl > pipe-std.c gcc

Fail to build y86-64 simulator from sources

房东的猫 提交于 2019-12-02 10:33:14
I am attempting to compile a simulator for Y86-64 code on Linux.I have already rewritten the makefile but it turned out like below.It said "undefined reference for 'matherr'".(Looks like it connects with gcc when linking) (cd pipe; make all GUIMODE=-DHAS_GUI TKLIBS="-L/usr/lib/ -ltk8.5 -ltcl8.5" TKINC="-I/usr/include/tcl8.5 ") make[1]: 进入目录“/home/gongchen/桌面/ICS/archlab-handout/sim/pipe” # Building the pipe-std.hcl version of PIPE ../misc/hcl2c -n pipe-std.hcl < pipe-std.hcl > pipe-std.c gcc -Wall -O2 -I/usr/include/tcl8.5 -I../misc -DHAS_GUI -o psim psim.c pipe-std.c \ ../misc/isa.c -L/usr

Y86 assembly global variables

旧时模样 提交于 2019-12-02 06:33:52
I am struggling to get global variables to work correctly for my Y86 assignment. Unfortunately the only examples we were provided with are in IA-32 assembly. I have searched for the last few hours but to no avail. This is very basic I know but I am a complete novice at Y86. I am "declaring" my variables as follows .align 4 x: .long 1 y: .long 4 When I use them in an operation such as irmovl x, %edx I see the value 380 is assigned to the edx register instead of the value 4. I think what is happening is that I am assigned the memory location to the register instead of the value. What would be