X-Git-Url: https://git.libre-soc.org/?p=sv2nmigen.git;a=blobdiff_plain;f=examples%2Fassignment.py;fp=examples%2Fassignment.py;h=b5a5862405fa58658152b7cbf2e4eaed768dd459;hp=0000000000000000000000000000000000000000;hb=1a995ea028ff7f563f1d453f7736bd548120b604;hpb=2e123971712d469265dc4c47a69a517cc43cc6d8 diff --git a/examples/assignment.py b/examples/assignment.py new file mode 100644 index 0000000..b5a5862 --- /dev/null +++ b/examples/assignment.py @@ -0,0 +1,15 @@ +from nmigen import Memory, Module, Signal, Cat, Elaboratable + +# module_1 +#clsdeclNode(compound_stmt, [Node(classdef, [Leaf(1, 'class'), Leaf(1, 'up_counter'), Leaf(11, ':'), Node(suite, [Leaf(4, '\n'), Leaf(5, ' '), Node(stmt, [Node(small_stmt, [Node(pass_stmt, [Leaf(1, 'pass')]), Leaf(4, '\n')]), Leaf(3, '\n #self.i1 = Signal() # input\n #self.o1 = Signal() # output')]), Leaf(6, '')])])]) +#clsstr: +class assignment(Elaboratable): + def __init__(self): + self.i = Signal() # input + self.o = Signal() # output + def elaborate(self, platform): + m = Module() + m.d.comb += [self.o.eq(self.i)] + return m + +assignment()