Rename VCD file output
[gram.git] / gram / compat.py
index e049dcd0e4a014209b1b6c4b02994029755e1215..49ae71013312da80091197c800e51b072b916aa4 100644 (file)
@@ -52,16 +52,19 @@ class RoundRobin(Elaboratable):
     def elaborate(self, platform):
         m = Module()
 
-        with m.If(self.stb):
-            with m.Switch(self.grant):
-                for i in range(self.n):
-                    with m.Case(i):
-                        for j in reversed(range(i+1, i+self.n)):
-                            # If i+1 <= j < n, then t == j;     (after i)
-                            # If n <= j < i+n, then t == j - n  (before i)
-                            t = j % self.n
-                            with m.If(self.request[t]):
-                                m.d.sync += self.grant.eq(t)
+        if self.n == 1:
+            m.d.comb += self.grant.eq(0)
+        else:
+            with m.If(self.stb):
+                with m.Switch(self.grant):
+                    for i in range(self.n):
+                        with m.Case(i):
+                            for j in reversed(range(i+1, i+self.n)):
+                                # If i+1 <= j < n, then t == j;     (after i)
+                                # If n <= j < i+n, then t == j - n  (before i)
+                                t = j % self.n
+                                with m.If(self.request[t]):
+                                    m.d.sync += self.grant.eq(t)
 
         return m