common: use reverse_bytes from litex.gen

This commit is contained in:
Florent Kermarrec 2018-10-30 11:13:09 +01:00
parent 40b99ecc05
commit 602ddec664
1 changed files with 2 additions and 8 deletions

View File

@ -2,6 +2,8 @@ from math import ceil
from migen import *
from litex.gen import *
from litex.soc.interconnect import stream
from litex.soc.interconnect.stream import EndpointDescription
from litex.soc.interconnect.csr import *
@ -9,14 +11,6 @@ from litex.soc.interconnect.csr import *
from litex.soc.interconnect.stream_packet import Header, HeaderField
def reverse_bytes(signal):
n = (len(signal)+7)//8
r = []
for i in reversed(range(n)):
r.append(signal[i*8:min((i+1)*8, len(signal))])
return Cat(*r)
class Port:
def connect(self, port):
r = [self.source.connect(port.sink),