Remove whitespace
[soc.git] / TLB / test / test_address_encoder.py
index 8c3b6ad70a006f3274032c203c61dbd838707ccf..e43b421ae19b92a98c74e3f5a6e4a3e760927e25 100644 (file)
@@ -8,10 +8,14 @@ from AddressEncoder import AddressEncoder
 
 from test_helper import assert_eq, assert_ne, assert_op
 
+# This function allows for the easy setting of values to the AddressEncoder
+# Arguments:
+#   dut: The AddressEncoder being tested
+#   i (Input): The array of single bits to be written
 def set_encoder(dut, i):
     yield dut.i.eq(i)
     yield
-    
+
 # Checks the single match of the AddressEncoder
 # Arguments:
 #   dut: The AddressEncoder being tested
@@ -20,16 +24,16 @@ def set_encoder(dut, i):
 def check_single_match(dut, sm, op):
     out_sm = yield dut.single_match
     assert_op("Single Match", out_sm, sm, op)
-    
+
 # Checks the multiple match of the AddressEncoder
 # Arguments:
 #   dut: The AddressEncoder being tested
 #   mm (Multiple Match): The expected match result
-#   op (Operation): (0 => ==), (1 => !=)    
+#   op (Operation): (0 => ==), (1 => !=)
 def check_multiple_match(dut, mm, op):
     out_mm = yield dut.multiple_match
     assert_op("Multiple Match", out_mm, mm, op)
-    
+
 # Checks the output of the AddressEncoder
 # Arguments:
 #   dut: The AddressEncoder being tested
@@ -61,23 +65,23 @@ def testbench(dut):
     output = 0
     yield from set_encoder(dut, input)
     yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
-    
+
     # Check single bit
     input = 1
     single_match = 1
     multiple_match = 0
     output = 0
     yield from set_encoder(dut, input)
-    yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)   
-    
+    yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
+
     # Check another single bit
     input = 4
     single_match = 1
     multiple_match = 0
     output = 2
     yield from set_encoder(dut, input)
-    yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)  
-    
+    yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
+
     # Check multiple match
     # We expected the lowest bit to be returned which is address 0
     input = 5
@@ -85,8 +89,8 @@ def testbench(dut):
     multiple_match = 1
     output = 0
     yield from set_encoder(dut, input)
-    yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)  
-    
+    yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
+
     # Check another multiple match
     # We expected the lowest bit to be returned which is address 1
     input = 6
@@ -94,11 +98,9 @@ def testbench(dut):
     multiple_match = 1
     output = 1
     yield from set_encoder(dut, input)
-    yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)      
-    
-    
+    yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
 
 if __name__ == "__main__":
     dut = AddressEncoder(4)
     run_simulation(dut, testbench(dut), vcd_name="Waveforms/test_address_encoder.vcd")
-    print("AddressEncoder Unit Test Success")
\ No newline at end of file
+    print("AddressEncoder Unit Test Success")