from migen.corelogic.fsm import FSM
s = Signal()
-myfsm = FSM('FOO', 'BAR')
+myfsm = FSM("FOO", "BAR")
myfsm.act(myfsm.FOO, s.eq(1), myfsm.next_state(myfsm.BAR))
myfsm.act(myfsm.BAR, s.eq(0), myfsm.next_state(myfsm.FOO))
print(verilog.convert(myfsm.get_fragment(), {s}))
# IRQ
irqs = [self.pending.w[i] & field.r for i, field in enumerate(self.enable.fields)]
- comb.append(self.irq.eq(optree('|', irqs)))
+ comb.append(self.irq.eq(optree("|", irqs)))
return Fragment(comb, sync)
class Simple():
def __init__(self, desc, slave):
for signal in desc:
- modules = self.__module__.split('.')
+ modules = self.__module__.split(".")
busname = modules[len(modules)-1]
signame = get_sig_name(signal, slave)
setattr(self, signame, Signal(BV(signal[2]), busname + "_" + signame))
i += 1
# generate master ack (resp. err) by ORing all slave acks (resp. errs)
- comb.append(self.master.ack_i.eq(optree('|', [slave[1].ack_o for slave in self.slaves])))
- comb.append(self.master.err_i.eq(optree('|', [slave[1].err_o for slave in self.slaves])))
+ comb.append(self.master.ack_i.eq(optree("|", [slave[1].ack_o for slave in self.slaves])))
+ comb.append(self.master.err_i.eq(optree("|", [slave[1].err_o for slave in self.slaves])))
# mux (1-hot) slave data return
masked = [Replicate(slave_sel_r[i], self.master.dat_i.bv.width) & self.slaves[i][1].dat_o for i in range(len(self.slaves))]
- comb.append(self.master.dat_i.eq(optree('|', masked)))
+ comb.append(self.master.dat_i.eq(optree("|", masked)))
return Fragment(comb, sync)
def subrecord(self, *descr):
fields = []
for item in descr:
- path = item.split('/')
+ path = item.split("/")
last = path.pop()
pos_self = self
pos_fields = fields
pipe_ce.eq(ack_i | ~last_valid),
ack_o.eq(pipe_ce),
stb_o.eq(last_valid),
- busy.eq(optree('|', [valid[i] for i in range(latency)]))
+ busy.eq(optree("|", [valid[i] for i in range(latency)]))
]
return Fragment(comb, sync)
self.op = op
Actor.__init__(self,
SchedulingModel(SchedulingModel.COMBINATORIAL),
- ("operands", Sink, [('a', bv_op), ('b', bv_op)]),
- ("result", Source, [('r', bv_r)]))
+ ("operands", Sink, [("a", bv_op), ("b", bv_op)]),
+ ("result", Source, [("r", bv_r)]))
def get_process_fragment(self):
return Fragment([
class Add(_SimpleBinary):
def __init__(self, bv):
- _SimpleBinary.__init__(self, '+', bv, BV(bv.width+1, bv.signed))
+ _SimpleBinary.__init__(self, "+", bv, BV(bv.width+1, bv.signed))
class Sub(_SimpleBinary):
def __init__(self, bv):
- _SimpleBinary.__init__(self, '-', bv, BV(bv.width+1, bv.signed))
+ _SimpleBinary.__init__(self, "-", bv, BV(bv.width+1, bv.signed))
class Mul(_SimpleBinary):
def __init__(self, bv):
- _SimpleBinary.__init__(self, '*', bv, BV(2*bv.width, bv.signed))
+ _SimpleBinary.__init__(self, "*", bv, BV(2*bv.width, bv.signed))
class And(_SimpleBinary):
def __init__(self, bv):
- _SimpleBinary.__init__(self, '&', bv, bv)
+ _SimpleBinary.__init__(self, "&", bv, bv)
class Xor(_SimpleBinary):
def __init__(self, bv):
- _SimpleBinary.__init__(self, '^', bv, bv)
+ _SimpleBinary.__init__(self, "^", bv, bv)
class Or(_SimpleBinary):
def __init__(self, bv):
- _SimpleBinary.__init__(self, '|', bv, bv)
+ _SimpleBinary.__init__(self, "|", bv, bv)
class LT(_SimpleBinary):
def __init__(self, bv):
- _SimpleBinary.__init__(self, '<', bv, BV(1))
+ _SimpleBinary.__init__(self, "<", bv, BV(1))
class LE(_SimpleBinary):
def __init__(self, bv):
- _SimpleBinary.__init__(self, '<=', bv, BV(1))
+ _SimpleBinary.__init__(self, "<=", bv, BV(1))
class EQ(_SimpleBinary):
def __init__(self, bv):
- _SimpleBinary.__init__(self, '==', bv, BV(1))
+ _SimpleBinary.__init__(self, "==", bv, BV(1))
class NE(_SimpleBinary):
def __init__(self, bv):
- _SimpleBinary.__init__(self, '!=', bv, BV(1))
+ _SimpleBinary.__init__(self, "!=", bv, BV(1))
class DivMod(Actor):
def __init__(self, width):
for x in self.dfg.edges(data=True)]
this = sum(this_fragments, Fragment())
others = sum([node.get_fragment() for node in self.dfg], Fragment())
- busy = Fragment([self.busy.eq(optree('|', [node.busy for node in self.dfg]))])
+ busy = Fragment([self.busy.eq(optree("|", [node.busy for node in self.dfg]))])
return this + others + busy
def add_connection(dfg, source_node, sink_node, source_ep=None, sink_ep=None):
source = self.endpoints["source"]
sinks = [self.endpoints["sink{0}".format(n)]
for n in range(len(self.endpoints)-1)]
- comb = [source.stb.eq(optree('&', [sink.stb for sink in sinks]))]
+ comb = [source.stb.eq(optree("&", [sink.stb for sink in sinks]))]
comb += [sink.ack.eq(source.ack & source.stb) for sink in sinks]
return Fragment(comb)
raise SystemExit("migen requires python {0} or greater".format(
".".join(map(str, required_version))))
-packages = ['migen']
+packages = ["migen"]
packages_dir = os.path.sep.join((here, packages[0]))
for entry in os.listdir(packages_dir):
if (os.path.isdir(os.path.sep.join((packages_dir, entry))) and
- os.path.isfile(os.path.sep.join((packages_dir, entry, '__init__.py')))):
- packages.append('.'.join((packages[0], entry)))
+ os.path.isfile(os.path.sep.join((packages_dir, entry, "__init__.py")))):
+ packages.append(".".join((packages[0], entry)))
-packages_dir={'': 'migen'}
+packages_dir={"": "migen"}
setup(
name="migen",
version="unknown",