From: Cole Poirier Date: Mon, 5 Oct 2020 16:44:36 +0000 (-0700) Subject: icache.py fix ispow2() util fn per https://bugs.libre-soc.org/show_bug.cgi?id=485#c53 X-Git-Tag: 24jan2021_ls180~229 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3ec2c8d4d5c902c0ea25bb6e824af429bbb5f377;p=soc.git icache.py fix ispow2() util fn per https://bugs.libre-soc.org/show_bug.cgi?id=485#c53 --- diff --git a/src/soc/experiment/icache.py b/src/soc/experiment/icache.py index 00697f6c..06031af0 100644 --- a/src/soc/experiment/icache.py +++ b/src/soc/experiment/icache.py @@ -140,7 +140,7 @@ print("WAY_BITS =", WAY_BITS) # from microwatt/utils.vhdl def ispow2(n): - return ((n << 32) & ((n-1) << 32)) == 0 + return n != 0 and (n & (n - 1)) == 0 assert LINE_SIZE % ROW_SIZE == 0 assert ispow2(LINE_SIZE), "LINE_SIZE not power of 2"