parser refactoring
[sv2nmigen.git] / examples / assignment.py
diff --git a/examples/assignment.py b/examples/assignment.py
new file mode 100644 (file)
index 0000000..b5a5862
--- /dev/null
@@ -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()