mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
improve check function
This commit is contained in:
parent
a71fa2f522
commit
61bfbbff8a
1 changed files with 10 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
import random
|
import random, copy
|
||||||
|
|
||||||
from lib.sata.common import *
|
from lib.sata.common import *
|
||||||
|
|
||||||
|
@ -8,10 +8,16 @@ def seed_to_data(seed, random=True):
|
||||||
else:
|
else:
|
||||||
return seed
|
return seed
|
||||||
|
|
||||||
def check(ref, res):
|
def check(p1, p2):
|
||||||
if isinstance(ref, int):
|
p1 = copy.deepcopy(p1)
|
||||||
return 0, 1, int(ref != res)
|
p2 = copy.deepcopy(p2)
|
||||||
|
if isinstance(p1, int):
|
||||||
|
return 0, 1, int(p1 != p2)
|
||||||
else:
|
else:
|
||||||
|
if len(p1) >= len(p2):
|
||||||
|
ref, res = p1, p2
|
||||||
|
else:
|
||||||
|
ref, res = p2, p1
|
||||||
shift = 0
|
shift = 0
|
||||||
while((ref[0] != res[0]) and (len(res)>1)):
|
while((ref[0] != res[0]) and (len(res)>1)):
|
||||||
res.pop(0)
|
res.pop(0)
|
||||||
|
|
Loading…
Reference in a new issue