Commit 9ec6fca3 authored by George Hotz's avatar George Hotz

full register test

parent db6b9185
...@@ -17,15 +17,23 @@ func TestCompare(t *testing.T) { ...@@ -17,15 +17,23 @@ func TestCompare(t *testing.T) {
ram := make(map[uint32](uint32)) ram := make(map[uint32](uint32))
LoadMappedFile(fn, ram, 0) LoadMappedFile(fn, ram, 0)
go RunWithRam(ram, steps, 0, func(step int, ram map[uint32](uint32)) { go RunWithRam(ram, steps, 0, func(step int, ram map[uint32](uint32)) {
fmt.Printf("%d evm %x\n", step, ram[0xc0000080]) //fmt.Printf("%d evm %x\n", step, ram[0xc0000080])
cevm <- []uint32{ram[0xc0000080] & 0x7FFFFFFF, ram[0xc0000008]} ret := []uint32{ram[0xc0000080] & 0x7FFFFFFF}
for i := uint32(0xc0000000); i < 0xc0000000+32*4; i += 4 {
ret = append(ret, ram[i])
}
cevm <- ret
}) })
go RunUnicorn(fn, steps, func(step int, mu uc.Unicorn) { go RunUnicorn(fn, steps, func(step int, mu uc.Unicorn) {
pc, _ := mu.RegRead(uc.MIPS_REG_PC) pc, _ := mu.RegRead(uc.MIPS_REG_PC)
v0, _ := mu.RegRead(uc.MIPS_REG_V0) //fmt.Printf("%d uni %x\n", step, pc)
fmt.Printf("%d uni %x\n", step, pc) ret := []uint32{uint32(pc)}
cuni <- []uint32{uint32(pc), uint32(v0)} for i := uc.MIPS_REG_ZERO; i < uc.MIPS_REG_ZERO+32; i++ {
reg, _ := mu.RegRead(i)
ret = append(ret, uint32(reg))
}
cuni <- ret
}) })
for i := 0; i < steps; i++ { for i := 0; i < steps; i++ {
...@@ -35,7 +43,7 @@ func TestCompare(t *testing.T) { ...@@ -35,7 +43,7 @@ func TestCompare(t *testing.T) {
break break
} }
if i%1000 == 0 { if i%1000 == 0 {
fmt.Println(i, x, y) fmt.Println(i, x[0:9], y[0:9])
} }
for j := 0; j < len(x); j++ { for j := 0; j < len(x); j++ {
if x[j] != y[j] { if x[j] != y[j] {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment