link: fix link_tb (due to others modifications)

This commit is contained in:
Florent Kermarrec 2014-12-02 19:53:13 +01:00
parent 31b9132dd9
commit f2757ef8dd
5 changed files with 10 additions and 10 deletions

View File

@ -33,7 +33,6 @@ class CRCEngine(Module):
###
def _optimize_eq(l):
"""
Replace even numbers of XORs in the equation
@ -90,7 +89,7 @@ class SATACRC(Module):
polynom = 0x04C11DB7
init = 0x52325032
check = 0xC704DD7B
def __init__(self):
def __init__(self, dw=32):
self.d = Signal(self.width)
self.value = Signal(self.width)
self.error = Signal()

View File

@ -24,8 +24,8 @@ class Scrambler(Module):
next_value = Signal(32)
self.sync += context.eq(next_value[16:32])
# from SATA specification, if possible replace it
# with a generic implementation using polynoms.
# XXX: from SATA specification, replace it with
# a generic implementation using polynoms.
lfsr_coefs = (
(15, 13, 4, 0), #0
(15, 14, 13, 5, 4, 1, 0),

View File

@ -89,8 +89,9 @@ class BFM(Module):
self.rx_packet = []
def get_scrambler_ref(self):
p = subprocess.Popen(["./scrambler"], stdout=subprocess.PIPE)
out, err = p.communicate()
with subprocess.Popen(["./scrambler"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) as process:
process.stdin.write("0x10000".encode("ASCII"))
out, err = process.communicate()
self.scrambler_ref = [int(e, 16) for e in out.decode("utf-8").split("\n")[:-1]]
def descramble(self, packet):

View File

@ -18,9 +18,9 @@ class TB(Module):
stdin += "0x%08x " %data
stdin += "exit"
with subprocess.Popen("./crc", stdin=subprocess.PIPE, stdout=subprocess.PIPE) as process:
process.stdin.write(stdin.encode("UTF-8"))
process.stdin.write(stdin.encode("ASCII"))
out, err = process.communicate()
return int(out.decode("UTF-8"), 16)
return int(out.decode("ASCII"), 16)
def gen_simulation(self, selfp):
# init CRC

View File

@ -14,9 +14,9 @@ class TB(Module):
def get_c_values(self, length):
stdin = "0x%08x" %length
with subprocess.Popen("./scrambler", stdin=subprocess.PIPE, stdout=subprocess.PIPE) as process:
process.stdin.write(stdin.encode("UTF-8"))
process.stdin.write(stdin.encode("ASCII"))
out, err = process.communicate()
return [int(e, 16) for e in out.decode("utf-8").split("\n")[:-1]]
return [int(e, 16) for e in out.decode("ASCII").split("\n")[:-1]]
def gen_simulation(self, selfp):
# init CRC