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: 0cef98373ffa
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: fe18397accdc
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 22, 2013

  1. fsm.py: set reset_state

    jordens authored and Sebastien Bourdeauducq committed Jul 22, 2013
    Copy the full SHA
    5bc9a0b View commit details
  2. wishbone.py: add Crossbar (concurrent/parallel/many-to-many interconn…

    …ect)
    jordens authored and Sebastien Bourdeauducq committed Jul 22, 2013
    Copy the full SHA
    fe18397 View commit details
Showing with 16 additions and 2 deletions.
  1. +12 −0 migen/bus/wishbone.py
  2. +4 −2 migen/genlib/fsm.py
12 changes: 12 additions & 0 deletions migen/bus/wishbone.py
Original file line number Diff line number Diff line change
@@ -98,6 +98,18 @@ def __init__(self, masters, slaves, register=False):
self.submodules += Arbiter(masters, shared)
self.submodules += Decoder(shared, slaves, register)

class Crossbar(Module):
def __init__(self, masters, slaves, register=False):
matches, busses = zip(*slaves)
access = [[Interface() for j in slaves] for i in masters]
# decode each master into its access row
for row, master in zip(access, masters):
row = list(zip(matches, row))
self.submodules += Decoder(master, row, register)
# arbitrate each access column onto its slave
for column, bus in zip(zip(*access), busses):
self.submodules += Arbiter(column, bus)

class Tap(Module):
def __init__(self, bus, handler=print):
self.bus = bus
6 changes: 4 additions & 2 deletions migen/genlib/fsm.py
Original file line number Diff line number Diff line change
@@ -30,10 +30,10 @@ def visit_unknown(self, node):
return node

class FSM(Module):
def __init__(self):
def __init__(self, reset_state=None):
self.actions = OrderedDict()
self.state_aliases = dict()
self.reset_state = None
self.reset_state = reset_state

def act(self, state, *statements):
if self.finalized:
@@ -62,6 +62,8 @@ def do_finalize(self):

self.encoding = dict((s, n) for n, s in enumerate(self.actions.keys()))
self.state = Signal(max=nstates)
if self.reset_state is not None:
self.state.reset = self.encoding[self.reset_state]
self.next_state = Signal(max=nstates)

lns = _LowerNextState(self.next_state, self.encoding, self.state_aliases)