Skip to content

Commit

Permalink
add test data
Browse files Browse the repository at this point in the history
  • Loading branch information
hczhcz committed May 19, 2014
1 parent 9a13155 commit 5fc2710
Show file tree
Hide file tree
Showing 104 changed files with 506 additions and 0 deletions.
Binary file added y86-app-bin/abs-asum-cmov.bin
Binary file not shown.
Binary file added y86-app-bin/abs-asum-jmp.bin
Binary file not shown.
Binary file added y86-app-bin/asum.bin
Binary file not shown.
Binary file added y86-app-bin/asumr.bin
Binary file not shown.
Binary file added y86-app-bin/cjr.bin
Binary file not shown.
Binary file added y86-app-bin/j-cc.bin
Binary file not shown.
Binary file added y86-app-bin/poptest.bin
Binary file not shown.
Binary file added y86-app-bin/prog1.bin
Binary file not shown.
Binary file added y86-app-bin/prog10.bin
Binary file not shown.
Binary file added y86-app-bin/prog2.bin
Binary file not shown.
Binary file added y86-app-bin/prog3.bin
Binary file not shown.
Binary file added y86-app-bin/prog4.bin
Binary file not shown.
Binary file added y86-app-bin/prog5.bin
Binary file not shown.
Binary file added y86-app-bin/prog6.bin
Binary file not shown.
Binary file added y86-app-bin/prog7.bin
Binary file not shown.
Binary file added y86-app-bin/prog8.bin
Binary file not shown.
Binary file added y86-app-bin/prog9.bin
Binary file not shown.
Binary file added y86-app-bin/pushquestion.bin
Binary file not shown.
Binary file added y86-app-bin/pushtest.bin
Binary file not shown.
Binary file added y86-app-bin/ret-hazard.bin
Binary file not shown.
52 changes: 52 additions & 0 deletions y86-base/abs-asum-cmov.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Modification of asum code to compute absolute values of entries.
# This version uses a conditional jump
# Execution begins at address 0
.pos 0
init: irmovl Stack, %esp # Set up Stack pointer
irmovl Stack, %ebp # Set up base pointer
jmp Main # Execute main program

# Array of 4 elements
.align 4
array: .long 0x0000000d
.long 0xffffff40 # -0xc0
.long 0x00000b00
.long 0xffff6000 # -0xa0000

Main: irmovl $4,%eax
pushl %eax # Push 4
irmovl array,%edx
pushl %edx # Push array
call AbsSum # Sum(array, 4)
halt

# int AbsSum(int *Start, int Count)
AbsSum:
pushl %ebp
rrmovl %esp,%ebp
mrmovl 8(%ebp),%ecx # ecx = Start
mrmovl 12(%ebp),%edx # edx = Count
irmovl $0, %eax # sum = 0
andl %edx,%edx
je End
#/* $begin abs-sum-cmov-ys 0 */
Loop:
mrmovl (%ecx),%esi # get x = *Start
irmovl $0,%edi # 0
subl %esi,%edi # -x
cmovg %edi,%esi # if -x > 0 then x = -x
addl %esi,%eax # add x to sum
irmovl $4,%ebx #
addl %ebx,%ecx # Start++
irmovl $-1,%ebx #
addl %ebx,%edx # Count--
jne Loop # Stop when 0
#/* $end abs-sum-cmov-ys 0 */
End:
popl %ebp
ret

.pos 0x100
Stack: # The stack goes here
#/* $end code-ysa */
#/* $end code-yso */
53 changes: 53 additions & 0 deletions y86-base/abs-asum-jmp.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Modification of asum code to compute absolute values of entries.
# This version uses a conditional jump
# Execution begins at address 0
.pos 0
init: irmovl Stack, %esp # Set up Stack pointer
irmovl Stack, %ebp # Set up base pointer
jmp Main # Execute main program

# Array of 4 elements
.align 4
array: .long 0x0000000d
.long 0xffffff40 # -0xc0
.long 0x00000b00
.long 0xffff6000 # -0xa0000

Main: irmovl $4,%eax
pushl %eax # Push 4
irmovl array,%edx
pushl %edx # Push array
call AbsSum # Sum(array, 4)
halt

#/* $begin abs-sum-jmp-ys 0 */
# int AbsSum(int *Start, int Count)
AbsSum:
pushl %ebp
rrmovl %esp,%ebp
mrmovl 8(%ebp),%ecx # ecx = Start
mrmovl 12(%ebp),%edx # edx = Count
irmovl $0, %eax # sum = 0
andl %edx,%edx
je End
Loop:
mrmovl (%ecx),%esi # get x = *Start
irmovl $0,%edi # 0
subl %esi,%edi # -x
jle Pos # Skip if -x <= 0
rrmovl %edi,%esi # x = -x
Pos:
addl %esi,%eax # add x to sum
irmovl $4,%ebx #
addl %ebx,%ecx # Start++
irmovl $-1,%ebx #
addl %ebx,%edx # Count--
jne Loop # Stop when 0
End:
popl %ebp
ret
#/* $end abs-sum-jmp-ys 0 */
.pos 0x100
Stack: # The stack goes here
#/* $end code-ysa */
#/* $end code-yso */
4 changes: 4 additions & 0 deletions y86-base/addl.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# test addl
addl %esi, %edi
halt
# end
5 changes: 5 additions & 0 deletions y86-base/align.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test .align
.align 4
halt
.align 8
# end
4 changes: 4 additions & 0 deletions y86-base/andl.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# test andl
andl %esi, %edi
halt
# end
53 changes: 53 additions & 0 deletions y86-base/asum.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#/* $begin code-yso */
#/* $begin code-ysa */
# Execution begins at address 0
.pos 0
init: irmovl Stack, %esp # Set up stack pointer
irmovl Stack, %ebp # Set up base pointer
call Main # Execute main program
halt # Terminate program

# Array of 4 elements
.align 4
array: .long 0xd
.long 0xc0
.long 0xb00
.long 0xa000

Main: pushl %ebp
rrmovl %esp,%ebp
irmovl $4,%eax
pushl %eax # Push 4
irmovl array,%edx
pushl %edx # Push array
call Sum # Sum(array, 4)
rrmovl %ebp,%esp
popl %ebp
ret

#/* $begin sum-ys 0 */
# int Sum(int *Start, int Count)
Sum: pushl %ebp
rrmovl %esp,%ebp
mrmovl 8(%ebp),%ecx # ecx = Start
mrmovl 12(%ebp),%edx # edx = Count
xorl %eax,%eax # sum = 0
andl %edx,%edx # Set condition codes
je End
Loop: mrmovl (%ecx),%esi # get *Start
addl %esi,%eax # add to sum
irmovl $4,%ebx #
addl %ebx,%ecx # Start++
irmovl $-1,%ebx #
addl %ebx,%edx # Count--
jne Loop # Stop when 0
End: rrmovl %ebp,%esp
popl %ebp
ret
#/* $end sum-ys 0 */

# The stack starts here and grows to lower addresses
.pos 0x100
Stack:
#/* $end code-ysa */
#/* $end code-yso */
48 changes: 48 additions & 0 deletions y86-base/asumr.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Execution begins at address 0
.pos 0
init: irmovl Stack, %esp # Set up Stack pointer
irmovl Stack, %ebp # Set up base pointer
jmp Main # Execute main program

# Array of 4 elements
.align 4
array: .long 0xd
.long 0xc0
.long 0xb00
.long 0xa000

Main: irmovl $4,%eax
pushl %eax # Push 4
irmovl array,%edx
pushl %edx # Push array
call rSum # Sum(array, 4)
halt

#/* $begin rsum-ys */
# int Sum(int *Start, int Count)
rSum: pushl %ebp
rrmovl %esp,%ebp
pushl %ebx # Save value of %ebx
mrmovl 8(%ebp),%ebx # Get Start
mrmovl 12(%ebp),%eax # Get Count
andl %eax,%eax # Test value of Count
jle L38 # If <= 0, goto zreturn
irmovl $-1,%edx
addl %edx,%eax # Count--
pushl %eax # Push Count
irmovl $4,%edx
rrmovl %ebx,%eax
addl %edx,%eax
pushl %eax # Push Start+1
call rSum # Sum(Start+1, Count-1)
mrmovl (%ebx),%edx
addl %edx,%eax # Add *Start
jmp L39 # goto done
L38: xorl %eax,%eax # zreturn:
L39: mrmovl -4(%ebp),%ebx # done: Restore %ebx
rrmovl %ebp,%esp # Deallocate stack frame
popl %ebp # Restore %ebp
ret
#/* $end rsum-ys */
.pos 0x400
Stack: # The stack goes here
7 changes: 7 additions & 0 deletions y86-base/byte.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# test .byte
halt
Data:
.byte 0x0A
.byte 0x1B
.byte 0x2C
# end
5 changes: 5 additions & 0 deletions y86-base/call.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test call
Func1:
call Func1
halt
# end
17 changes: 17 additions & 0 deletions y86-base/cjr.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# /* $begin cjr-ys */
# Code to generate a combination of not-taken branch and ret
irmovl Stack, %esp
irmovl rtnp,%eax
pushl %eax # Set up return pointer
xorl %eax,%eax # Set Z condition code
jne target # Not taken (First part of combination)
irmovl $1,%eax # Should execute this
halt
target: ret # Second part of combination
irmovl $2,%ebx # Should not execute this
halt
rtnp: irmovl $3,%edx # Should not execute this
halt
.pos 0x40
Stack:
# /* $end cjr-ys */
4 changes: 4 additions & 0 deletions y86-base/cmove.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# test cmove
cmove %esi, %edi
halt
# end
4 changes: 4 additions & 0 deletions y86-base/cmovg.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# test cmovg
cmovg %eax, %ebx
halt
# end
4 changes: 4 additions & 0 deletions y86-base/cmovge.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# test cmovge
cmovge %eax, %ebx
halt
# end
4 changes: 4 additions & 0 deletions y86-base/cmovl.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# test cmovl
cmovl %esi, %edi
halt
# end
4 changes: 4 additions & 0 deletions y86-base/cmovle.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# test cmovle
cmovle %esi, %edi
halt
# end
4 changes: 4 additions & 0 deletions y86-base/cmovne.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# test cmovne
cmovne %esi, %edi
halt
# end
3 changes: 3 additions & 0 deletions y86-base/halt.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# halt immediately
halt # Terminate program
# end
5 changes: 5 additions & 0 deletions y86-base/irmovl.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test irmovl
irmovl $123, %eax
irmovl $-123, %ebx
halt
# end
15 changes: 15 additions & 0 deletions y86-base/j-cc.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
irmovl $1, %esi
irmovl $2, %edi
irmovl $4, %ebp
irmovl $-32, %eax
irmovl $64, %edx
subl %edx,%eax
je target
nop
halt
target:
addl %esi,%edx
nop
nop
nop
halt
5 changes: 5 additions & 0 deletions y86-base/je.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test je
Loop:
je Loop
halt
# end
5 changes: 5 additions & 0 deletions y86-base/jg.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test jg
Loop:
jg Loop
halt
# end
5 changes: 5 additions & 0 deletions y86-base/jge.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test jge
Loop:
jge Loop
halt
# end
5 changes: 5 additions & 0 deletions y86-base/jl.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test jl
Loop:
jl Loop
halt
# end
5 changes: 5 additions & 0 deletions y86-base/jle.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test jle
Loop:
jle Loop
halt
# end
5 changes: 5 additions & 0 deletions y86-base/jmp.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test jmp
Loop:
jmp Loop
halt
# end
5 changes: 5 additions & 0 deletions y86-base/jne.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test jne
Loop:
jne Loop
halt
# end
7 changes: 7 additions & 0 deletions y86-base/long.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# test .long
halt
Data:
.long 0xfffff70A
.long 0x0000001B
.long 0xfff9062C
# end
6 changes: 6 additions & 0 deletions y86-base/mrmovl.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# test mrmovl
mrmovl -2(%esp), %eax
mrmovl (%ebx), %esi
mrmovl 8(%ebp), %ecx
halt
# end
5 changes: 5 additions & 0 deletions y86-base/nop.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# nop, nop and halt
nop
nop
halt # Terminate program
# end
4 changes: 4 additions & 0 deletions y86-base/popl.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# test popl
popl %ebp
halt
# end
6 changes: 6 additions & 0 deletions y86-base/poptest.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Test of Pop semantics for Y86
irmovl $0x100,%esp # Initialize stack pointer
irmovl $0xABCD,%eax
pushl %eax # Put known value on stack
popl %esp # Either get 0xABCD, or 0xfc
halt
7 changes: 7 additions & 0 deletions y86-base/pos.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# test .pos
.pos 0
Begin:
halt
.pos 0x100
Stack:
# end
Loading

0 comments on commit 5fc2710

Please sign in to comment.