return test rather than "if test return True else False"
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 5 Oct 2020 10:51:17 +0000 (11:51 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 5 Oct 2020 10:51:17 +0000 (11:51 +0100)
src/soc/experiment/icache.py

index 30dae677956401c7e1cc98b374c45d128ed3c4dc..be30d32ba5a69e6b00e2745b3d1e6bf8ec82a22d 100644 (file)
@@ -140,11 +140,7 @@ print("WAY_BITS        =", WAY_BITS)
 
 # from microwatt/utils.vhdl
 def ispow2(n):
 
 # from microwatt/utils.vhdl
 def ispow2(n):
-    if ((n << 32) & ((n-1) << 32)) == 0:
-        return True
-
-    else:
-        return False
+    return if ((n << 32) & ((n-1) << 32)) == 0:
 
 assert LINE_SIZE % ROW_SIZE == 0
 assert ispow2(LINE_SIZE), "LINE_SIZE not power of 2"
 
 assert LINE_SIZE % ROW_SIZE == 0
 assert ispow2(LINE_SIZE), "LINE_SIZE not power of 2"