Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/migen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6f9f08f6eb39
Choose a base ref
...
head repository: m-labs/migen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a653a6144b0c
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Aug 20, 2013

  1. genlib/misc: improve genericity of split/displacer/chooser

    enjoy-digital authored and Sebastien Bourdeauducq committed Aug 20, 2013
    Copy the full SHA
    37930d7 View commit details
  2. wishbone2lasmi : add support for 32 bits lasmim data width

    enjoy-digital authored and Sebastien Bourdeauducq committed Aug 20, 2013
    Copy the full SHA
    a653a61 View commit details
Showing with 17 additions and 5 deletions.
  1. +9 −4 migen/bus/wishbone2lasmi.py
  2. +8 −1 migen/genlib/misc.py
13 changes: 9 additions & 4 deletions migen/bus/wishbone2lasmi.py
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ def __init__(self, cachesize, lasmim):

###

if lasmim.dw <= 32:
raise ValueError("LASMI data width must be strictly larger than 32")
if lasmim.dw < 32:
raise ValueError("LASMI data width must be >= 32")
if (lasmim.dw % 32) != 0:
raise ValueError("LASMI data width must be a multiple of 32")

@@ -31,7 +31,12 @@ def __init__(self, cachesize, lasmim):

write_from_lasmi = Signal()
write_to_lasmi = Signal()
adr_offset_r = Signal(offsetbits)
if adr_offset is None:
adr_offset_r = None
else:
adr_offset_r = Signal(offsetbits)
self.sync += adr_offset_r.eq(adr_offset)

self.comb += [
data_port.adr.eq(adr_line),
If(write_from_lasmi,
@@ -49,7 +54,7 @@ def __init__(self, cachesize, lasmim):
),
chooser(data_port.dat_r, adr_offset_r, self.wishbone.dat_r, reverse=True)
]
self.sync += adr_offset_r.eq(adr_offset)


# Tag memory
tag_layout = [("tag", tagbits), ("dirty", 1)]
9 changes: 8 additions & 1 deletion migen/genlib/misc.py
Original file line number Diff line number Diff line change
@@ -24,11 +24,16 @@ def split(v, *counts):
r = []
offset = 0
for n in counts:
r.append(v[offset:offset+n])
if n != 0:
r.append(v[offset:offset+n])
else:
r.append(None)
offset += n
return tuple(r)

def displacer(signal, shift, output, n=None, reverse=False):
if shift is None:
return output.eq(signal)
if n is None:
n = 2**flen(shift)
w = flen(signal)
@@ -40,6 +45,8 @@ def displacer(signal, shift, output, n=None, reverse=False):
return output.eq(Cat(*l))

def chooser(signal, shift, output, n=None, reverse=False):
if shift is None:
return output.eq(signal)
if n is None:
n = 2**flen(shift)
w = flen(output)