remove _n and _q
[soc.git] / TLB / src / AddressEncoder.py
index 59e92f951e35419f6d75ffddabe082067af30fbc..16eecf7cd85cc2dfd8fcc2ae73aed7c3a37f21ed 100644 (file)
@@ -3,14 +3,14 @@ from nmigen.lib.coding import Encoder, PriorityEncoder
 
 class AddressEncoder():
     """Address Encoder
-    
-       The purpose of this module is to take in a vector and 
+
+       The purpose of this module is to take in a vector and
        encode the bits that are one hot into an address. This module
        combines both nmigen's Encoder and PriorityEncoder and will state
        whether the input line has a single bit hot, multiple bits hot,
-       or no bits hot. The output line will always have the lowest value 
+       or no bits hot. The output line will always have the lowest value
        address output.
-       
+
        Usage:
        The output is valid when either single or multiple match is high.
        Otherwise output is 0.
@@ -22,10 +22,10 @@ class AddressEncoder():
         # Internal
         self.encoder = Encoder(width)
         self.p_encoder = PriorityEncoder(width)
-        
+
         # Input
         self.i = Signal(width)
-        
+
         # Output
         self.single_match = Signal(1)
         self.multiple_match = Signal(1)
@@ -33,18 +33,18 @@ class AddressEncoder():
         
     def elaborate(self, platform=None):
         m = Module()
-        
+
         # Add internal submodules
         m.submodules.encoder = self.encoder
         m.submodules.p_encoder = self.p_encoder
-        
+
         m.d.comb += [
             self.encoder.i.eq(self.i),
             self.p_encoder.i.eq(self.i)
         ]
-        
+
         # If the priority encoder recieves an input of 0
-        # If n is 1 then the output is not valid        
+        # If n is 1 then the output is not valid
         with m.If(self.p_encoder.n):
             m.d.comb += [
                 self.single_match.eq(0),
@@ -58,13 +58,13 @@ class AddressEncoder():
                 m.d.comb += [
                     self.single_match.eq(0),
                     self.multiple_match.eq(1)
-                ]   
+                ]
             # Single Match if encoder n is valid
             with m.Else():
                 m.d.comb += [
                     self.single_match.eq(1),
                     self.multiple_match.eq(0)
-                ]                 
-            # Always set output based on priority encoder output    
+                ]
+            # Always set output based on priority encoder output
             m.d.comb += self.o.eq(self.p_encoder.o)
-        return m
\ No newline at end of file
+        return m