URL
https://opencores.org/ocsvn/zet86/zet86/trunk
Subversion Repositories zet86
Compare Revisions
- This comparison shows the changes necessary to convert path
/zet86/tags/INITIAL/tests
- from Rev 3 to Rev 49
- ↔ Reverse comparison
Rev 3 → Rev 49
/i86/04_jump1.s
0,0 → 1,213
# Jump instruction testbench 1 |
# |
# At the end (6215ns in rtl-model, 287us in spartan3), %ax=0x1234 |
# |
# ja/jnbe 1 |
# jae/jnb/jnc 2 |
# jb/jnae/jc 3 |
# jbe/jna 4 |
# je/jz 5 |
# jg/jnle 6 |
# jge/jnl 7 |
# jl/jnge 8 |
# jle/jng 9 |
# jne/jnz 10 |
# jno 11 |
# jnp/jpo 12 |
# jns 13 |
# jo 14 |
# jp/jpe 15 |
# js 16 |
# |
.code16 |
start: |
movw $0, %cx |
movw $64, %bx |
movw $0x1000, %sp |
movw %sp, %ss |
push %bx |
jmp j00 |
|
# ja/jnbe |
j00err: |
jmp jerr |
j00: |
stc |
ja j00err # (1) |
clc |
ja j01 |
|
# jae/jnb/jnc |
j01err: |
jmp jerr |
j01: |
stc |
jae j01err # (2) |
clc |
jae j02 |
|
# jb/jnae/jc |
j02err: |
jmp jerr |
j02: |
jb j02err # (3) |
stc |
jb j03 |
|
# jbe/jna |
j03err: |
jmp jerr |
j03: |
clc |
jbe j03err # (4) |
popf |
jbe j04 |
|
# je/jz |
j04err: |
jmp jerr |
j04: |
push %cx |
popf |
je j04err # (5) |
push %bx |
popf |
je j05 |
|
# jg/jnle |
j05err: |
jmp jerr |
j05: |
movw $0x08c0, %dx |
push %dx |
popf |
jg j05err # (6) |
movw $0x0880, %dx |
push %dx |
popf |
jg j06 |
|
# jge/jnl |
j06err: |
jmp jerr |
j06: |
movw $0x80, %dx |
push %dx |
popf |
jge j06err # (7) |
push %cx |
popf |
jge j07 |
|
# jl/jnge |
j07err: |
jmp jerr |
j07: |
jl j07err # (8) |
movw $0x0800, %dx |
push %dx |
popf |
jl j08 |
|
# jle/jng |
j08err: |
jmp jerr |
j08: |
push %cx |
popf |
jle j08err # (9) |
push %bx |
popf |
jle j09 |
|
# jne/jnz |
j09err: |
jmp jerr |
j09: |
jne j09err # (10) |
movw $0xcbf, %dx |
push %dx |
popf |
jne j10 |
|
# jno |
j10err: |
jmp jerr |
j10: |
movw $0x0800, %dx |
push %dx |
popf |
jno j10err # (11) |
movw $0x6ff, %dx |
push %dx |
popf |
jno j11 |
|
# jnp/jpo |
j11err: |
jmp jerr |
j11: |
movw $0x4, %dx |
push %dx |
popf |
jnp j11err # (12) |
push %cx |
popf |
jnp j12 |
|
# jns |
j12err: |
jmp jerr |
j12: |
movw $0xeff, %dx |
push %dx |
popf |
jns j12err # (13) |
push %cx |
popf |
jns j13 |
|
# jo |
j13err: |
jmp jerr |
j13: |
jo j13err # (14) |
movw $0x800, %dx |
push %dx |
popf |
jo j14 |
|
# jp/jpe |
j14err: |
jmp jerr |
j14: |
jp j14err # (15) |
movw $0x804, %dx |
push %dx |
popf |
jp j15 |
|
# js |
j15err: |
jmp jerr |
j15: |
js j15err # (16) |
movw $0x884, %dx |
push %dx |
popf |
js j16 |
jmp jerr |
|
# All correct |
j16: |
movw $0x1234, %ax |
hlt |
|
.org 65520 |
jmp start |
|
jerr: |
hlt |
|
.org 65535 |
.byte 0xff |
/i86/07_strings.s
0,0 → 1,115
# String instruction testbench |
# |
# At the end (3995ns in rtl-model, 276.1us in spartan3), %ax=0x1234 |
# |
# cmpsb 1 |
# cmpsw 2 |
# lodsb 3 |
# lodsw 4 |
# movsb 5 |
# movsw 6 |
# scasb 7 |
# scasw 8 |
# stosb 9 |
# stosw 10 |
# |
.code16 |
start: |
movw $0xf000, %cx |
movw %cx, %ds |
movw %cx, %es |
movw $0x1000, %si |
movw $0x2001, %di |
|
cmpsb # (1) flags=0x97 (SAPC) |
pushf |
ret |
|
.org 0x46 |
cmpsb # (1) flags=0x82 (S) |
pushf |
ret |
|
.org 0x82 |
cmpsb # (1) flags=0x812 (OA) |
pushf |
ret |
|
.org 0x97 |
cmpsb # (1) flags=0x46 (ZP) |
pushf |
ret |
|
.org 0x812 |
cmpsw # (2) |
pushf |
ret |
|
.org 0x883 |
movb $0x10, %ah |
std |
lodsb # (3) |
jmp *%ax |
|
.org 0x1000 |
.byte 0x01,0xff,0xff,0x80 |
.word 0x0002 |
.byte 0xc2 |
|
.org 0x10c2 |
lodsw # (4) |
jmp *%ax |
|
.org 0x1300 |
movw %ax, (%di) |
movw %dx, %es |
scasw # (8) |
jz stor |
|
.org 0x1350 |
stor: |
movb $0x80, %al |
std |
stosb # (9) |
jmp *(%di) |
|
.org 0x2001 |
.byte 0x02,0xff,0x01,0x01 |
.word 0x8001 |
|
.org 0x8013 |
movw $0xd000, %ax |
stosw # (10) |
jmp *2(%di) |
|
.org 0x80c2 |
movw %cx, %ds |
movsw # (6) |
movw %dx, %ds |
jmp *2(%di) |
|
.org 0x80ff |
movw $0x2002, %di |
movw %cx, %es |
cld |
scasb # (7) |
lahf |
jmp *%ax |
|
.org 0xc200 |
movw $0x1000, %dx |
movw %dx, %es |
movw $0xffff, %di |
movsb # (5) |
movw %dx, %ds |
movb $0xc2, (%di) |
jmp *(%di) |
|
.org 0xd000 |
movw $0x1234, %ax |
hlt |
.org 65520 |
jmp start |
|
.org 65535 |
.byte 0xff |
/i86/.bochsrc
0,0 → 1,18
romimage: file=bios.out |
cpu: count=1, ips=10000000, reset_on_triple_fault=1 |
megs: 2 |
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest |
vga: extension=none |
floppy_bootsig_check: disabled=0 |
log: bochsout.txt |
panic: action=ask |
error: action=report |
info: action=report |
debug: action=ignore |
debugger_log: - |
vga_update_interval: 300000 |
keyboard_serial_delay: 250 |
keyboard_paste_delay: 100000 |
mouse: enabled=1, type=imps2 |
private_colormap: enabled=0 |
keyboard_mapping: enabled=1, map=$BXSHARE/keymaps/x11-pc-es.map |
/i86/05_jump2.s
0,0 → 1,82
# Jump instruction testbench 2 |
# |
# At the end (3535ns in rtl-model, 274.05us in spartan3), %ax=0x1234 |
# |
# call 1 (direct same seg), 2 (indirect reg, same seg), |
# 3 (indirect mem, same seg), 4 (direct diff seg), |
# 5 (indirect mem, diff seg) |
# |
# loop 6 |
# loope/loopz 7 |
# loopne/loopnz 8 |
# ret 9 (same seg), 10 (same seg, value), 11 (diff seg), |
# 12 (diff seg, value) |
# jcxz 13 |
.code16 |
|
start: |
movw $0xf000, %bx |
movw %bx, %ds |
movw $0x1290, %ax |
|
movw $0x5, %cx |
again: |
push %cx |
loop again # (6) |
|
call *%ax # (2) |
ret # (9) |
|
.org 0x1290 |
ag2: |
movw $0xffff, %cx |
loope ag2 # (7) branch not taken |
movw $64, %dx |
push %dx |
popf |
loope cont # (7) branch taken |
hlt |
cont: |
lcall $0xe342, $0xebe0 # (4) |
jcxz cont # (13) branch not taken |
movw $0, %cx |
jcxz exit # (13) branch taken |
hlt |
exit: |
ret $10 # (10) |
|
.org 0x2000 |
call *(0x3000) # (3) |
movw $0, %dx |
push %dx |
popf |
hang: |
movw $1, %cx |
loopnz hang # (8) branch not taken |
loopne cont1 # (8) branch taken |
hlt |
cont1: |
lret # (11) |
.org 0x3000 |
.word 0xfde0 |
.word 0x4000 |
.word 0xf000 |
|
.org 0x3200 |
movw $0x2ff0, %bx |
movw $0x10, %si |
push %dx |
lcall *2(%bx,%si) # (5) |
ret |
|
.org 0x4000 |
lret $2 # (12) |
|
.org 65520 |
movw $0x1000, %sp |
movw %sp, %ss |
call start # (1) |
movw $0x1234, %ax |
hlt |
.org 65535 |
.byte 0xff |
/i86/06_interrupt.s
0,0 → 1,69
# Interrupt instruction testbench |
# |
# At the end (3737ns in rtl-model, 275.9us in spartan3), |
# %ax=0x1234, %bx=0x0ed7 |
# |
# int 1, 2 (int 3) |
# into 3 |
# iret 4 |
# |
.code16 |
start: |
movw $0, %dx |
movw %dx, %ds |
movw $0x1000, %sp |
movw %sp, %ss |
movw $0xebe0, (52) |
movw $0xe342, (54) |
|
movw $0x0eff, %ax |
push %ax |
popf |
|
int $13 # (1) |
|
jmp *%ax |
|
.org 0x0cd7 |
pushf |
pop %bx |
movw $0xebe0, (12) |
movw $0xe342, (14) |
|
int $3 # (2) |
|
movw $0x3001, (16) |
movw $0xf000, (18) |
|
into # (3) branch taken |
hlt |
|
.org 0x2000 |
pushf |
pop %ax |
clc |
iret # (4) |
|
.org 0x3001 |
pop %cx |
movw $0x4002, %cx |
push %cx |
iret |
|
.org 0x4002 |
movw $0x4ff, %dx |
push %dx |
popf |
movw $0x5000, (16) |
|
into # (3) branch not taken |
movw $0x1234, %ax |
hlt |
|
.org 0x5000 |
hlt |
|
.org 65520 |
jmp start |
.org 65535 |
.byte 0xff |
/i86/03_control.s
0,0 → 1,53
# Microprocessor control instruction test bench |
# |
# At the end (1355ns in rtl-model,262.4us in spartan3), |
# %ax=0x08d6 and %bx=0x0603 |
# |
# clc (1) |
# cld (2) |
# cli (3) |
# cmc (4) |
# hlt (5) |
# nop (6) |
# stc (7) |
# std (8) |
# sti (9) |
# |
.code16 |
start: |
movw $0x1000, %ax |
movw %ax, %ss |
movw $0x1000, %sp |
|
movw $0xfeff, %cx |
push %cx |
popf |
|
clc # (1) |
cld # (2) |
cli # (3) |
|
nop # (6) |
|
pushf |
pop %ax # %ax = 0x08d6 |
|
movw $0x1, %dx |
push %dx |
popf |
|
cmc # (4) |
stc # (7) |
std # (8) |
sti # (9) |
|
pushf |
pop %bx # %bx = 0x0603 |
|
hlt # (5) |
|
.org 65520 |
jmp start |
|
.org 65535 |
.byte 0xff |
/i86/addsub.s
0,0 → 1,207
.code16 |
a: |
|
# |
# ADC |
# |
# 1: A negativo, B positivo: A: ffff B: 0001, A+B=0, ZAPC |
movw $0xffff,%ax |
movw $1,%bx |
adcw %bx,%ax |
|
# 2: A negativo, B positivo, A+B < 16 bits: A: ffff B: ffff, C A+B=ffff SAPC |
movw $0xffff,%ax |
movw $0xffff,%bx |
adcw %bx,%ax |
|
# 3: A positivo, B positivo, A+B < 16 bits: A: 0001 B: 0002, A+B=3, P |
movw $0x0001,%ax |
movw $0x0002, %bx |
adcw %bx,%ax |
|
# 4: A pos, B pos, A+B = 16 bits: A: 7fff B: 0001, A+B=8000, OSAP |
movw $0x7fff,%ax |
movw $0x0001,%bx |
adcw %bx,%ax |
|
# 5: A neg, B neg, A+B = 16 bits: A: 8000 B: ffff, A+B=0fff OPC |
movw $0x8000,%ax |
movw $0xffff,%bx |
adcw %bx,%ax |
|
# 6: A aleat, B aleat: A: 1a62 B: ed8a, A+B= |
movw $0x1a62,%ax |
movw $0xed8a,%bx |
adcw %bx,%ax |
|
# |
# ADD |
# |
# 7: A negativo, B positivo: A: ffff B: 0001, A+B=0, ZAPC |
movw $0xffff,%ax |
movw $1,%bx |
addw %bx,%ax |
|
# 8: A negativo, B positivo, A+B < 16 bits: A: ffff B: ffff, C A+B=ffff SAPC |
movw $0xffff,%ax |
movw $0xffff,%bx |
addw %bx,%ax |
|
# 9: A positivo, B positivo, A+B < 16 bits: A: 0001 B: 0002, A+B=3, P |
movw $0x0001,%ax |
movw $0x0002, %bx |
addw %bx,%ax |
|
# 10: A pos, B pos, A+B = 16 bits: A: 7fff B: 0001, A+B=8000, OSAP |
movw $0x7fff,%ax |
movw $0x0001,%bx |
addw %bx,%ax |
|
# 11: A neg, B neg, A+B = 16 bits: A: 8000 B: ffff, A+B=0fff OPC |
movw $0x8000,%ax |
movw $0xffff,%bx |
addw %bx,%ax |
|
# 12: A aleat, B aleat: A: 027f B: 846c, A+B= |
movw $0x027f,%ax |
movw $0x846c,%bx |
addw %bx,%ax |
|
# |
# INC |
# |
# 13: A-, -1: A: ffff. Da carry, no debería cambiar el flag de C |
movw $0xffff,%ax |
incw %ax |
|
# 14: A+: 7fff. Overflow |
movw $0x7fff,%ax |
incw %ax |
|
# 15: A aleat. 4513 |
movw $0x4513,%ax |
incw %ax |
|
# |
# DEC |
# |
# 16: A: 0000. |
movw $0x0000,%ax |
decw %ax |
|
# 17: B: 8000. Underflow |
movw $0x8000,%ax |
decw %ax |
|
# 18: A aleat. c7db |
movw $0xc7db,%ax |
decw %ax |
|
# |
# NEG |
# |
# 19: A: 0 |
movw $0x0000,%ax |
negw %ax |
|
# 20: A: 8000. Overflow |
movw $0x8000,%ax |
negw %ax |
|
# 21: A aleat. fac4 |
movw $0xfac4,%ax |
negw %ax |
|
# |
# SBB |
# |
# 22: A+, B+, A-B siempre será menor de 16 bits: A: 0001 B: 0002 A-B=ffff SAPC |
movw $0x0001,%ax |
movw $0x0002,%bx |
sbbw %bx,%ax |
|
# 23: A-, B-, A-B siempre será menor de 16 bits: A: ffff B: ffff A-B=0 ZP |
movw $0xffff,%ax |
movw $0xffff,%bx |
sbbw %bx,%ax |
|
# 24: A-, B+, A-B < 16 bits: A: ffff B:1 A-B=fffe S |
movw $0xffff,%ax |
movw $0x0001,%bx |
sbbw %bx,%ax |
|
# 25: A-, B+, A-B = 16 bits: A: 8000 B:1 A-B=7fff OAP |
movw $0x8000,%ax |
movw $0x0001,%bx |
sbbw %bx,%ax |
|
# 26: A aleat, B aleat, con carry: A: a627 B: 03c5, C A-B= |
movw $0xa627,%ax |
movw $0x03c5,%bx |
stc |
sbbw %bx,%ax |
|
# |
# SUB |
# |
# 27: A+, B+, A-B siempre será menor de 16 bits: A: 0001 B: 0002 A-B=ffff SAPC |
movw $0x0001,%ax |
movw $0x0002,%bx |
subw %bx,%ax |
|
# 28: A-, B-, A-B siempre será menor de 16 bits: A: ffff B: ffff A-B=0 ZP |
movw $0xffff,%ax |
movw $0xffff,%bx |
subw %bx,%ax |
|
# 29: A-, B+, A-B < 16 bits: A: ffff B:1 A-B=fffe S |
movw $0xffff,%ax |
movw $0x0001,%bx |
subw %bx,%ax |
|
# 30: A-, B+, A-B = 16 bits: A: 8000 B:1 A-B=7fff OAP |
movw $0x8000,%ax |
movw $0x0001,%bx |
subw %bx,%ax |
|
# 31: A aleat, B aleat, con carry: A: a627 B: 03c5, C A-B= |
movw $0xa627,%ax |
movw $0x03c5,%bx |
stc |
subw %bx,%ax |
|
# |
# CMP |
# |
# 32: A+, B+, A-B siempre será menor de 16 bits: A: 0001 B: 0002 A-B=ffff SAPC |
movw $0x0001,%ax |
movw $0x0002,%bx |
cmpw %bx,%ax |
|
# 33: A-, B-, A-B siempre será menor de 16 bits: A: ffff B: ffff A-B=0 ZP |
movw $0xffff,%ax |
movw $0xffff,%bx |
cmpw %bx,%ax |
|
# 34: A-, B+, A-B < 16 bits: A: ffff B:1 A-B=fffe S |
movw $0xffff,%ax |
movw $0x0001,%bx |
cmpw %bx,%ax |
|
# 35: A-, B+, A-B = 16 bits: A: 8000 B:1 A-B=7fff OAP |
movw $0x8000,%ax |
movw $0x0001,%bx |
cmpw %bx,%ax |
|
# 36: A aleat, B aleat, con carry: A: aa97 B: 3b46, C A-B= |
movw $0xaa97,%ax |
movw $0x3b46,%bx |
stc |
cmpw %bx,%ax |
|
|
.org 65520 |
jmp a |
|
.org 65535 |
.byte 0xff |
/i86/02_datatrnf.s
0,0 → 1,88
# Recursive testbench for transfer data instructions, except "mov" |
# but ("jmp" & "mov" must work!!) |
# |
# At the end (3591ns in rtl-model, 274380ns in spartan3), %ax=0x8cf1 |
# |
# sahf 1 |
# lahf 2 |
# lds 3 |
# lea 4 |
# les 5 |
# pop 6 (reg,non-st), 7 (seg), 8 (mem) |
# popf 9 |
# push 10 (reg), 11 (seg), 12 (mem) |
# pushf 13 |
# xchg 14 (reg-reg), 15 (reg-mem), 16 (reg-acum), 17 (reg-reg,byte) |
# xlat 18 |
# in 19 (byte,imm) 20 (byte,dx) 21 (word,imm) 22 (word,dx) |
# out 23 (byte,imm) 24 (byte,dx) 25 (word,imm) 26 (word,dx) |
|
.code16 |
start: |
movb $0xed, %ah |
sahf # (1) |
lahf # (2) Now %ah must have 0xc7 |
movb %ah, %al |
outb %al, $0xb7 # (19) |
movw $0xb7, %ax |
movw %ax, %dx |
movb $0xa5, %ah |
inb %dx, %al # (24) |
sahf |
lahf # Now %ax must have 0x87c7 |
|
outw %ax, %dx # (22) |
movw $0xf752, %ax |
movw %ax, %bx |
inw %dx, %ax # (26) |
xchg %bx, %ax # (16) |
movw %ax, %ds |
lds 781(%bx), %si # (3) %ds=0x5678 and %si=0x1234 |
|
movw $-1, %bx |
|
movw $0x1000, %ax |
outw %ax, $0xb7 # (21) |
|
movw $0x5798, %ax |
movw %ax, %ss |
movw $9, %sp |
movw $0xabcd, %cx |
push %cx # (10) |
movw $0x8cf1, %cx |
movw %cx, %es |
push %es # (11) |
popf # (9) |
les -46(%bx,%si), %di # (5) %di=0x8cf1, %es=%0xabcd |
lea -452(%bp,%di), %si # (4) %si=0x8b2d |
pushf # (13) |
inw $0xb7, %ax # (25) |
movw %ax, %ds |
pop 1(%si) # (8) |
xchg 2(%bx,%si), %di # (15) %di=0x0cd3 |
push 2(%bx,%si) # (12) |
pop %es # (7) %es=0x8cf1 |
pop %dx # (6) |
push %dx |
.byte 0x8f,0xc1 # (6) pop %cx (non-standard) |
xchg %bx, %cx # (14) %bx=0xabcd, %cx=0xffff |
movw %es, (%bx,%di) |
movw $0xb800, %bx |
movw $0xa0a1, %ax |
xlat # (18) %al=0x8c |
xchg %al, %ah # (17) |
xlat # %ax=0x8cf1 |
movw $0xb7, %dx |
outb %al, %dx # (20) |
movb $0xff, %al |
inb $0xb7, %al # (23) %ax=0x8cf1 |
|
.org 65520 |
jmp start |
|
.org 65524 |
.word 0x1234 |
.word 0x5678 |
|
.org 65535 |
.byte 0xff |
/i86/09_vdu.s
0,0 → 1,13
.code16 |
start: |
movw $0xb800, %dx |
movw %dx, %ds |
movw $0x034d, (4) |
movw (1), %cx |
hlt |
|
.org 65520 |
jmp start |
|
.org 65535 |
.byte 0xff |
/i86/01_jmpmov.s
0,0 → 1,66
# Prueba de todos los modos del mov y jmp |
# At the end (2415ns in rtl-model, 274.3us in spartan3), %es = 0x4001 |
# |
# mov: 1 (word), 2 (word), 3 (off, base+index+off), 4, 5 (off), |
# 7 (byte,word), 8 (byte off), 9 (word base), 10 (byte,word), |
# 11 (word off, byte base+index), 12 (imm,special) |
# jmp: 1, 2, 3 (reg), 3 (mem base+index+off), 4, 5 (mem base+index+off) |
.code16 |
start: |
jmp b # (2) jmp |
|
.org 14 |
b: |
movw $0xf000, %bx # (10) mov word |
movw %bx, %ds # (4) mov |
movw (0xfff3), %ax # (2) mov word |
jmp *%ax # (3) jmp reg |
|
.org 0x1290 |
ljmp $0xe342, $0xebe0 # (4) jmp |
|
.org 0x2000 |
movw $0x1000, %bx # (10) mov word |
movw %bx, %ds # (4) mov |
|
movb $0xfb, %ah # (10) mov byte |
movb $0xe1, %al # (10) mov byte |
movw %ax, (0x2501) # (1) mov word |
|
movw $0x1001, (0x2600) # (11) mov word |
movw (0x2600), %ss # (3) mov |
|
movw %ss, (0x2601) # (5) mov |
movb (0x2601), %dl # (8) mov byte |
movb $0x00, %dh # (10) mov byte |
movw %dx, %di # (7) mov word |
|
movw $0x2506, %bp # (10) mov word |
|
jmp *-22(%bp,%di) # (3) jmp mem |
# m[0x12501] = 0xfbe1 |
.org 0x3001 |
.byte 0xc7,0xc0 # (12) movw $0x4001, %ax |
.word 0x4001 # [not in a default codification] |
movw $0x2501, %bx |
movw %ax, (%bx) # (9) mov word |
movw $2, %di |
movb $0x00, (%bx,%di) # (11) mov byte |
movb $4, %ch |
movb %ch, %cl # (7) mov byte |
movb $0, %ch |
movw %cx, %si |
movb $0xf0, -1(%bx,%si) |
movw $0x3, %si |
ljmp *-24(%bp,%si) # (5) jmp mem |
|
.org 0x4001 |
movw -3(%bx,%si), %es |
|
.org 65520 |
jmp start # (1) jmp |
.word 0x1290 |
|
.org 65534 |
.word 0xffff |
|
/i86/Makefile
0,0 → 1,38
s3roms := $(patsubst %.s,%.s3rom,$(wildcard *.s)) |
rtlroms := $(patsubst %.s,%.rtlrom,$(wildcard *s)) |
all: $(s3roms) $(rtlroms) |
|
# altera: ../../altera/zet/simulation/modelsim/bios0.dat ../../altera/zet/simulation/modelsim/bios1.dat |
|
# ../../altera/zet/simulation/modelsim/bios0.dat: bios0.out |
# hexdump -v -e '1/1 "%02X"' -e '"\n"' bios0.out > ../../altera/zet/simulation/modelsim/bios0.dat |
|
#../../altera/zet/simulation/modelsim/bios1.dat: bios1.out |
# hexdump -v -e '1/1 "%02X"' -e '"\n"' bios1.out > ../../altera/zet/simulation/modelsim/bios1.dat |
|
#../../sim/bios.dat: bios.out |
# hexdump -v -e '1/1 "%02X"' -e '"\n"' bios.out > ../../sim/bios.dat |
# hexdump -v -e '1/2 "0x1%04_ax/%04x"' -e '"\n"' bios.out | awk -F/ '{printf "00%x/%s\n", rshift(strtonum($$1),1), $$2}' > ../../impl/spartan3an-sk/sim/flash-prom/memory_file |
|
#$(BIOS): bios.out |
# splitlh bios.out $(BIOS) |
|
%.s3rom: %.out |
hexdump -v -e '1/2 "0x1%04_ax/%04x"' -e '"\n"' $< | awk -F/ '{printf "00%x/%s\n", rshift(strtonum($$1),1), $$2}' > ../../impl/spartan3an-sk/sim/flash-prom/$@ |
|
%.mcs: %.out |
echo :020000040001F9 > $@ |
hexdump -v -e '":20%04_ax00"' -e '32/1 "%02x"' -e '"00"' -e '"\n"' $< | tr a-z A-Z >> $@ |
echo :00000001FF >> $@ |
|
%.rtlrom: %.out |
hexdump -v -e '1/1 "%02X"' -e '"\n"' $< > ../../sim/$@ |
|
%.out: %.o |
objcopy -O binary -S $< $@ |
|
%.o: %.c |
as $< -o $@ |
|
clean: |
rm -f *.o *.out *.mcs ../../impl/spartan3an-sk/sim/flash-prom/*.s3rom ../../sim/*.rtlrom |
/i86/08_rep.s
0,0 → 1,281
# String repeating prefixes testbench |
# At the end (12835ns in rtl-model, 319.5us in spartan3), %ax=0x1234 |
# |
# rep, repz, repnz |
|
.code16 |
start: |
|
# Trivial cases. With %cx 0, nothing is executed |
rep movsb |
repz movsb |
repnz movsb |
rep cmpsb |
repz cmpsb |
repnz cmpsb |
rep scasb |
repz scasb |
repnz scasb |
rep lodsb |
repz lodsb |
repnz lodsb |
rep stosb |
repz stosb |
repnz stosb |
|
|
movw $0x40, %bx |
push %bx |
popf |
|
# Now we have the zero flag set, nothing is executed because of %cx |
|
rep movsb |
repnz movsb |
repz cmpsb |
repnz cmpsb |
repz scasb |
repnz scasb |
rep lodsb |
repnz lodsb |
rep stosb |
repnz stosb |
|
movw %di, %ax |
movb $0x10, %ah |
jmp *%ax # jump to 0xf1000 |
hlt |
|
.org 0x102 |
jmp rep_stos_z |
|
.org 0x607 |
jmp rep_lods_nz |
|
.org 0x809 |
jmp rep_movs_nz |
|
.org 0x0ffc |
jmp cont_n5 |
.org 0x0ffe |
jmp cont_n10 |
# Prefixes don't affect normal instructions |
.org 0x1000 |
movw $0, %cx |
.byte 0xf3 |
push %cx |
jmp *%sp |
|
cont_n10: |
movw $0x110a, %cx |
.byte 0xf3 |
push %cx |
jmp *%sp |
|
cont_n5: |
jmp *%cx |
|
.org 0x110a |
movw $0x5, %cx |
|
movw $0, %dx |
push %dx |
popf |
.byte 0xf2 |
pop %cx |
|
movw %cx, %ax |
movb $0x20, %ah |
jmp *%ax # jump to 0xf200a |
|
.org 0x122c |
jmp repz_cmps_nz |
|
.org 0x122f |
jmp repz_scas |
|
# rep movs ZF=1 |
.org 0x200a |
push %bx |
popf |
movw $2, %cx |
movw $0x3000, %si |
movw $0xf000, %ax |
movw %ax, %ds |
movw $0x1000, %ax |
movw %ax, %es |
movw $0x0000, %di |
|
rep movsb |
|
movw %ax, %ds |
movw (0x0000), %ax |
movw %di, %bp |
movw %ax, (%bp,%si) |
jcxz comp_disi |
hlt |
comp_disi: |
jmp *(0x3004) |
|
.org 0x3000 |
.byte 0x09,0x08,0x07,0x06,0x5,0x4,0x3,0x2,0x1,0xa,0xb,0xc,0xd |
|
|
# rep movs ZF=0 |
rep_movs_nz: |
movw $0xf000, %ax |
movw %ax, %ds |
movw $0x1, %cx |
movw $0, %ax |
pushw %ax |
popf |
|
rep movsw |
|
movw $0x1000, %ax |
movw %ax, %ds |
movw (0x0002), %ax |
movw %di, %bp |
movw %ax, (%bp,%si) |
jcxz movs_nz |
hlt |
movs_nz: |
jmp *(0x3008) |
|
# rep lods ZF=0 |
rep_lods_nz: |
movw $0xf000, %ax |
movw %ax, %ds |
movw $0x3, %cx |
rep lodsb |
|
jmp *%ax |
hlt |
rep_lods_z: |
# rep lods ZF=1 |
movw $0x40, %bx |
push %bx |
popf |
movw $0xf000, %ax |
movw %ax, %ds |
movw $0x1, %cx |
rep lodsw |
jmp *%ax |
|
# rep stos ZF=1 |
rep_stos_z: |
movw $0x2, %cx |
movw $0x4000, %ax |
rep stosw |
movw $0x1000, %ax |
movw %ax, %ds |
jmp *(0x0006) |
hlt |
|
.org 0x4000 |
# rep stos ZF=0 |
movw $0x0, %bx |
push %bx |
popf |
movw $0x4, %cx |
rep stosw |
jcxz repz_cmps_z |
hlt |
|
# repz cmps ZF=1, but ZF=0 before %cx=0 |
repz_cmps_z: |
movw $0x40, %bx |
push %bx |
popf |
movw $0x1234, %cx |
movw $0x3000, %si |
movw $0, %di |
movw $0xf000, %ax |
movw %ax, %ds |
repz cmpsb |
|
jmp *%cx |
|
# repz scas ZF=1, but ZF=0 before %cx=0 |
repz_scas: |
movw $0x40, %bx |
push %bx |
popf |
movw $0x0040, %ax |
repz scasw |
jmp *%cx |
|
# repz cmps scas ZF=0, they do only one iteration |
repz_cmps_nz: |
movw $0x0607, %ax |
movw $0x5004, %cx |
repz cmpsw |
repz scasw |
movw $0x40, %bx |
push %bx |
popf |
movw $0x3000, %si |
movw $0x0, %di |
# repnz cmps scas ZF=1, they do only one iteration |
repnz cmpsw |
repnz scasw |
jmp *%cx |
hlt |
|
.org 0x5000 |
# repnz movs ZF=1 all iterations |
repnz_movs: |
movw $0x2, %cx |
repnz movsb |
jcxz repnz_lods |
hlt |
|
# repnz lods ZF=1 all iterations |
repnz_lods: |
movw $0x2, %cx |
repnz lodsb |
jcxz repnz_stos |
hlt |
|
# repnz stos ZF=1 all iterations |
repnz_stos: |
movw $0x2, %cx |
repnz stosb |
jcxz repnz_cmps |
hlt |
|
# repnz cmps ZF=0, but ZF=1 before %cx=0 |
repnz_cmps: |
movw $0, %bx |
push %bx |
popf |
movw $0x6023, %cx |
std |
movw $0x6, %di |
movw $0x3006, %si |
repnz cmpsw |
|
# repnz scas ZF=0, but ZF=1 before %cx=0 |
movw $0x1000, %ax |
movw $0, %bx |
push %bx |
popf |
cld |
repnz scasw |
jmp *%cx |
hlt |
|
.org 0x601b |
movw $0x1234, %ax |
hlt |
|
.org 0xf003 |
jmp rep_lods_z |
|
.org 65520 |
movw $0x1000, %sp |
movw %sp, %ss |
jmp start |
|
.org 65535 |
.byte 0xff |