Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 comments
  • 1 contributor
12  migen/bus/wishbone.py
@@ -98,6 +98,18 @@ def __init__(self, masters, slaves, register=False):
98 98
 		self.submodules += Arbiter(masters, shared)
99 99
 		self.submodules += Decoder(shared, slaves, register)
100 100
 
  101
+class Crossbar(Module):
  102
+	def __init__(self, masters, slaves, register=False):
  103
+		matches, busses = zip(*slaves)
  104
+		access = [[Interface() for j in slaves] for i in masters]
  105
+		# decode each master into its access row
  106
+		for row, master in zip(access, masters):
  107
+			row = list(zip(matches, row))
  108
+			self.submodules += Decoder(master, row, register)
  109
+		# arbitrate each access column onto its slave
  110
+		for column, bus in zip(zip(*access), busses):
  111
+			self.submodules += Arbiter(column, bus)
  112
+
101 113
 class Tap(Module):
102 114
 	def __init__(self, bus, handler=print):
103 115
 		self.bus = bus
6  migen/genlib/fsm.py
@@ -30,10 +30,10 @@ def visit_unknown(self, node):
30 30
 			return node
31 31
 
32 32
 class FSM(Module):
33  
-	def __init__(self):
  33
+	def __init__(self, reset_state=None):
34 34
 		self.actions = OrderedDict()
35 35
 		self.state_aliases = dict()
36  
-		self.reset_state = None
  36
+		self.reset_state = reset_state
37 37
 
38 38
 	def act(self, state, *statements):
39 39
 		if self.finalized:
@@ -62,6 +62,8 @@ def do_finalize(self):
62 62
 
63 63
 		self.encoding = dict((s, n) for n, s in enumerate(self.actions.keys()))
64 64
 		self.state = Signal(max=nstates)
  65
+		if self.reset_state is not None:
  66
+			self.state.reset = self.encoding[self.reset_state]
65 67
 		self.next_state = Signal(max=nstates)
66 68
 
67 69
 		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.