Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 16 additions and 2 deletions.
  1. +12 −0 migen/bus/wishbone.py
  2. +4 −2 migen/genlib/fsm.py
12 migen/bus/wishbone.py
View
@@ -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 migen/genlib/fsm.py
View
@@ -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)

No commit comments for this range

Something went wrong with that request. Please try again.